npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

package-version-compat

v0.0.1

Published

A command-line tool that finds the compatible version range of npm dependencies based on the specified version of Node.js

Downloads

3

Readme

package-version-compat

package-version-compat is a command-line tool that finds the compatible version range of npm dependencies based on the specified version of Node.js.

简体中文

Install

npm install -g package-version-compat

Usage

pvc

pvc

By default, executing this command will cause package-version-compat to read the current Node version and the current npm registry URL, and attempt to read dependencies and devDependencies from the package.json file in the root path where the command is executed. Package-version-compat will then find the version ranges of dependencies and devDependencies that are compatible with the current Node environment from the npm registry, and update the package.json with the latest versions within those ranges.

For example, assuming the current Node version is 16.20.2, the package.json is as follows:

"dependencies": {
    "react": "^18.3.1",
    "react-dom": "^18.3.1"
},
"devDependencies": {
    "typescript": "^5.6.2"
}

After executing the pvc command, package-version-compat will find that under Node.js v16.20.2, the compatible version range for react is >=0.1.2 <=18.3.1, for react-dom is >=0.1.0 <=18.1.0, and for typescript is >=0.8.0 <=5.6.2. The package.json will be updated as follows:

"dependencies": {
    "react": "18.3.1",
    "react-dom": "18.1.0"
},
"devDependencies": {
    "typescript": "5.6.2"
}

--deps

pvc --deps react react-dom

The deps parameter is used to specify the dependencies to be searched. When the deps parameter is present, package-version-compat will not retrieve dependencies and devDependencies from the package.json file. After the command is executed, the dependency versions will be updated in the package.json file.

--dev-deps

pvc --dev-deps typescript eslint

The dev-deps parameter is used to specify the devDependencies to be searched. When the dev-deps parameter is present, package-version-compat will not retrieve dependencies and devDependencies from the package.json file. After the command is executed, the dependency versions will be updated in the package.json file.

--node

pvc --deps react react-dom --node 14.13.0

The node parameter is used to specify the Node version to be adapted.

--all-version

pvc --deps react react-dom --all-version

By default, package-version-compat will only search for stable versions of (dev)dependencies, versions such as beta and alpha are not included in the search. You can set this parameter to search for all versions of dependencies.

--view

pvc --deps react react-dom --view

By default, package-version-compat will modify the version numbers of (dev)dependencies in the package.json file. If you only want to view the version ranges of (dev)dependencies that are compatible with the Node version, you can use the view parameter. In this case, the version ranges will only be printed to the terminal and the package.json file will not be modified.