Bump the version of your package.json based on your commit messages
- Bump the version of your package.json based on your commit messages
- Automatically ammend version update to the last commit
- Integrate with git hooks (coming soon)
Recommended to install as a dev dependency
npm install --save-dev fist-bump
# current version: 1.0.0
# prefixing a commit message with the supported keywords
git commit -m 'feature: added new feature'
# run fist bump to update the version of your package.json
npx fistbump
# the new version => 1.1.0
# the updated commit message => '[1.1.0] feature: added new feature'
good to know: fist-bump
will skip any commits that have '[skip]' and '[wip]' or an existing version tag in the commit message.
To customize this fist-bump
, all you have to do is add a fistbump
property to your package.json
file.
{
"fistbump": {
"patch": [ "fix", "patch" ], // `1.0.0` -> `1.0.1`
"minor": [ "feature", "config", "minor" ], // `1.0.0` -> `1.1.0`
"major": [ "breaking", "release", "major" ], // `1.0.0` -> `2.0.0`
"position": "start" // `(v1.1.0) feature: added new feature`
}
}
Note: the example above shows the configuration values
The patch
, minor
, major
properties represent the type of version bump that will be applied to your package.json (see semantic versioning for more details):
type | default keywords | version bump | description |
---|---|---|---|
patch |
fix , patch |
1.0.0 -> 1.0.1 |
bug fix, backwards compatible |
minor |
feature , config , minor |
1.0.0 -> 1.1.0 |
new feature, backwards compatible |
major |
breaking , release , major |
1.0.0 -> 2.0.0 |
breaking change, not backwards compatible |
The keywords are case sensitive and will be matched against the following pattern in your commit message: <keyword>:
or [<keyword>]
. For example, the following commit messages will be matched against the patch
keyword:
fix: fixed a bug
=> the keyword isfix
which belongs to thepatch
version typefeature|major: a whole new way to do stuff
=> the keyword isfeature
which belongs to theminor
version type even though it also matches themajor
keyword
Note: adding custom keywords to will completely override their default keywords, respectively. in other words, if you add a custom
patch
keyword, the defaultfix
andpatch
keywords will no longer be supported.
The position
property determins where the version tag will be placed in the commit message.
position | example commit message |
---|---|
start |
(v1.1.0) feature: added new feature |
end |
feature: added new feature (v1.1.0) |
Want to contribute?
- read the contributing doc
- open an issue or submit a pull request with your changes
To see what has changed between versions, check out the changelog.
If you discover a security vulnerability, feel free to open an issue at github.com/this-oliver/fist-bump/issues. All security vulnerabilities will be promptly addressed.