Determine most popular version of a given npm package?

后端 未结 3 1745
无人及你
无人及你 2021-02-13 14:24

The npm registry provides metrics on the most depended packages, but say you wanted to determine the most popular version of a given package - is that possible?

相关标签:
3条回答
  • 2021-02-13 14:39

    NPM exposes now a number of downloads per version.

    https://www.npmjs.com/package/typescript -> click "versions"

    0 讨论(0)
  • 2021-02-13 14:46

    It'd be really nice if there are such statistics provided by NPM. But unfortunately there aren't any such statistics available at the moment.

    NPM only provides total downloads in the last month. If you want to see total downloads over a larger period of time you can use npm-stat. But also it doesn't give download status specific to each version.

    Usually npm install --save <package-name> installs the latest version available at the moment, which is locked to the package.json file. If u want to upgrade to the advanced version later, currently the best way is to follow the upgrade instruction provided by the package's documentation or seek support from the developers of the package to check if the upgrade is worth your time.

    0 讨论(0)
  • 2021-02-13 15:05

    This might not be the answer you are looking for but unfortunately it doesn't seem like that's possible. You do have a way to see total downloads and there are sites like npm-stat to show a breakdown of when downloads are happening. You might be able to infer from when releases happen for specific packages to get an idea of how many downloads that version has.

    It's worth mentioning npm's article on how download counts work though so you can't say download counts == number of people who did npm install

    Another, although rather extreme, option is you could try and search for JSON files that have the react-router and see the dependencies. I was hoping to see if Github or SearchCode had filtering options for you to specify it but it only has so many filters. You could probably automate this though but naturally it would still not be very accurate.

    Also worth mentioning there is an open issue regarding instrumenting analytics into npm CLI

    0 讨论(0)
提交回复
热议问题