How to automate versioning and keep up to date your changelog file by following conventional commits specification?


3 min read

Hi there,

First of all, it is my first story and hopefully, it will be helpful.

Every developer likes or should(must) like to create new features, refactor outdated codebase, or try to solve problems that look like to hard, etc.

But when it comes to writing commit messages and editing changelogs, they can do it sloppily at least I am one of them.

By little research, I found there is a specification to write commit messages. This story is not about how to write commit messages. You can find the specification details from here.

Let's suppose you followed conventional commit specifications and you write commit messages using it on your library/project. From now on you can use its advantages.

One of the advantages is that you can use automate versioning and changelog updates.

To achieve we are going to use a library called standard-version.

Let's install standard-version to our project as a dev-dependency.


npm i --save-dev standard-version


yarn add -D standard-version

Add an npm run script to your package.json

  "scripts": {
    "release": "standard-version"

Now, whenever you want to create a new version for your library you can use the npm run release command.

It will create a commit for you by changing the package.json and changelog file. Also, it will create a tag on your repository, and the only thing you have to do push the commit with tags created automatically for you. ๐ŸŽ‰

If you want to deep dive into standard-version and customize it you can visit its repository from here.

Thanks for reading.