Generate a changelog from git metadata
Note You don't have to use the angular commit convention. For the best result of the tool to tokenize you commit and produce flexible output, it's recommended to use a commit convention.
$ npm install -g conventional-changelog-cli$ cd my-project$ conventional-changelog -p angular -i CHANGELOG.md -s
This will not overwrite any previous changelog. The above generates a changelog based on commits since the last semver tag that match the pattern of a "Feature", "Fix", "Performance Improvement" or "Breaking Changes".
If you first time use this tool and want to generate all previous changelog, you could do
$ conventional-changelog -p angular -i CHANGELOG.md -s -r 0
This will overwrite any previous changelog if exist.
All available command line parameters can be listed using CLI:
Hint: You can alias your command or add it to your package.json. EG:
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0".
To fully customize the tool, please checkout conventional-changelog and conventional-changelog-core docs. You can find more details there. Note:
config here can work with
preset, which is different than
options.config in conventional-changelog.
The reason why you should commit and tag after
conventionalChangelog is that the CHANGELOG should be included in the new release, hence
gitRawCommitsOpts.from defaults to the latest semver tag.
Using the npm scripts to our advantage with the following hooks:
You could follow the following workflow
npm version [path|minor|major]command
You could optionally add a
preversion script to package your project or running a full suit of test.
postversion script to clean your system and push your release and tags.
By adding a
.npmrc you could also automate your commit message and set your tag prefix as such:
tag-version-prefix="" message="chore(release): %s :tada:"
MIT © Steve Mao