Skip to content
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

Pre-release id version do not update with a provided pre-release id #226

Open
stephenlacy opened this issue Dec 14, 2017 · 1 comment
Open
Labels
Bug thing that needs fixing

Comments

@stephenlacy
Copy link

Stemming from stephenlacy/bump-regex#17 I noticed that providing the dot-separated identifiers as the preid did not update the version correctly.

My understanding is if a preid of alpha.beta is passed to semver.inc with type prerelease it should update the prerelease version. Currently if I do not pass a preid it bumps correctly.

I created a repo to demonstrate: https://github.com/stevelacy/semver-test-1/blob/master/index.js

The current output is:

3.0.0-alpha.beta.0
3.0.0-alpha.beta.5.5

With a preid provided it resets the prerelease version to 0 regardless of what version is provided. I am assuming that this is not quite the desired effect.

Cheers.

@isaacs
Copy link
Contributor

isaacs commented Dec 14, 2017

Yeah, this smells like a bug to me:

const semver = require('semver')

const out0 = semver.inc('3.0.0-alpha.beta.5.4', 'prerelease', 'alpha.beta')
console.log(['3.0.0-alpha.beta.5.4', 'prerelease', 'alpha.beta', out0])

const out1 = semver.inc('3.0.0-alpha.beta.5.4', 'prerelease')
console.log(['3.0.0-alpha.beta.5.4', 'prerelease', out1])

const out2 = semver.inc('3.0.0-alpha.beta.5.4', 'prerelease', 'alpha.beta.5')
console.log(['3.0.0-alpha.beta.5.4', 'prerelease', 'alpha.beta.5', out2])

/*
[ '3.0.0-alpha.beta.5.4',
  'prerelease',
  'alpha.beta',
  '3.0.0-alpha.beta.0' ]
[ '3.0.0-alpha.beta.5.4',
  'prerelease',
  '3.0.0-alpha.beta.5.5' ]
[ '3.0.0-alpha.beta.5.4',
  'prerelease',
  'alpha.beta.5',
  '3.0.0-alpha.beta.5.0' ]
*/

@lukekarrys lukekarrys added the Bug thing that needs fixing label Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing
Projects
None yet
Development

No branches or pull requests

3 participants