$ npm install conventional-changelog-cli
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 your 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 changelogs. The above generates a changelog based on commits since the last semver tag that matches the pattern of "Feature", "Fix", "Performance Improvement" or "Breaking Changes".
If this is your first time using this tool and you want to generate all previous changelogs, you could do
$ conventional-changelog -p angular -i CHANGELOG.md -s -r 0
This will overwrite any previous changelogs if they exist.
All available command line parameters can be listed using CLI: conventional-changelog --help
.
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.
package.json
conventionalChangelog
package.json
and CHANGELOG.md
filesThe 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.
npm version
Using the npm scripts to our advantage with the following hooks:
{
"scripts": {
"version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md"
}
}
You could follow the following workflow
npm version [patch|minor|major]
commandYou could optionally add a preversion
script to package your project or running a full suit of test.
And a 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:"
Please use conventional-changelog
MIT © Steve Mao
© 2010 - cnpmjs.org x YWFE | Home | YWFE