Can Lerna bump prerelease version according to the Conventional Commits specification?
See original GitHub issueHi,
Sorry for cross-posting (here and on Stack Overflow) but I just want to understand whether this is a bug or by design.
I have two Lerna-managed monorepos (both in independent mode), with three sub-packages each. One repo is in a “production” state (i.e. 1.0.0
) the other is in a “prerelease” state (i.e. 1.0.0-alpha.0
):
dev (or dev-prerelease)
|-- packages
| |-- major
| | |-- package.json (1.0.0 or 1.0.0-alpha.0)
| |-- minor
| | |-- package.json (1.0.0 or 1.0.0-alpha.0)
| |-- patch
| | |-- package.json (1.0.0 or 1.0.0-alpha.0)
|-- package.json
|-- lerna.json
I then make the following commits in both repositories: (commits follow the Conventional Commits specification)
- A breaking change in the major package
- A new feature in the minor package
- A bug fix in the patch package
And run this command in both repositories:
npx lerna publish --conventional-commits --yes 2>/dev/null
Expected Behavior
In the “production” repo, I can see the following versions
Changes:
- major: 1.0.0 => 2.0.0 (private)
- minor: 1.0.0 => 1.1.0 (private)
- patch: 1.0.0 => 1.0.1 (private)
In the “prerelease” repo, I can see the following versions
Changes:
- major: 1.0.0-alpha.0 => 2.0.0-alpha.0 (private)
- minor: 1.0.0-alpha.0 => 1.1.0-alpha.0 (private)
- patch: 1.0.0-alpha.0 => 1.0.1-alpha.0 (private)
Current Behavior
The “production” repo is updated as expected, however in the “prerelease” repo versions are updated as follow:
Changes:
- major: 1.0.0-alpha.0 => 1.0.0-alpha.1 (private)
- minor: 1.0.0-alpha.0 => 1.0.0-alpha.1 (private)
- patch: 1.0.0-alpha.0 => 1.0.0-alpha.1 (private)
Steps to Reproduce (for bugs)
I made a Minimal Reproducible Example. I have dockerized this; you literally just need to clone the repo and follow the instructions 😉
Your Environment
The Minimal Reproducible Example mentioned above runs in a Docker container:
- Alpine
- Node 12
Executable | Version |
---|---|
lerna --version |
3.20.2 |
npm --version |
6.10.0 |
yarn --version |
1.17.3 |
node --version |
12.7.0 |
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:5
Top GitHub Comments
It looks like a feature, I think you are supposed to use the
version
command to advance the MAJOR, MINOR and PATCH numbers before youprerelease
again.you have to go through the lerna versioning commands
now you will see that all the changes made it in your
I found the same issue with one of my monorepo using Lerna
4.0.0
. Usingonly bump patch. When I tried in newly create repository, using the same command it bumps correctly as per convention. Strange. Did you find the solution ?