Generating a changelog with conventional-changelog-writer?

48 Views Asked by At

I'm trying to use conventional-changelog-cli to generate a changelog.

These are some the example outputs provided in the packages README.md.

And they line up with what I'm trying to get it to do, which is group the commits by the version number.

So for example if under version 1.0.0 there are three commits, then they will render under that version and then if we bump the version to 1.0.1 and make new commits and render the changelog, those commits will show up under that version.

So this is what I've tried.

npm install -g conventional-changelog-cli
mkdir cl && cd cl && npm init -y && git init
git add . && git commit -m "fix: add project scaffolding"
conventional-changelog -p angular -i CHANGELOG.md -s

After this is done the changelog looks like this:

# 1.0.0 (2024-03-15)


### Bug Fixes

* project scaffolding f2da8ba

Next I bump to 1.0.1 and we add a index.js file like this and rerun the changelog generation this.

touch index.js
git add . && git commit -m "feat: add index.js with hello world logging"

conventional-changelog -p angular -i CHANGELOG.md -s

And now the changelog looks like this:

## 1.0.1 (2024-03-15)


### Bug Fixes

* add project scaffolding 38bc9ba


### Features

* add index.js with hello world logging 289395a



# 1.0.0 (2024-03-15)


### Bug Fixes

* add project scaffolding 38bc9ba

And as can be seen this part is repeated under version 1.0.1:

### Bug Fixes

* add project scaffolding 38bc9ba

How do we run the cli so that it does not duplicate content under new versions?

0

There are 0 best solutions below