The config file is optional. Without it, bump uses the defaults: lockstep mode, the packages of your workspace files, and v{version} tags.
Example
{
"$schema": "https://unpkg.com/bump/schema.json",
"independent": true,
"packages": ["packages/*", "crates/*", "!packages/internal-*"],
"groups": {
// these always release together
"web": ["@acme/ui", "@acme/app"],
},
"preid": "next",
"tag": "{name}@{version}",
"message": "release: {tags}",
}Config file
The file is bump.json or bump.jsonc. bump reads both names as JSONC, so both allow comments and trailing commas.
bump finds the file in this order:
- It starts in the
--cwddirectory, which is.by default. - It searches upward for
bump.jsonorbump.jsonc. It stops at the top level of the git repository. - The first directory with a config file is the root. Without a config file, the root is the top level of the git repository.
All paths in the config are relative to the root. bump runs the lockfile commands in the root too. See Lockfiles.
One directory can hold only one of the two files:
$ bump patch
FAIL Keep one of "/private/tmp/acme/bump.json" and "/private/tmp/acme/bump.jsonc"bump never writes the config file.
Keys
| Key | Type | Default | Description |
|---|---|---|---|
$schema |
string | The JSON schema, for editors. bump ignores it. | |
independent |
boolean | false |
Give each package, or each group, its own version and tag. |
packages |
string, or string[] | your workspace files | Directory globs of the packages. |
groups |
object of string[] | {} |
Packages that release together. Independent mode only. |
preid |
string | "next" |
The preid of a new prerelease line. |
tag |
string | "v{version}"; "{name}@{version}" in independent mode |
The tag name. |
message |
string | "v{version}"; "release: {tags}" in independent mode |
The subject of the release commit. |
Any other key is an error.
$schema
The URL of the JSON schema:
{
"$schema": "https://unpkg.com/bump/schema.json"
}Your editor uses it to check the keys and to show their docs. bump ignores the value, but it must be a string. The schema checks the types and the preid format. bump checks the template rules when it runs.
independent
Selects the mode. With false, all versioned packages are one unit, with one version and one tag. With true, each group is a unit, and each other versioned package is a unit of its own. See Lockstep and independent.
packages
Directory globs, relative to the root. A string is one glob.
{
"packages": ["packages/*", "crates/*", "!packages/internal-*"]
}- Each glob matches directories. bump does not search inside a matched directory, so
packages/*findspackages/core/package.json, but notpackages/core/fixtures/package.json. - A glob that starts with
!excludes. It removes each directory that it matches, and each directory inside one that it matches. .is the root directory.- bump skips
node_modulesdirectories, directories whose names start with., and each directory inside them. - In each directory, bump looks for a
package.jsonand aCargo.toml. One directory can hold one of each.
Without packages, each ecosystem uses its own workspace files:
- npm:
workspacesin the rootpackage.json, an array of globs or an object with apackagesarray, andpackagesin the rootpnpm-workspace.yaml. bump uses both when both exist. With neither, the root directory. - Cargo:
membersandexcludeof[workspace]in the rootCargo.toml. The root is a member too when the same file has a[package]. Each path dependency of a member inside the root is a member too, as in Cargo. Without[workspace], the root directory.
For which manifests count as packages, see Package rules.
groups
Group names, each with a list of package names. The packages of a group release together, with one version and one tag.
{
"independent": true,
"groups": {
"web": ["@acme/ui", "@acme/app"]
}
}Groups need "independent": true. See Groups for the rules.
preid
The preid of a new prerelease line, when you do not give --preid. It starts with a letter, and has only letters, digits, and -. See Prereleases.
tag
The name of each release tag. See Templates.
{
"independent": true,
"tag": "{name}-v{version}"
}bump finds earlier releases by this name. A tag belongs to a unit only when the full tag name matches the template. When you change tag, bump does not find the tags of the old form. See No tag found.
message
The subject of the release commit. See Templates.
{
"independent": true,
"message": "chore: release {tags}"
}Each annotated tag uses its own tag name as its message.
Templates
tag and message are templates. A placeholder in braces becomes a value:
| Placeholder | Value | tag |
message |
|---|---|---|---|
{version} |
The new version of the unit. | Required. | Lockstep mode only. |
{name} |
The name of the unit: the package name, or the group name. | Required in independent mode. Not allowed in lockstep mode. | Not allowed. |
{tags} |
The new tags, in release order, joined with , . |
Not allowed. | Allowed. |
- Placeholders are case-sensitive:
{Version}is an error. - A placeholder can occur more than one time.
- There is no escape for a literal brace. Any other text in braces is an error.
@@@ config.md <<<
- Cargo:
membersandexcludeof[workspace]in the rootCargo.toml. The root is a member too when the same file has a[package]. Each path dependency of a member inside the root is a member too, as in Cargo. Without[workspace], the root directory. === - Cargo:
[workspace]in the rootCargo.toml. Without[workspace], the root directory. See Find the crates. Before a release, bump checks each new tag withgit check-ref-format. A scoped name such as@acme/cli@0.4.2is valid. A tag with a space or a:is not:
$ bump minor
FAIL Invalid tag name: "@acme/core:0.1.0"Validation
bump checks the config before it reads the packages. Each error names the key and the file:
$ bump patch
FAIL "version" was removed: versions come from the manifests in "/private/tmp/acme/bump.json"| Problem | Error |
|---|---|
version key |
"version" was removed: versions come from the manifests |
single key |
"single" was removed: use "packages": ["."] |
all key |
"all" was removed: use --all |
| Unknown key | Unknown "workspaces" key |
independent not a boolean |
"independent" must be a boolean |
packages empty, or not strings |
"packages" must be a string or a non-empty array of strings |
groups not an object |
"groups" must be an object |
| An empty group | "groups.web" must be a non-empty array of package names |
groups in lockstep mode |
"groups" needs "independent": true |
Invalid preid |
Invalid "preid" value: "1rc" |
Empty tag or message |
"tag" must be a non-empty string |
| Unknown placeholder | Unknown "{name}" placeholder in "tag" |
| Missing placeholder | Missing "{version}" placeholder in "tag" |
| Single brace | Unmatched brace in "tag" |
| Invalid JSONC | Invalid JSON in "<file>": <parser message> |
| Not an object | "<file>" must hold a JSON object |
Each message in the table ends with in "<file>", except the last two, which name the file at the start.
The group rules give more errors, which name the package and the group. See Groups.
The JS API takes the same keys as options, except $schema and preid. Its preid option is the --preid flag, not this key. An error in an option ends with in the options.
Schema file
The package ships the schema as bump/schema.json. The URL https://unpkg.com/bump/schema.json serves the latest version. To pin the schema to your installed version, use the local file:
{
"$schema": "./node_modules/bump/schema.json"
}