• Stars
    star
    393
  • Rank 109,518 (Top 3 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

Usage

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.

Features

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

  • version: It can update your project's version, including in arbitrary files (i.e. maybe you need to write the version in the readme).
  • changelog: It can update the changelog with the latest changes. If you don't have a changelog already it can generate one for you which includes logs about all previous versions too.
  • commit: It can make the bump commit.
  • tag: It can tag the bump commit.
  • release: It can make a release to GitHub, including using the relevant section of the changelog as its description and uploading files.

Some other notable features:

  • Configurable: Every string and what commands get executed by default can be configured via the settings.
  • Scripts: Custom scripts can be run before/after any command.

It currently only supports Git, and it better supports JS projects. PRs for improving support of other stacks are very welcome.

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.

Help

Settings

Bump comes with the following default settings:

{
  "force": false, // Force the command without prompting the user
  "silent": false, // Minimize the amount of logs
  "files": {}, // A map of `relativeFilePath: [regex, replacement, regexFlags?] | [regex, replacement, regexFlags?][]`
  "version": {
    "enabled": true, // Bump the version number
    "initial": "0.0.0", // Initial version
    "increments": ["major", "minor", "patch", "premajor", "preminor", "prepatch", "prerelease", "custom"] // List of available increments to pick from
  },
  "changelog": {
    "ask": true, // Whether to ask to create a changelog or not
    "enabled": true, // Enable changelog auto-updates
    "create": false, // Create the changelog file if it doesn"t exist
    "open": true, // Open the changelog file after bumping
    "file": "CHANGELOG.md", // Name of the changelog file
    "version": "### Version [version]", // Template for the version line
    "commit": "- [message]", // Template for the commit line
    "separator": "\n" // Template for the separator between versions sections
  },
  "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, if provided bump will watch the file system until it has found the expected number of files. It's recommended to set this value
      "token": "", // GitHub OAuth token with `public_repo` priviledge
      "owner": "", // GitHub repository owner
      "repo": "" // GitHub repository name
    }
  },
  "tokens": {
    "date": {
      "format": "YYYY-MM-DD" // Moment.js format to use when generating the `[date]` token
    },
    "version_date": {
      "format": "YYYY-MM-DD" // Moment.js format to use when generating the `[version_date]` token
    }
  },
  "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:

  • Computer-level settings: Place your computer-level settings inside ~/.bump.json to override the default ones. You should put auth tokens here.
  • Project-level settings: Place your project-level settings at the root of your project in a file named bump.json, these settings also override computer-level settings.
  • Dynamic settings: You can pass an arbitrary settings object via the --config CLI option, these settings have the highest priority. Some other specific CLI options are supported too (i.e. --silent).
  • Environment variables: the following environment variables are supported too: GITHUB_TOKEN.

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.

If you want to review the changes manually, and you want to publish the release to GitHub, I recommend disabling the tag command, as it's already handled by GitHub and amending the bump commit would become a bit more annoying.

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.

Here's a list of all the available tokens, notice that not all of them are available for every template, for instance you can only use the [hash] token for the changelog's commit template:

