manual-git-changelog
v1.0.2
Published
A simple tool for appending to a changelog based on git commits and tags.
Downloads
9,938
Maintainers
Readme
Manual Git Changelog
A simple tool for appending to a changelog based on git commits and tags.
This is an alternative to tools such as conventional-changelog
for projects that don't follow a specific commit convention,
but wanting to automate your CHANGELOG.md
generation upon each release.
This tool does this by automating the creation of CHANGELOG.md
as much as possible,
but allowing you to manually polish the file before committing.
This tool assumes that you use semantic versioned git tags (like v1.2.3
and v2.0.1
).
Some examples of changelogs that were generated with this tool:
- https://github.com/comunica/comunica/blob/master/CHANGELOG.md
- https://github.com/rubensworks/rdf-terms.js/blob/master/CHANGELOG.md
Installation
It is advised to install this tool as a dev dependency:
$ yarn add --dev manual-git-changelog
Usage
After installing, the manual-git-changelog
script will become available.
It can be used to do three things:
- Initialize a new
CHANGELOG.md
file - Add the changelog for an update while
npm version
is running. - Manually add the changelog for a particular version to
CHANGELOG.md
.
These usages will be explained hereafter.
Initialize
By running manual-git-changelog init
,
you can create a new CHANGELOG.md
file
based on your current version and git commits.
This command will fail when CHANGELOG.md
already exists.
Automatic version appending
If you like more automation in your release process,
then you can hook this tool into npm version
.
You can do this by adding the following script to your
package.json
file:
{
"scripts": {
"version": "manual-git-changelog onversion"
}
}
This will make it so that each time you call npm version
,
the changelog will automatically be updated to the new version.
Note that this will temporarily pause the process to allow you to manually polish the changelog file, to allow you to categorize the commits. This pausing happens when the following is printed to the console
Manually edit CHANGELOG.md, press any key to finalize...
Once you have edited CHANGELOG.md
, and are satisfied with its structure,
go back to your console, press any key to continue.
The tool will automatically stage CHANGELOG.md
so that it becomes
part of the version bump commit as done by npm version
.
Manual version appending
As an alternative to automatic changelog updates during npm version
,
you can manually trigger a version log to be added to be added to your changelog.
You can call the command, with a certain version to set as new version (ex: v1.2.3
) as follows:
$ manual-git-changelog v1.2.3
The previous available version (for example v1.2.2
) will be automatically
detected from the git tags.
As such, this script assumes that v1.2.3
has not been tagged yet.
If this version would already be tagged, then this script also allows you to define a custom version range that does not try to infer the previous version from the git tags:
$ manual-git-changelog v1.2.2 v1.2.3
License
This software is written by Ruben Taelman.
This code is released under the MIT license.