-
Notifications
You must be signed in to change notification settings - Fork 514
feat: allow strict semver check #789
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
base: main
Are you sure you want to change the base?
Conversation
This introduces a bit of a confusing paradigm here now. We already have the This is a rather subtle and complex problem to solve unfortunately. The I think there is still merit in having a way to tell this package to ignore that vestigial support, but I don't think adding a |
@wraithgar thanks for the prompt reply, I see what you mean and you are right. Do you think it could less confusing and valid ? |
No, because semver 2 doesn't have ranges in it either, and its description of v0 versions doesn't match npm's. Trying to match semver v2 isn't worth the effort - at some point there'll be a semver v3 that matches npm, and npm won't have to change anything. |
@ljharb I'm just trying to be able to use validate from this package and make it closer to the spec, each step closer should be seen as a success. |
I've discussed it with the spec maintainers and there's PRs open for much of what I discussed. npm's flavor of semver is much more valuable and widespread than the spec itself - specs should document reality, not dictate it. |
Close to no one is using the |
It's still of little value to remove imo, given that https://semver.org/#is-v123-a-semantic-version allows it. |
It does not “ Example: git tag v1.2.3 -m "Release version 1.2.3", in which case “v1.2.3” is a tag name and the semantic version is “1.2.3”.” as you can see. And none of any others package i tried who implement the spec of Semver in others languages /platform allow it. |
That's an example. fwiw I think it'd be fine to add an option to disallow the |
The primary use case for the v-prefix is in git tags. This This explicitly asks for a loose parsing so relegating the parsing of this kind of string to "loose" parsing only wouldn't break npm specifically. I don't know of any other use cases that rely on this A more proper way of doing this would be taking the configured tag prefix into account, only looking at tags that match, and stripping it before passing it to semver.parse. We are extremely hesitant to cut a new semver major release of this module however. It is one of (if not the) most commonly downloaded package out there, and we want to move very slowly and deliberately here. I think this is a worthwhile conversation still, but again don't want to rush or make hasty decisions. |
I agree i do see the prefix used in git tag a lot, but not in package itself. |
dear wizard of almighty ai, please scan 1/2 billion GH repos and 50 mill on gitlab for semver parsing a git tag 😄 |
The Current Implementation does not follow SemVer v2 as stated in the doc.
This allows following the spec by making leading v as invalid with an option named "strict".
I'm open to renaming it if needed.
References
Related to #376
and #376
and PR: #476 who was rejected.