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)
- 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
Observations
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
lerna publish prerelease
bumped my version from0.3.3-alpha.0
->0.3.3-alpha.1
. Adding the--conventional-commits
flag made no difference to the behaviour. – Katelin