Skip to content

Conversation

@rykov
Copy link

@rykov rykov commented Mar 23, 2016

Currently prerelease versions like 1.2.5-beta are matched successfully against non-prerelease ranges like >= 1.2.0. This may cause undesired behavior and/or unexpected instability.

This change is to restrict prerelease matches to more closely follow npm-semver:
https://github.com/npm/node-semver#prerelease-tags

@blang
Copy link
Owner

blang commented Mar 30, 2016

Sry for the delay, looks good but i have to check this first.
It's a comprehensible action taken by node-semver but it may also lead to confusion if this exception case is not known to the users

@rmg
Copy link

rmg commented Apr 24, 2016

Since semver itself doesn't specify range semantics and node-semver is probably the most widely known implementation of semver that implements ranges, I think it makes sense to follow it. That is the behaviour I would expect, at least.

@rykov
Copy link
Author

rykov commented Apr 25, 2016

Looks like there's a 2 year old issue to make it official - semver/semver#205

@blang
Copy link
Owner

blang commented Apr 30, 2016

It took some time since i had to verify this is fully compliant.
I added some simple tests which fail, see branch feat_noderange

To verify this, is used the script version of node-semver, not the cli version

@c2h5oh
Copy link

c2h5oh commented Jul 12, 2016

http://semver.org/#spec-item-9

A pre-release version MAY be denoted by appending a hyphen and a series of dot separated identifiers immediately following the patch version. Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Numeric identifiers MUST NOT include leading zeroes. Pre-release versions have a lower precedence than the associated normal version. A pre-release version indicates that the version is unstable and might not satisfy the intended compatibility requirements as denoted by its associated normal version. Examples: 1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-0.3.7, 1.0.0-x.7.z.92.

Emphasis mine

@arieldelfor
Copy link

What is the status for this feature?

I'm facing same issue. I didn't try with this pull request yet.

$ semver compare 3.0.0-rc.0  3.0.0
>>> 1
$ semver compare 3.0.0  3.0.1
>>> -1

@blang
Copy link
Owner

blang commented Oct 2, 2017

I'm currently working on a rework of the range system which allows us to support this kind of special semantic and most of node-semvers operators. Expect it in the next 2-4 weeks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants