conventional-changelog / standard-version

:trophy: Automate versioning and CHANGELOG generation, with semver.org and conventionalcommits.org
ISC License
7.68k stars 793 forks source link

release-as pach in combination with prerelease doesn't work #466

Open mancioshell opened 5 years ago

mancioshell commented 5 years ago

I have a package.json with 2.1.3-SNAPSHOT.0 version.

If i try to launch this command

HUSKY_SKIP_HOOKS=1 npx standard-version --no-verify --release-as patch --prerelease SNAPSHOT

the result is:

✔ bumping version in package.json from 2.1.3-SNAPSHOT.0 to 2.1.3-SNAPSHOT.1
✔ bumping version in package-lock.json from 2.1.3-SNAPSHOT.0 to 2.1.3-SNAPSHOT.1

But i have expected this result:

✔ bumping version in package.json from 2.1.3-SNAPSHOT.0 to 2.1.4-SNAPSHOT.0
✔ bumping version in package-lock.json from 2.1.3-SNAPSHOT.0 to 2.1.4-SNAPSHOT.0

Instead if i launch :

HUSKY_SKIP_HOOKS=1 npx standard-version --no-verify --release-as minor --prerelease SNAPSHOT

i receive this output as i have expected

✔ bumping version in package.json from 2.1.3-SNAPSHOT.0 to 2.2.0-SNAPSHOT.0
✔ bumping version in package-lock.json from 2.1.3-SNAPSHOT.0 to 2.2.0-SNAPSHOT.0
mancioshell commented 5 years ago

Are anyone interested on this issue?

vosaba commented 5 years ago

I guess it probably the same issue as https://github.com/conventional-changelog/standard-version/issues/467

mancioshell commented 5 years ago

I guess it probably related to #467

The "problem" (but i think it's a feature of standar version) is the check inside the functionshouldContinuePrerelease in bumb.js lifecycle.

As the documentation says:

if a version is currently in pre-release state, and if it current in-pre-release type is same as expect type,it should continue the pre-release with the same type

So standard version look for the first !==0 in TypeList: const TypeList = ['major', 'minor', 'patch'].reverse()

and doesn't increment the version in correspondence of founded TypeList.

It's ok, but it should be great if i could skip this check with a particular option in the cli.