-
Notifications
You must be signed in to change notification settings - Fork 515
Closed
Description
I want to define a version range that matches all versions of a certain major, including any prereleases of this major.
I tried using just "2" or "2.x.x" and adding the includePrerelease: true
option to all function calls, however then I get weird behavior at the corner cases:
semver.satisfies("2.0.0-pre.0", "2.x.x", {includePrerelease: true}); // false, I expected true
semver.satisfies("2.1.0-pre.0", "2.x.x", {includePrerelease: true}); // true
semver.satisfies("3.0.0-pre.0", "2.x.x", {includePrerelease: true}); // true, I expected false
I know that this behavior matches the definition of ^1.x := >=1.0.0 <2.0.0
However I think the behavior should be altered in case of the includePrerelease
flag.
It's relevant for the following situation:
- I implement a program against the interface of version 2.x.x.
- I want to always get the newest version of this interface, also prereleases, so I use the includePrerelease flag.
- However as soon as there is an 3.0.0-pre, this will break my interface because it's treated as 2.x.x
Metadata
Metadata
Assignees
Labels
No labels