Lerna is overall quite a powerfull tool for managing monorepoes in JavaScript with a lot of nice features.
However one thing that I really struggle to find recently - is an ability to gain more controll on the changes lerna applies, specifically when running lerna version command.
lerna version generates CHANGELOG.md changes based on commits, bumps up packages versions and creates a new commit (or with certain flags updates the current commit).
I would like to find a way to prevent changes from being commited to customize my CHANGELOG.md based on what lerna has generated - Is there a way to do so?
I'm using [email protected]
Lerna is using external dependencies to do the conventional changelog stuff, for example the bump is created by the
conventional-changelog-recommend-bumpdependency and the changelog, you could guess, is produced by using theconventional-changelogdependency.You can customize how the changelog is created by defining a
changelogPresetwith theconventionalcommitsname and passing and defining atypesobject in Lerna and in that object you can provide an array oftyperules to follow which follows the spec defined inconventional-changelog-config-specFor example you can see below a config with emojis and different conventional titles
Note that the example shown below was copied from this public repo, which is not mine, and they use Lerna-Lite which uses the same config as Lerna, you can also take a look at their changelog.md to see what it produces
You can see some of that have been tagged as
hiddenwhich mean that they won't show up in the changelog.Also note that in
lerna.json, you could also add aignoreChangesarray of files to ignore so that it doesn't bump for irrelevant files like spec files or fixtures, for example in Lerna-Lite we use this config