npm / cli

the package manager for JavaScript
https://docs.npmjs.com/cli/
Other
8.33k stars 3.06k forks source link

Command or option to query from registry #6015

Open nickserv opened 1 year ago

nickserv commented 1 year ago

I'd like a way to combine the dependency selector syntax of npm query with the registry data provided by npm view. npm query only supports locally installed packages, and npm view doesn't support dependency selectors. For example, you could use this to find all packages depending on a vulnerable version of a package, or find alternative versions of dependencies that fit your requirements with less peer dependencies (especially useful with the more strict peer dependency algorithm of npm 7).

Possible commands

ima-antonio commented 1 year ago

I don't know if I understood your question well, but here goes:

There are a few ways to combine npm query's dependency selector syntax with the log data provided by npm view. One option is to use the npm-check-updates module to check for available updates to a project's dependencies.

To use npm-check-updates, install it globally using the npm install -g npm-check-updates command. Then run the ncu command in the project's directory to check for available updates to the project's dependencies. You can also use the ncu -u command to automatically update the package.json file with new versions of dependencies.

Another option is to use the npm-install-peers module to install a package's peer dependencies. npm-install-peers installs a package's peer dependencies using the same version the package uses. To use npm-install-peers, install it globally using the npm install -g npm-install-peers command and run the npm-install-peers command in the package directory