Automating changelogs in your NodeJS project

Translated from my article in Brazilian Portuguese version.

Thanks my friend Guilherme Virtuoso for helping to translate the article.

Repository with a starter kit including all configurations made reading this article: https://github.com/tiagoboeing/auto-changelog-starter-kit

Guess what will be the output?

Changelog sample — auth application — unreleased version — ClickUp integration.

Let’s get started!

npm install auto-changelog --save-dev# oryarn add auto-changelog --dev
npm install -g auto-changelog
scripts: {
"changelog": "auto-changelog --template changelog-template.hbs -p -u --commit-limit false",
"changelog-debug": "auto-changelog --template changelog-template.hbs -p --template json --output changelog-data.json"
}
...
auto-changelog --template changelog-template.hbs -p -u --commit-limit false

The default changelog file name is “CHANGELOG.md”

"auto-changelog": {
"commitLimit": false,
"unreleased": true,
"issueUrl": "https://app.clickup.com/t/{id}",
"replaceText": {
"[Ff]eature:": "",
"[Ff]ix:": "",
"[Bb]reak:": "",
"^ #(.{6})\\s": "[$1](https://app.clickup.com/t/$1) - "
},
"includeBranch": [
"develop",
"master"
]
}

You can use the properties commitLimit and unreleased as a fallback even overwritten by the command line. It’s optional.

"auto-changelog": {
"commitLimit": false,
"unreleased": true,
"issueUrl": "http://jira.user.com.br/browse/{id}",
"replaceText": {
"[Ff]eature:": "",
"[Ff]ix:": "",
"[Bb]reak:": "",
"([A-Z]+-\\d+)": "[$1](http://jira.user.com.br/browse/$1) - "
},
"includeBranch": [
"develop",
"master"
]
}

How to use?

feature: #1b1d0g Adiciona nova dependência
feature: Adiciona nova dependência
npm run changelog# oryarn changelog

The final output will be a file called CHANGELOG.md. Be careful here, if you already have a file with that name the file will be overwritten.

It’s a good idea implement this step in your CI pipeline ;-)

--

--

🇧🇷 Software engineering specialist | AWS Community Builder | ⌨ Works at Via Varejo | @tiagoboeing

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Tiago Boeing

🇧🇷 Software engineering specialist | AWS Community Builder | ⌨ Works at Via Varejo | @tiagoboeing