6

Considering I want to find all packages by several criteria and list them, e.g. find by polyfill keyword and filter by specific user.

How can this be done?

The reason I'm asking on SO is that I suspect that this feature is not officially supported by NPM CLI tool and website and may require the use of NPM API.

Estus Flask
  • 206,104
  • 70
  • 425
  • 565

2 Answers2

2

To search by author and keyword, you can use the following query in the npmjs.com search bar:

author:sindresorhus keywords:polyfill

According to the npm docs on Searching for and choosing packages to download:

npm search uses npms and the npms analyzer in the website searchbar

According to the NPMS (NPM Search) docs on how to perform a search query, you can use the following operators:

Search Syntax Description
scope:types Show/filter results that belong to the @types scope
author:sindresorhus Show/filter results in which sindresorhus is the author
maintainer:sindresorhus Show/filter results in which sindresorhus is qualifier as a maintainer
keywords:gulpplugin Show/filter results that have gulpplugin in the keywords (separate multiple keywords with commas, you may also exclude keywords e.g. -framework)
not:deprecated Exclude deprecated packages from the results
not:unstable Exclude packages whose version is < 1.0.0
not:insecure Exclude packages that are insecure or have vulnerable dependencies (as per nsp)
is:deprecated Show/filter is deprecated packages
is:unstable Show/filter packages whose version is < 1.0.0
is:insecure Show/filter packages that are insecure or have vulnerable dependencies (as per nsp)
boost-exact:false Do not boost exact matches, defaults to true
score-effect:14 Set the effect that package scores have for the final search score, defaults to 15.3
quality-weight:1 Set the weight that quality has for the each package score, defaults to 1.95
popularity-weight:1 Set the weight that popularity has for the each package score, defaults to 3.3
maintenance-weight:1 Set the weight that the quality has for the each package score, defaults to 2.05

See Also: How to find search/find npm packages

KyleMit
  • 30,350
  • 66
  • 462
  • 664
1

It's not necessarily fully featured, but there is an npm search command-line argument. It allows searching by username with a search term starting with =, e.g. npm search express =dougwilson.

More granular searching doesn't seem supported. Open an issue?

EDIT: Also, this answer has a list of resources as well.

R Y
  • 455
  • 1
  • 3
  • 13
  • Thanks for the answer. I have a specific demand, to find a package both by username and keyword. `npm search` doesn't seem to support this, does it? – Estus Flask Mar 21 '19 at 11:48
  • No, more granular searching doesn't seem supported. It allows searching by username with a search term starting with `=`, e.g. `npm search express =dougwilson`. Open an [issue](https://github.com/npm/npm/issues)? – R Y Mar 21 '19 at 13:23
  • Yes, I will likely open. Sadly, NPM issues don't get much attention. – Estus Flask Mar 21 '19 at 15:02