Reputation: 18941
It doesn't seem that Lerna 3.20.2
is able to bump prerelease versions (e.g. 1.0.0-alpha.0
) according to the Conventional Commits specification.
I made a Minimal Reproducible Example if you want to try this out.
Say we have two Lerna-managed repositories, both with three sub-packages. One repo has "production" packages the other has "prerelease" ones:
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)
And run this command in both repositories:
npx lerna publish --conventional-commits --yes 2>/dev/null
The "production" repo sees its packages updated according to the Conventional Commits spec:
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)
However in the prerelease repo, all packages are simply "patched":
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)
The thread in this GitHub issue seems to suggest that this is a bug (but I'm not sure).
Question I'd like the packages in my "prerelease" repo to be updated in the same way as in the "production" repo whilst retaining their prerelease suffix. What am I doing wrong here?
You can also follow up this GitHub issue that I raised
Upvotes: 5
Views: 9074
Reputation: 141
I used the following command:
lerna publish --conventional-commits --conventional-prerelease
The version bumps for these flags are explained in the below image:
Upvotes: 8
Reputation: 1111
Had the same issue:
you have to go through the lerna versioning commands
lerna version major
lerna version premajor
lerna version prerelease
now you will see that all the changes made it in your lerna.json
(this is where the actual version is kept, and the version
command is the only one changing the MAJOR, MINOR and PATCH numbers)
Upvotes: 2