Created
September 13, 2012 20:12
-
-
Save isao/3717231 to your computer and use it in GitHub Desktop.
manually check semver's handling of '>x.x' style ranges
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var semver = require('semver') | |
function gettest(range) { | |
return function(version) { | |
var isok = semver.satisfies(version, range) ? 'is' : 'is not' | |
console.log('v%s %s supported for range %s', version, isok, range) | |
} | |
} | |
['0.2.0', | |
'0.3.9', | |
'0.4', | |
'0.3.9', | |
'0.4.0', | |
'0.4.9', | |
'0.5.0', | |
'0.6.0', | |
'0.8.0', | |
'0.8.8', | |
'0.9.0'].forEach(gettest('>0.4')); | |
['1.0.0', | |
'1.0.1', | |
'1.1.29'].forEach(gettest('>1.0')) |
also note:
semver.valid('0.4');//null
semver.valid('0.5')//null
in reference to YahooArchive/mojito/pull/498
Ah, semver has it's own cli. This script is kinda redundant
Usage: semver -v [-r ]
Test if version(s) satisfy the supplied range(s),
and sort them.
Multiple versions or ranges may be supplied.
Program exits successfully if any valid version satisfies
all supplied ranges, and prints all satisfying versions.
If no versions are valid, or ranges are not satisfied,
then exits failure.
Versions are printed in ascending order, so supplying
multiple versions to the utility will just sort them.
example
% semver -v 0.6.0 -r '>0.6''
0.6.0 #ok
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
v0.2.0 is not supported for range >0.4
v0.3.9 is not supported for range >0.4
v0.4 is not supported for range >0.4
v0.3.9 is not supported for range >0.4
v0.4.0 is supported for range >0.4
v0.4.9 is supported for range >0.4
v0.5.0 is supported for range >0.4
v0.6.0 is supported for range >0.4
v0.8.0 is supported for range >0.4
v0.8.8 is supported for range >0.4
v0.9.0 is supported for range >0.4
v1.0.0 is supported for range >1.0
v1.0.1 is supported for range >1.0
v1.1.29 is supported for range >1.0