Automatic Changelog Generation for Your JavaScript Project or Library
I always wondered how I can save myself and others' time and efforts by generating an elegant changelog file. Curious? Keep reading.
Having a changelog document informs teams and users about what changed and especially if there are any breaking changes that one needs to pay attention to when updating dependencies.
I made some research and found a few libraries that can be used to achieve my goal. I chose to go for generate-changelog for this because it’s quite easy to configure and use.
The general idea is that you will have to use specific keywords in your git
commits that will then be parsed, appended to the CHANGELOG.md
file and committed prior to upgrading the version (a script will automate this).
So, let’s put that in place. I’m using yarn
for this tutorial but you could also use npm
instead.
1. Install generate-changelog
Install this utility as a dev dependency by running this command:
$ yarn add -D generate-changelog
2. Configure the scripts
Add the following recommended scripts to the scripts
object in your package.json
file:
{
"scripts": {…