Token Value
[version] Version's number
[version_date] Version's date
[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

Updating arbitrary files

If you want to update the version in arbitrary files you'll have to populate the files setting.

For example this is what the setting may look like if you want to bump the VERSION key of an object inside the file custom/file.js:

{
  "files": {
    "custom/file.js": ["'VERSION':\\s*'([^']*)'", "'VERSION': '[version]'", "i"]
  }
}

Basically each key defined in the files setting is a path relative to the root of your project, the first item in the array is what will become a regex that will match the string to replace (it's important to wrap the actual version string in a capturing block), the second item in the array is the string that will replace the matched one (notice that the [version] token will be substituted with the actual version) and the optional third item is the regex flags to use (the default is gmi).

If you need to bump more than one version in a single file, using different regexes, just provide an array of arrays instead of a single array.

Hints

  • Commits messages: Spend some extra seconds to write descriptive commits messages, with no extra effort you'll be improving your changelogs as well. If you're already doing this, just enjoy the extra free time!
  • Changelogs: Changelogs are cool, if your existing project doesn't have one simply run bump changelog to generate it.
  • Parallelize releases: By setting release.github.filesNr bump will watch the file system until it has found the expected number of files, allowing you to run both bump release and the script that will generate those files in parallel, speeding up the process.
  • Review: Setting commit.enabled = false and changelog.open = true allows you to review your changelog before committing it. Alternatively you can also auto-commit it, review it later, and in case amend the previous commit.
  • Scripts: Scripts can be used for building/testing/deployments/etc. For example: a prebump script could be used for running tests, a postbump script could be used for compiling your project for production, a postcommit script could be used for pushing the commit to origin.

Related

  • vscode-bump: Extension for Visual Studio Code for interacting with Bump directly from your editor.

License

MIT © Fabio Spampinato

More Repositories

1

cash

An absurdly small jQuery alternative for modern browsers.
JavaScript
6,506
star
2

cliflix

Watch anything instantaneously, just write its name.
TypeScript
1,492
star
3

vscode-todo-plus

Manage todo lists with ease. Powerful, easy to use and customizable.
TypeScript
843
star
4

autogit

Define commands, using plugins, to execute across all your repositories.
TypeScript
471
star
5

phoenix

My Phoenix setup. Powerful, easy to customize, tuned for web development, adds a space switcher.
JavaScript
397
star
6

noty

Autosaving sticky note with support for multiple notes without needing multiple windows.
TypeScript
337
star
7

store

A beautifully-simple framework-agnostic modern state management library.
TypeScript
227
star
8

tiny-bin

A library for building tiny and beautiful command line apps.
TypeScript
175
star
9

atomically

Write files atomically and reliably.
JavaScript
146
star
10

template

A super-simple way to create new projects based on templates.
TypeScript
131
star
11

flimsy

A single-file <1kb min+gzip simplified implementation of the reactive core of Solid, optimized for clean code.
TypeScript
130
star
12

vscode-highlight

Advanced text highlighter based on regexes. Useful for todos, annotations etc.
TypeScript
126
star
13

vscode-terminals

An extension for setting-up multiple terminals at once, or just running some commands.
TypeScript
110
star
14

shosho

A modern and powerful shortcuts management library.
TypeScript
87
star
15

picorpc

A tiny RPC library and spec, inspired by JSON-RPC 2.0 and tRPC.
TypeScript
84
star
16

overstated

React state management library that's delightful to use, without sacrificing performance or scalability.
TypeScript
82
star
17

vscode-monokai-night

A complete, dark and minimalistic Monokai-inspired theme.
HTML
74
star
18

vscode-open-in-github

Open the current project or file in github.com.
TypeScript
72
star
19

enex-dump

Dump the content of .enex files, preserving attachements, some metadata and optionally converting notes to Markdown.
JavaScript
71
star
20

shortcuts

Super performant and feature rich shortcuts management library.
TypeScript
66
star
21

watcher

The file system watcher that strives for perfection, with no native dependencies and optional rename detection support.
JavaScript
65
star
22

vscode-projects-plus

An extension for managing projects. Feature rich, customizable, automatically finds your projects.
TypeScript
64
star
23

svelto

Modular front end framework for modern browsers, with battery included: 100+ widgets and tools.
JavaScript
60
star
24

icon-font-buildr

Build custom icon fonts, it supports remote and local icons sources.
TypeScript
51
star
25

pastebin-monitor

A simple Pastebin monitor which looks for interesting things and saves them to disk.
Python
50
star
26

vscode-commands

Trigger arbitrary commands from the statusbar. Supports passing arguments!
TypeScript
50
star
27

monorepo

The homepage for all my repositories.
49
star
28

rssa

RSS-Anything, get updates about anything you can reach with an url. Like RSS, but for anything.
TypeScript
49
star
29

proxy-watcher

A library that recursively watches an object for mutations via Proxies and tells you which paths changed.
JavaScript
46
star
30

banal

On-demand bundle analyzer, powered by esbuild.
HTML
42
star
31

template-vscode-extension

A template for starting a new vscode extension quickly.
TypeScript
37
star
32

khroma

A collection of functions for manipulating CSS colors, inspired by SASS.
JavaScript
36
star
33

lande

A tiny neural network for natural language detection.
TypeScript
33
star
34

vscode-projects-plus-todo-plus

Bird's-eye view over your projects, view all your todo files aggregated into one.
TypeScript
27
star
35

awesome-autogit

Curated list of resources for autogit.
27
star
36

vscode-diff

Diff 2 opened files with ease. Because running `code --diff path1 path2` is too slow.
TypeScript
26
star
37

termux-env

My super-quick-to-setup Termux environment.
Lua
26
star
38

zeptomatch

An absurdly small glob matcher that packs a punch.
JavaScript
24
star
39

worktank

A simple isomorphic library for executing functions inside WebWorkers or Node Threads pools.
TypeScript
23
star
40

alfred-spaces-workflow

Alfred workflow that, used in conjunction with my Phoenix setup, gives you a spaces switcher.
23
star
41

vscode-markdown-todo

Manage todo lists inside markdown files with ease.
TypeScript
22
star
42

noren

A minimal HTTP server with good developer-experience and performance, for Node and beyond.
TypeScript
21
star
43

pollex

A tiny polling-based filesystem watcher that tries to be efficient.
TypeScript
21
star
44

vscode-debug-launcher

Start debugging, without having to define any tasks or launch configurations, even from the terminal.
TypeScript
20
star
45

gitman

A simple yet powerful opinionated tool for managing GitHub repositories.
TypeScript
19
star
46

tiny-sqlite3

A tiny cross-platform client for SQLite3, with precompiled binaries as the only third-party dependencies.
JavaScript
19
star
47

vscode-statusbar-debugger

Adds a debugger to the statusbar, less intrusive than the default floating one.
TypeScript
19
star
48

pacco

A bundler for modular and extensible web projects.
JavaScript
18
star
49

vscode-github-notifications-bell

A secure, customizable, statusbar bell that notifies you about notifications on github.
TypeScript
18
star
50

vscode-bump

Bump your project's version and update the changelog. Opinionated but configurable.
TypeScript
16
star
51

vscode-open-in-application

Open an arbitrary file in its default app, or the app you want.
TypeScript
15
star
52

monex

Execute a script and restart it whenever it crashes or a watched file changes.
TypeScript
15
star
53

tiny-encryptor

A tiny opinionated isomorphic library for encrypting and decrypting with ease.
JavaScript
14
star
54

awesome-template

Curated list of templates for Template.
14
star
55

jsonc-simple-parser

A simple JSON parser that supports comments and optional trailing commas.
JavaScript
14
star
56

secret

The simplest command to encrypt/decrypt a file, useful for committing encrypted ".env" files to version control, among other things.
TypeScript
14
star
57

specialist

A library that helps you write tiny, fast, bundled and beautiful CLI apps that can automatically check for updates.
JavaScript
13
star
58

zstandard-wasm

A fast and small port of Zstandard to WASM. (Decompress-only for now).
C
13
star
59

dettle

A tiny fully-featured debounce and throttle implementation.
TypeScript
13
star
60

is

The definitive collection of is* functions for runtime type checking. Lodash-compatible, tree-shakable, with types.
JavaScript
12
star
61

base256-encoding

Base256 encoding, the most memory-efficient encoding possible in JavaScript.
JavaScript
12
star
62

zeptoid

A tiny isomorphic fast function for generating a cryptographically random hex string.
TypeScript
11
star
63

vscode-browser-refresh

Refresh the browser with a ⌘R, right from Code. No need to switch focus to it.
TypeScript
10
star
64

tiny-levenshtein

A tiny implementation of the Levenshtein edit distance algorithm.
TypeScript
10
star
65

json-sorted-stringify

Alternative JSON.stringify function with sorted keys, so the output is stable.
JavaScript
10
star
66

huffy

A tiny compression library based on Huffman coding.
TypeScript
10
star
67

amuchina

A work-in-progress HTML sanitizer that strives for: performance like window.Sanitizer, readiness like DOMPurify, and ability to run in a WebWorker like neither of those.
TypeScript
10
star
68

scex

A simple runner for npm scripts that can execute multiple scripts, in serial or in parallel.
TypeScript
10
star
69

toygrad

A toy library for building simple neural networks which can be serialized to compact JSON.
TypeScript
10
star
70

vscode-optimize-images

Optimize one or all the images in your project using your favorite app.
TypeScript
9
star
71

crypto-puzzle

Basically a proof-of-work generator, this library makes cryptographic puzzles that are arbitrarily expensive to solve.
TypeScript
9
star
72

vscode-open-in-terminal

Adds a few commands for opening the current project in Terminal.
TypeScript
9
star
73

strid

Get a unique string identifier for any input value.
JavaScript
9
star
74

paketo

A tiny library for importing your package.json, with proper types!
TypeScript
9
star
75

grammex

A tiny PEG-like system for building language grammars with regexes.
JavaScript
9
star
76

tiny-parse-argv

A tiny function for parsing process.argv, a modern rewrite of a sensible subset of minimist.
JavaScript
9
star
77

tsex

A little CLI for making TypeScript packages, cleanly and effortlessly.
TypeScript
9
star
78

css-simple-minifier

A CSS minifier that's tiny and very fast.
JavaScript
8
star
79

vscode-open-multiple-files

Open all files in a folder at once, optionally filtering by a glob.
TypeScript
8
star
80

path-prop

Fast library for manipulating plain objects using paths.
JavaScript
8
star
81

react-router-static

A dead simple static router for React. Useful for multi-window Electron applications.
TypeScript
8
star
82

base128-encoding

Base128 encoding, the intersection of latin1 and utf-8, which is basically ASCII, the most memory-efficient string encoding that can be written to disk as utf-8 without ballooning in size.
TypeScript
8
star
83

noop-tag

A noop template literal tag, useful for syntax highlighting hints.
JavaScript
7
star
84

vscode-no-unsupported

An extension for removing [Unsupported] from the titlebar
TypeScript
7
star
85

tiny-webcrypto

A tiny isomorphic WebCrypto object, it just gives you the native one the current platform provides.
TypeScript
7
star
86

csv-simple-parser

A simple, fast and configurable CSV parser.
JavaScript
7
star
87

performance-interval

A precise implementation of setInterval that supports sub-millisecond intervals.
TypeScript
7
star
88

json-archive

Simple archive format based on JSON.
TypeScript
7
star
89

alfred-eject-workflow

Alfred workflow for ejecting mounted drives.
7
star
90

tiny-jsonc

An absurdly small JSONC parser.
JavaScript
7
star
91

chrome-window-session

Save each window as a separate session, automatically.
TypeScript
6
star
92

template-electron

A template for starting a new electron app quickly.
TypeScript
6
star
93

electron-about

Simple standalone about window for Electron.
TypeScript
6
star
94

bob-wasm

A port of Svgbob to WASM.
TypeScript
6
star
95

benchloop

Simple benchmarking library with a pretty output.
TypeScript
6
star
96

worktank-loader

WebPack plugin for WorkTank which enables you to execute whole files in a worker pool, transparently.
TypeScript
6
star
97

html-segmentator

A small library for splitting an HTML string into its top-level sections. Based on html5parser.
TypeScript
6
star
98

vscode-git-history

View or diff against previous versions of the current file.
TypeScript
6
star
99

uint8-concat

Concatenate mutiple Uint8Arrays super efficiently.
JavaScript
6
star
100

configuration

Performant and feature rich library for managing configurations/settings.
JavaScript
6
star