LogChanges
Opinionated changelog creation tool based on git commits and history.
Getting started
Installation
npm install logchanges@latest -g
Usage
logchanges
As part of the npm version
cycle to update changelog.
// package.json ... "scripts": ...
Versioning
If no version is set the version from the package.json
will be taken as latest, there is a way to overwrite it if needed.
logchanges --target 2.3.5
Configuration
There are two ways to configure
Inside the package.json
file as part of changelog
section.
Or by creating changelogrc.json
file inside the root folder.
// changelogrc.json
There is also a option to set a path to json configuration
logchanges --config ./config/changelogrc.json
Configure some of the description of the categories or the date format used into the Markdown.
// Default configuration // Unknown categories will be under the `other` scope/category default_type: 'other' // Default supported category types: breaking: 'Breaking Changes' build: 'Build System / Dependencies' ci: 'Continuous Integration' chore: 'Chores' docs: 'Documentation Changes' feat: 'New Features' fix: 'Bug Fixes' other: 'Other Changes' perf: 'Performance Improvements' refactor: 'Refactors' revert: 'Reverts' style: 'Code Style Changes' test: 'Tests' // Markdown date format used into the render dateFormat: 'mmmm d, yyyy' // Default output file when format is Markdown outputMarkdown: 'CHANGELOG.md' // Default output file when format is JSON outputJSON: 'changelog.json' // Default format format: 'markdown' // Specific range range: undefined // Exclude commits exclude: '' // Output location starting from root output: undefined // Repo URL repoUrl: '' // Exclude commit body drom output nobody: false // Allow unknown categories allowUnknown: false
Link to repos
If you add --repo-url
as param the generated output will include links to online version of the commits like Github, Bitbucket and Gitlab.
logchanges --repo-url http://my.custom.repo/commits
Will result in
- fix bug in code (af4s1as)
Default will be get from package.json
repo settings.
Formating
The default format is Markdown. But there are additional option like JSON.
logchanges --format json
Output
By default the output will be to CHANGELOG.md
or if format is selected to JSON to changelog.json
. To change this you could use the --output
flag.
logchanges --output PROJECT_CHANGELOG.md
In case that there is need to not write to disk and pipe the output to another command you could use -
logchanges -
Help
For more information check --help
$ logchanges --help Usage: logchanges [options] Generate a changelog from git commits. Options: -V, --version output the version number -t, --target <version> specify version -c, --config <path> path to changelogrc.json -r, --range <range> generate from specific tag or range -x, --exclude <types> exclude selected commit types -o, --output [file] file to write to, defaults to ./CHANGELOG.md, use -
Extending Foramter
Changelogoptions,
Generate historical data
Use --range
to set start and end of the history and --target
to set version number
logchanges --range a811712..HEAD --target 2.0.5
This could be automated by going over the tags and creating ranges to be scrapped.
#!/bin/bash tags=;
This will result in similar to this
logchanges --range v1.0.1...v1.0.2 --target v1.0.2 --nobody --allow-unknownlogchanges --range v1.0.2...v1.0.3 --target v1.0.3 --nobody --allow-unknown...
Roadmap
See the open issues for a list of proposed features (and known issues).
Contributing
- Fork it (https://github.com/bdryanovski/logchanges/fork)
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request
License
This project is licensed under the MIT License - see the LICENSE.md file for details