Skip to content

fix: do not double-bump pre* increments from a prerelease - #903

Closed
dyk1454683243-sudo wants to merge 1 commit into
npm:mainfrom
dyk1454683243-sudo:cursor/fix-premajor-from-prerelease-751-68a0
Closed

dyk1454683243-sudo wants to merge 1 commit into
npm:mainfrom
dyk1454683243-sudo:cursor/fix-premajor-from-prerelease-751-68a0

Conversation

@dyk1454683243-sudo

Copy link
Copy Markdown

What / Why

premajor, preminor, and prepatch jumped an extra version when the input was already a prerelease of that release type.

The docs say these operations bump to the next major/minor/patch and then down to a prerelease of that version. Isolated steps already do the right thing:

semver.inc('2.0.0-pre', 'major') // '2.0.0'
semver.inc('2.0.0', 'pre')       // '2.0.0-0'

but inc('2.0.0-pre', 'premajor') returned 3.0.0-0.

This change makes premajor/preminor/prepatch compose as major/minor/patch followed by pre, so they reuse the existing “already a prerelease of this type” logic and no longer double-bump.

Tests

References

Fixes #751

premajor, preminor, and prepatch now compose as major/minor/patch
followed by pre, matching the docs and avoiding an extra version jump
when the input is already a prerelease of that release type.

Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>
@dyk1454683243-sudo

Copy link
Copy Markdown
Author

Withdrawing this PR while I clean up a high-volume open-PR backlog. Sorry for the noise — happy to come back later with a focused change if useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] inc premajor, preminor, and prepatch do the wrong thing if the version is already a pre-release.

2 participants