https://github.com/customcommander/lerna-prerelease-conventional-commits
Can Lerna bump prerelease version according to the Conventional Commits specification?
https://github.com/customcommander/lerna-prerelease-conventional-commits
conventional-commits lerna monorepo
Last synced: 8 months ago
JSON representation
Can Lerna bump prerelease version according to the Conventional Commits specification?
- Host: GitHub
- URL: https://github.com/customcommander/lerna-prerelease-conventional-commits
- Owner: customcommander
- Created: 2020-04-10T15:51:24.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-13T10:21:36.000Z (about 6 years ago)
- Last Synced: 2025-04-09T17:47:43.982Z (about 1 year ago)
- Topics: conventional-commits, lerna, monorepo
- Language: Shell
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Summary
In this repository I will show that Lerna 3.20.2 does not bump prerelease packages
according to the ["Conventional Commits" specification][cc-spec].
Whether this is a bug or by design is unknown at this stage. However the thread in this [issue][gh-issue] seems to suggest that it is a bug.
Follow-ups:
- See my [question on Stack Overflow][so-question].
- See the [issue][gh-my-issue] I raised.
## Minimal Reproducible Example
### TL; DR
```
git clone https://github.com/customcommander/lerna-prerelease-conventional-commits.git
cd lerna-prerelease-conventional-commits
./run.sh
```
---
I have setup two separate repositories in a Docker container.
Both are Lerna-managed monorepos with three sub-packages. However the packages in the second repositories are in a prerelease state:
```
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 will then make the following commits in both repositories:
1. A breaking change in the `major` package
2. A new feature in the `minor` package
3. A bug fix in the `patch` package
I then run the following command in both repositories:
```
npx lerna publish --conventional-commits --yes 2>/dev/null
```
### Observations
Lerna does bump the non-prerelease versions correctly:
```
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 the prerelease versions see a patch update only:
```
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)
```
[cc-spec]: https://www.conventionalcommits.org/
[gh-issue]: https://github.com/lerna/lerna/issues/1433
[so-question]: https://stackoverflow.com/q/61144530/1244884
[gh-my-issue]: https://github.com/lerna/lerna/issues/2536