Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show most recently published versions of npm package, including beta versions

Tags:

How can I show the most recently published versions of an npm package, including beta/unstable versions?

This question helps identify how you can get the most recent, stable version (does not show beta version), but I would like to see a list of the several most recent versions, including beta versions.

$ npm view webpack versions    ...   '0.7.9',   '0.7.11',   '0.7.12',   '0.7.13',   '0.7.14',   '0.7.15',   '0.7.16',   '0.7.17',   '0.8.0-beta1',   '0.8.0-beta2',   ... 316 more items ] 

I would like to show the "tail" of this list, instead of seeing the first several packages that were released. Is this possible?

How can I show a list of the most recently released versions for a particular npm package?

like image 962
Himmel Avatar asked Aug 03 '16 17:08

Himmel


People also ask

How do I list npm versions?

This npm ls --depth=0 will list all local modules as name@version . ` Or globals: npm -g ls --depth=0 .

How do I check if I have the latest version of a package?

Use npm view [package-name] version to know the specific latest version of a package available on the npm registry. Use npm list [package-name] to know the specific latest version of an installed package. Use npm install [package-name]@[version-number] to install an older version of a package.


2 Answers

You can use --json flag to output all the versions in the json format, which is quite human-readable

like image 161
Denys Mikhalenko Avatar answered Oct 16 '22 16:10

Denys Mikhalenko


I could not overcome that ...xxx more items] issue until I found this blog post by Will Anderson, who should get credits:

npm view some-package-name@* version

The trick is to have a glob with all available package versions, and then for each one of those show its "latest" (one and only) version.

EDIT

As per comment observation (and original blog post), that does not show pre-release versions. To also get pre-release versions and not incur into ... XX more items ] output, one can run (note plural versions):

npm view some-package-name versions --json

like image 40
superjos Avatar answered Oct 16 '22 17:10

superjos