CLI application to cleanse the lerna/commitizen-generated changelogs

§ Use it

Once installed, call it one of two ways:

$ lcc
$ lernacleanchangelog

PS. That dollar sign above just means it's a terminal. Never type that dollar sign!

§ Purpose

This application performs the following cleaning steps on all encountered changelog.md's:

  1. It removes bump-only changelog entries that conventional-changelog generates. For example:

    **Note:** Version bump only for package ranges-apply

    These will be deleted along with their headings.

  2. It removes diff links from headings. Change the following:

    ## [2.9.1](https://gitlab.com/codsen/codsen/tree/master/packages/ranges-apply/compare/[email protected]@2.9.1) (2018-12-27)


    ## 2.9.1 (2018-12-27)

    The diff links are not universal (across Sourcehut, GitLab, GitHub and BitBucket to name few) so it's more future-proof to remove them.

  3. Remove h1 headings and turn them into h2, with the exception of the first, main heading of the changelog.

    For exampe, change the following:

    # [2.0.0](https://gitlab.com/codsen/codsen/tree/master/packages/ranges-apply/compare/[email protected]@1.9.1) (2018-12-27)


    ## 2.0.0 (2018-12-27)

    (notice how a second # character is added, beside link being removed)

§ The proof of the pudding is in the eating

Here's how we use it ourselves.

In short, sourcehut CI calls package.json script and it cleanses the changelogs before npm package is published to npm and all builds are comitted from CI to git.

Have a look at our sourcehut CI yml opens in a new tab:

{ { ciConfig | safe } }

There's a line:

- npm run pub:vers

That's how CI calls npm script. By the way, "lerna-clean-changelogs-cli" can be called at all because our monorepo root package.json opens in a new tab has it as a dev-dependency:

"devDependencies": {
  "lerna-clean-changelogs-cli": "^1.3.1",

In the package.json, pub:vers looks like this:

"pub:vers": "lerna version --conventional-commits --no-commit-hooks --yes && lernacleanchangelog '**'",

We call lerna version and then we call lernacleanchangelog — the call name for lerna-clean-changelogs-cli. We could also call lcc instead but it's more descriptive, considering you come back after months and wonder what is such and such command...

§ Changelog

See it in the monorepo opens in a new tab, on Sourcehut.

§ Licence

MIT opens in a new tab

Copyright © 2010–2020 Roy Revelt and other contributors

Related packages:

📦 lerna-clean-changelogs 1.5.0
Removes frivolous entries from commitizen generated changelogs
📦 lerna-link-dep 1.2.0
Like lerna add but does just the symlinking, works on CLI bins too
📦 update-versions 3.0.3
Like npm-check-updates but supports Lerna monorepos and enforces strict semver values