cli icon indicating copy to clipboard operation
cli copied to clipboard

Command or option to query from registry

Open nickserv opened this issue 2 years ago • 1 comments

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

  • npm view #lodash (automatically prefix with # if a package spec is given for back compatibility)
  • npm query --registry #lodash

nickserv avatar Jan 02 '23 13:01 nickserv

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

ima-antonio avatar Jan 08 '23 17:01 ima-antonio