Repository navigation
fix: do not leapfrog when pre-incrementing an existing prerelease - #957
Open
waw666waw666 wants to merge 1 commit into
Open
waw666waw666 wants to merge 1 commit into
waw666waw666 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #751
premajorandpreminoralways incremented the major/minor componentbefore adding the prerelease, even when the version was already a
prerelease of that exact release:
The non-
preincrements already handle this case:majoron2.0.0-prereturns2.0.0without bumping, andminoron1.2.0-5returns
1.2.0. Thepre*variants now mirror those conditionsexactly —
premajoronly bumps the major when the minor or patch isnon-zero or there is no prerelease, and
preminoronly bumps theminor when the patch is non-zero or there is no prerelease.
prepatchis intentionally unchanged: the existing fixtures pin1.2.0-1+prepatchto1.2.1-0, so its "next patch as aprerelease" semantics are preserved.
One existing fixture is corrected as part of this fix:
1.2.0-dev+preminorpreviously expected1.3.0-beta, which isthe leapfrogging behaviour reported in #751 (
minoron the sameinput returns
1.2.0); it now expects1.2.0-beta.New increment fixtures cover already-at-target prereleases for both
premajorandpreminor, with and without an explicit identifier.They fail without this change and pass with it. The full tap suite
passes with 100% coverage, and eslint is clean on the changed files.