Skip to content

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

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

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

Conversation

@dyk1454683243-sudo

@dyk1454683243-sudo dyk1454683243-sudo commented Sep 20, 2026 •

Copy link
Copy Markdown
Owner

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.

Upstream PR: npm#903

Tests

References

Fixes npm#751

Open in Web Open in Cursor 

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>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-20T16:58:18.849303Z dffea90 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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