We are developing custom packages and each package is maintained under the scope. For example:
@nest/common
@nest/core
@nest/microservice
How to get the list of packages available in the particular scope? For e.g I want to view the list of packages under @nest
. npm list
returns all the packages.
Use the npm list to show the installed packages in the current project as a dependency tree. Use npm list --depth=n to show the dependency tree with a specified depth. Use npm list --prod to show packages in the dependencies . Use npm list --dev to show packages in the devDependencies .
Scopes are a way of grouping related packages together, and also affect a few things about the way npm treats the package. Each npm user/organization has their own scope, and only you can add packages in your scope. This means you don't have to worry about someone taking your package name ahead of you.
NPM List Command: Lists all the packages as well as their dependencies installed. npm ls. Example: npm ls lists all of the npm packages installed in the package. json file.
npm uses the search api from npms.io [docs], which, includes the following:
Besides normal text, q supports qualifiers to express filters and other modifiers:
scope:types
: Show/filter results that belong to the@types
scope
$ curl -s "https://api.npms.io/v2/search?q=scope:nest" | jq -r '.results[] | .package.name'
@nest/testing
@nest/core
@nest/microservices
@nest/websockets
» npm search scope:nest
NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS
@nest/testing | Nest - the testing… | =wbhob | 2017-12-22 | 4.5.4 |
@nest/core | Nest - the core… | =wbhob | 2017-12-22 | 4.5.4 |
@nest/microservices | Nest - the… | =wbhob | 2017-12-22 | 4.5.4 |
@nest/websockets | Nest - the… | =wbhob | 2017-12-22 | 4.5.4 |
Updated 2022-10-03
Original Answer:
Searching on npm for the explicit scope will return the available public packages for that scope.
For example:
» npm search @nest
NAME | DESCRIPTION | AUTHOR | DATE
@nest/testing | Nest - the testing… | =wbhob | 2017-12-22
@nest/core | Nest - the core… | =wbhob | 2017-12-22
@nest/websockets | Nest - the… | =wbhob | 2017-12-22
@nest/microservices | Nest - the… | =wbhob | 2017-12-22
If the scope contains more than 20 packages, you need to use the --searchlimit
option with a higher limit, like npm --searchlimit=100 search @nestjs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With