Home

Awesome

Bump

<p align="center"> <img src="resources/demo/usage.gif" width="1000" alt="Usage"> </p>

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.

Features

Bump is here to save you time. These are all its commands, which you can also call manually individually:

Some other notable features:

Install

npm install -g @fabiospampinato/bump

Usage

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.

<p align="center"> <img src="resources/demo/help.png" width="789" alt="Help"> </p>

Settings

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:

Check out cash's bump.json as an example.

Enabled commands

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.

Templates & Tokens

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:

TokenValue
[version]Version's number
[version_date]Version's date

The following tokens are available for changelog commits:

TokenValue
[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

Hints

License

MIT © Fabio Spampinato