Tuesday, 23 October 2018

Check if latest npm package version has same major version

Say I have an NPM package:

current_version="1.2.3";
latest_version=`npm view "$package_name" version`

how can I use the semver command line tool to determine if the latest version in npm has the same major version as the current_version? Something like:

semver --same-major "$current_version" "$latest_version" 

?

Basically, what I want to do is install to the most recent version with the same major version.

Another related question - how can I find the most recent version in the NPM registry that has the same major semver version as the current_version?

https://www.npmjs.com/package/semver



from Check if latest npm package version has same major version

No comments:

Post a Comment