-
Notifications
You must be signed in to change notification settings - Fork 151
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
strict version checking feature #243
base: master
Are you sure you want to change the base?
Conversation
* `==1.2.1-alpha` will only look for a `1.2.1-alpha` preleased version | ||
* `==1.2.1+alpha` will only look for a `1.2.1-alpha` preleased version | ||
|
||
> This helps looking for a very specific version only, the `=` operator (or the no operator) will be ok with metadatas in the version in the first place, ex: `=1.2.1` will be equivalent to `=1.2.1+x` where `x` can be any medatata. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As described here, the issue lied in here, we are not able to differentiate a version with metadatas and a version without metadatas with the actual constraints comparisons possibilities
{"4.1.x", "4.1.3", true}, | ||
{"4.1.x", "4.1.3+alpha", true}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the issue, it's also the case without dirty
any news regarding this pull request? @mattfarina |
Any news on that @mattfarina ? |
{"==2", "1", false}, | ||
{"==2", "3.4.5", false}, | ||
{"==2", "2.0.0", false}, | ||
{"==2", "2.0.0+alpha", false}, | ||
{"==2", "2.0.0-alpha", false}, | ||
{"==2", "2.0.1", false}, | ||
{"==2.1", "2.1.0", false}, | ||
{"==2.1.x", "2.1.0", false}, | ||
{"==2.1.x", "2.1.1", false}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't have a version that's "2". So, a constraint of ==2
can never be matched against.
Since other comparisons allow shortened versions with assumptions on missing parts this looks to be confusing to user input that's run through here. That, I think, means more support requests.
node-semver does ==
and ===
which you can find out about at https://github.com/npm/node-semver?tab=readme-ov-file#comparison.
When I look at ===
with missing parts (e.g., ===1
) it falls into a loose rather than exact string situation. but, if you put a full semver in there is a string comparison.
What do you think of the node-semver model?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with your point, since there was no double equal operator I didn't thinked too much about it, maybe I am wrong, here what I think should be some constraints examples that follows the node-semver model:
- simple equal operator
=
:
"=2.x.x", "2.0.1", true
"=2.x.x", "2.0.1+mybuild", true
"=2.x.x", "2.0.1-beta+mybuild", true
"=2.x.x+build", "2.0.1", false
"=2.x.x+build", "2.0.1+mybuild", true
"=2.x.x-beta+build", "2.0.1+mybuild", (true or false)? # In this case, in the node model, the version and the build would correspond, so it could be equal if beta is not taken into account
"=2.x.x-beta+build", "2.0.1-beta+mybuild", true
- double equal operator
==
:
"==2.x.x", "2.0.1", true
"==2.x.x", "2.0.1+mybuild", false
"==2.x.x", "2.0.1-beta+mybuild", false
"==2.x.x+build", "2.0.1", false
"==2.x.x+build", "2.0.1+mybuild", true
"==2.x.x-beta+build", "2.0.1+mybuild", false
"==2.x.x-beta+build", "2.0.1-beta+mybuild", true
- triple equal operator
===
:
"===2.x.x", "2.0.1", false
"===2.x.x", "2.0.1+mybuild", false
"===2.x.x", "2.0.1-beta+mybuild", false
"===2.x.x+build", "2.0.1", false
"===2.x.x+build", "2.0.1+mybuild", false
"===2.x.x-beta+build", "2.0.1+mybuild", false
"===2.x.x-beta+build", "2.0.1-beta+mybuild", false
"===2.0.1", "2.0.1", true
"===2.0.1", "2.0.1+mybuild", false
"===2.0.1", "2.0.1-beta+mybuild", false
"===2.0.1+build", "2.0.1", false
"===2.0.1+build", "2.0.1+mybuild", true
"===2.0.1-beta+build", "2.0.1+mybuild", false
"===2.0.1-beta+build", "2.0.1-beta+mybuild", true
I'm pretty much ok with the node-semver model, and this example as well, if we can be sure to find a specific version or subset of versions it would be perfect 👍
As described here: #242
Implemented strict version checking, which is not a breaking change.
So it should have no impact on the previous features 👍