Bump updates the project's version, updates/creates the changelog, makes the bump commit, tags the bump commit and makes the release to GitHub. Opinionated but configurable.
Bump updates the project's version, updates/creates the changelog, makes the bump commit, tags the bump commit and makes the release to GitHub. Opinionated but configurable.
This tool requires a top-level package.json
file to work, and assumes you are using git
.
Bump is here to save you time. These are all its commands, which you can also call manually individually:
minor
) or manually (e.g. v1.2.3
).Some other notable features:
npm install -g @fabiospampinato/bump
Just run bump
from inside your project. If you want to run only a specific command run bump <command>
(i.e. bump changelog
). If you want to learn more about the supported commands or options check out bump --help
and bump <command> --help
.
Bump comes with the following default settings:
{
"force": false, // If "true" it will not ask the user for confirmation
"version": {
"enabled": true // Bump the version number
},
"changelog": {
"enabled": true, // Enable changelog auto-updates
"create": false, // Create the changelog file if it doesn't exist
"review": true, // Open the changelog file after bumping, and wait for it to be reviewed
"path": "CHANGELOG.md", // Path to the changelog file
"version": "### Version [version]", // Template for the version line
"commit": "- [message]", // Template for the commit line
},
"commit": {
"enabled": true, // Commit the changes automatically
"message": "Bumped version to [version]" // Template for the commit message
},
"tag": {
"enabled": true, // Tag the bump commit
"name": "v[version]" // Template for the name of the tag
},
"release": {
"enabled": false, // Release to any enabled release providers
"github": {
"enabled": false, // Make a GitHub release
"open": true, // Open the release/draft page
"draft": true, // Mark it as a draft
"prerelease": false, // Mark it as a prerelease
"files": [], // Globs of files to attach to the release
"filesNr": -1, // Number of files expected to match the globs, for validation purposes
"title": "v[version]", // Template for the release title
"token": "", // GitHub personal access token with `public_repo` priviledge
"owner": "", // GitHub repository owner
"repo": "" // GitHub repository name
}
},
"scripts": {
"enabled": true, // Enable pre/post scripts
"prebump": "", // Script to execute before bumping the version
"postbump": "", // Script to execute after bumping the version
"prechangelog": "", // Script to execute before updating the changelog
"postchangelog": "", // Script to execute after updating the changelog
"precommit": "", // Script to execute before committing
"postcommit": "", // Script to execute after committing
"pretag": "", // Script to execute before tagging
"posttag": "", // Script to execute after tagging
"prerelease": "", // Script to execute before releasing
"postrelease": "" // Script to execute after releasing
}
}
You can override them in multiple ways:
~/.bump.json
to override the default ones. You should put auth tokens there.bump.json
, these settings also override computer-level settings.--config
CLI option, these settings have even higher priority.--preversion "do something"
, these have the highest proprity.BUMP_GITHUB_TOKEN
, if you'd like to provide your token that way.Check out cash's bump.json as an example.
When running bump
without explicitly providing a command all the enabled ones are executed.
If for instance you don't want to tag your bump commits you can disable the related command by setting tag.enabled = false
.
All commands except release
are enabled by default, I recommed you to check if everything is correct, review the changelog manually as some commits shouldn't be put into the changelog, and then make the release manually with bump release
.
Bump uses templates for generating the strings it needs. Inside those templates you can put tokens, which will be replaced with some value.
A token has the following syntax: [token]
, and it will be replaced with some value.
The following tokens are available for commits messages, tag names, and changelog headers:
Token | Value |
---|---|
[version] |
Version's number |
[version_date] |
Version's date |
The following tokens are available for changelog commits:
Token | Value |
---|---|
[message] |
Commit's message |
[date] |
Commit's date |
[hash] |
Commit's hash |
[hash4] |
Commit's hash cropped to first 4 characters |
[hash7] |
Commit's hash cropped to first 7 characters |
[hash8] |
Commit's hash cropped to first 8 characters |
[author_name] |
Author's name |
[author_email] |
Author's email |
bump changelog
to generate it.preversion
script could be used for running tests, a postversion
script could be used for compiling your project for production, a postcommit
script could be used for pushing the commit to origin.MIT © Fabio Spampinato