-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
Confusing process.release.compareVersion API #20053
Comments
@devsnek originally landed the API with the signum as you described in #19438, which was reverted after I expressed my concern that the signum might be counterintuitive (see #19574 (comment)):
The following discussion was a bit difficult to follow as @devsnek edited his response about ten times, but in one of the first revisions he agreed with me. |
I suggest you change it, as the way I see it isn't apparently very popular. I'll approve whatever pr is opened 👍 |
The return value was not intuitive. It is now exactly the other way around as it was originally implemented. This also fixes a bug with the pre-release tag where the former implementation detected `1.0.0` to be "younger" than `1.0.0-pre`. Fixes: nodejs#20053
Why is this even in core? This is the definition of feature creep, users should just be using the semver package to do this themselves rather than duplicating all that logic and prerelease rules. The whole of #19587 is a smell, we're duplicating existing functionality (the numbers themselves! what's wrong with a I'd +1 removing it entirely as a "fix", would I be alone in that? |
proposing reversion @ #20062 along with some reasons and some notes on how the API is currently broken |
The whole API got reverted. Closing therefore |
It might only be me but the current implementation is not intuitive for me because I expect the output to be exactly the opposite of what it is. Even though it is not right or wrong either way.
Let's give an example.
The current master version is
10.0.0-pre
.That way I expect
9.0.0
to return-1
because the input value is lower than the current version. Instead, it is1
, because the current version is bigger than the input value. So it depends on what viewpoint the user is in.For me, it is more intuitive to have the input value being the main important part and not the current version (I hope it is clear what I want to express...).
So I would like to hear from others @nodejs/collaborators how they feel about this (it did not yet land on any release, so there would theoretically still be time to change this without being semver-major).
The text was updated successfully, but these errors were encountered: