CLI application to cleanse the lerna/commitizen-generated changelogs

§ Idea

This CLI removes the frivolous changelog file entries generated by commitizen opens in a new tab:


§ Use it

Once installed, call it one of two ways:


§ 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/ranges-apply@2.9.0...ranges-apply@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/ranges-apply@2.0.0...ranges-apply@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.4.6",

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 GitHub.

§ Contributing

To report bugs or request features or assistance, raise an issue on GitHub opens in a new tab.

Any code contributions welcome! All Pull Requests will be dealt promptly.

§ Licence

MIT opens in a new tab

Copyright © 2010–2021 Roy Revelt and other contributors

Related packages:

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