-
Notifications
You must be signed in to change notification settings - Fork 492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
meaning of ~ is inconsistent #31
Comments
@dominictarr In the second deep equal, you are comparing two identical |
@vierbergenlars sorry, corrected. |
@dominictarr The more I think about this, the more I think you're right. I'd like to make a proper specification for version ranges, and then comply with it. |
Yeah, I don't think this is a good idea. I did some investigation recently into how versions and ranges are used on the registry. Changing this is more disruptive than not changing it. |
Fair enough. I'm now using |
Also, for better or worse, it IS identical to the meaning of |
when specifying a patch range, ~ means greater than of equal to the next least significant value, but before but don't go into the next range.
i.e.
~1.2.3
means, I want patches to this module, but not if it means taking a new feature.contrast that with
1.2.3
which means only use this exact version.indeed,
assert.deepEqual(semver.toComparators('~1.2.3'), semver.toComparators('1.2.3'))
throws, as it should.however,
you can also say '~1.2' which, if I was extending the meaning of ~ from before id expect it to give me
1.2.3
,1.3.4
, but not2.0.0
.however,
deepEqual(toComparators('~2.16'), toComparators('2.16'))
does not throw!turns out, ~ on means anything when you have a full semver and nothing when you have only one or two values.
This behaviour is documented
(although, it could be documented more clearly by saying that in
~x.y
'~' is ignored.)Would you take a patch to make ~ behave consistently?
The text was updated successfully, but these errors were encountered: