-
Notifications
You must be signed in to change notification settings - Fork 472
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
Optional prerelease version lock #192
Optional prerelease version lock #192
Conversation
…match higher non-prerelease versions
Package is available from the NPM repo as |
Is there any chance to get this into |
This is a good idea, and addresses a real need, but I definitely feel like the maximum number of boolean options is 1 (or maybe zero), so we need to switch to an options object. Also, the default behavior should be used when the option is falsey, for consistency. In order to prevent a backwards compatibility breakage and major version bump, we can add |
(Don't feel pressure to do extra work. If you don't get to it, I will relatively soon. Just documenting the decisions here so it's not left hanging, if anyone else wants to pick it up.) |
Actually I lied, I had a meeting get canceled so I did it. The question now is whether this is semver major or minor. It does change the case when you might've used a truthy non-boolean as the |
Thanks a lot. I think, I would go for a major change. |
The docs said
so if someone provided a truthy value instead of Anyway, thanks for integrating this 👍 |
The only truthy value that would cause an issue (in the current code on master) would be an object without a |
This also adds prerelease inclusion support to all other matching functions Close npm#192
Prerelease versions are currently only satisfied by ranges containing a prerelease tag with the same
[major, minor, patch]
tuple as documented, which makes sense for the default use-cases of this library.I currently have a use-case where I want to to specify version ranges of test cases to be run for certain versions of a tested software component. E.g. to run a test on all versions that ever exist, including prerelease versions (e.g. release candidates), I want to specify the range '*'. To run a test on all versions starting with prereleases of '2.0.0', I specify the range '>=2.0.0-0'. '>=2.0.0-0' should thus match '2.0.0-rc1', '2.0.0', '2.1.0-rc1', '2.2.0', etc., which is currently prevented by the
[major, minor, patch]
prerelease version lock.To be able to use this library in such cases, I added an additional parameter
prereleaseLock
to thesatisfies
method (satisfies(version, range, loose, prereleaseLock)
), which istrue
by default to get the default version locking behavior, and disables the version lock behavior when set tofalse
. This is basically what has been described by @isaacs in #130 (here.