The bump command releases the packages of the git repository that you run it in. It takes a type or an exact version, then optional targets and options.
Usage
bump <type | version> [...targets] [options]bump patch
bump minor --dryrun
bump prerelease --preid rc
bump 2.0.0 @acme/cli
bump minor --jsonType or version
The first argument is required. It is a type or an exact version.
| Type | From 1.2.3 |
From 1.3.0-next.2 |
|---|---|---|
major |
2.0.0 |
2.0.0 |
minor |
1.3.0 |
1.3.0 |
patch |
1.2.4 |
1.3.0 |
premajor |
2.0.0-next.0 |
2.0.0-next.0 |
preminor |
1.3.0-next.0 |
1.4.0-next.0 |
prepatch |
1.2.4-next.0 |
1.3.1-next.0 |
prerelease |
1.2.4-next.0 |
1.3.0-next.3 |
The types are case-insensitive, so PATCH is the same as patch. See Prereleases for the preid rules.
An exact version is a full semver version, such as 2.0.0 or 2.0.0-rc.0. It cannot have a v prefix or build metadata, and it must have three numbers:
$ bump 1.0
FAIL Invalid <type> argument: "1.0"
$ bump v2.0.0
FAIL Invalid <type> argument: "v2.0.0"
$ bump 2.0.0+build
FAIL Invalid <type> argument: "2.0.0+build"
$ bump
FAIL Missing <type> argumentEach new version must be greater than the current version. See Errors.
Targets
Each argument after the first is a target: a package name or a group name. Targets work only in independent mode.
$ bump 2.0.0 @acme/core --dryrun
BUMP @acme/core 1.3.0 → 2.0.0 (target)
BUMP @acme/cli 0.4.2 → 0.4.3 (dependent)
EDIT app devDependencies["@acme/core"] ^1.3.0 → ^2.0.0
EDIT @acme/cli dependencies["@acme/core"] ^1.3.0 → ^2.0.0
DONE Dry run; no files were writtenbump releases each target, changed or not, and each unit that depends on a target at runtime. It does not release other changed units. A package name selects the unit of that package, so a member of a group releases the whole group. See Targets.
Options
| Option | Alias | Value | Description |
|---|---|---|---|
--all |
-A |
Release every unit, changed or not. | |
--preid |
<id> |
The preid of a new prerelease line. The default is the preid of the config, else next. See Prereleases. |
|
--adopt |
Release the units that have no tag for their manifest version, as changed. See No tag found. | ||
--dryrun |
-D |
Do every check, print the release, and write nothing. | |
--json |
Print the result as JSON on stdout. See JSON output. | ||
--quiet |
-q |
Print only the new tags, the warnings, and the failures. See Quiet. | |
--cwd |
-C |
<dir> |
The directory to start from. The default is .. |
--version |
-v |
Print bump, v<version>, and exit. |
|
--help |
-h |
Print the help text, and exit. |
--cwd can point to any directory in the repository. bump searches upward from it for the config file. See Config file.
Parsing rules
--help wins over all other arguments. --version wins over all other arguments except --help. Both ignore the other arguments, also invalid ones:
$ bump -v --foo
bump, v1.0.0An unknown option, an option without its value, and a value for an option that takes none are errors:
$ bump --foo patch
FAIL Unknown option "--foo"
$ bump patch --preid
FAIL Missing value for --preid
$ bump patch --all=yes
FAIL Option --all takes no valueConflicts
These combinations are errors:
| Combination | Error |
|---|---|
--all with targets |
Cannot combine --all with targets |
--preid with major, minor, patch, or an exact version |
Cannot use --preid with "patch" |
| Targets in lockstep mode | Targets need "independent": true in bump.json |
A preid must match ^[A-Za-z][0-9A-Za-z-]*$: a letter, then only letters, digits, and -. Else bump stops with Invalid --preid value: "1rc".
Output
Each line of the log starts with a 4-letter label:
| Label | Stream | Meaning |
|---|---|---|
BUMP |
stdout | A unit to release: its name, its current and new versions, and its reason. |
EDIT |
stdout | A dependency range that changes. |
DONE |
stdout | The result: the commit and the tags, the end of a dry run, or nothing to release. |
WARN |
stderr | A warning. The release continues. |
FAIL |
stderr | An error. bump changed nothing, or undid its changes. |
With --json, every log line goes to stderr, and stdout holds only the JSON.
A release in independent mode:
$ bump minor
BUMP @acme/core 1.2.0 → 1.3.0 (changed)
BUMP @acme/cli 0.4.1 → 0.4.2 (dependent)
EDIT app devDependencies["@acme/core"] ^1.2.0 → ^1.3.0
EDIT @acme/cli dependencies["@acme/core"] ^1.2.0 → ^1.3.0
DONE Committed f2508fa release: @acme/core@1.3.0, @acme/cli@0.4.2
Tagged @acme/core@1.3.0, @acme/cli@0.4.2A release in lockstep mode. The unit has no name, so the BUMP line has none:
$ bump minor
BUMP 1.2.0 → 1.3.0 (changed)
@acme/core, @acme/cli
EDIT @acme/cli dependencies["@acme/core"] ^1.2.0 → ^1.3.0
DONE Committed 068fce4 v1.3.0
Tagged v1.3.0The rules:
- One
BUMPline for each unit, in release order: dependencies before the units that depend on them. - Below a
BUMPline, a line with the member names, when the unit has more than one member, or when a named unit has one member with another name. - One
EDITline for each range edit: the package, the field, the dependency, and the old and new ranges. For an edit in[workspace.dependencies], the path of theCargo.tomlfile replaces the package name. - The log does not list lockfiles. See Lockfiles.
A dry run ends with DONE Dry run; no files were written. When nothing changed, the only line is DONE Nothing to release.
A WARN or FAIL block has the label and the first line of the message. Each other line of the message follows a │ gutter:
$ bump patch
FAIL No tag found for 1 unit whose manifest is past 0.0.0
│
│ (lockstep) manifest 1.2.0 expected tag v1.2.0
│
│ To continue from the last release, tag the commit that released it:
│ git tag -a v1.2.0 -m v1.2.0 <commit>
│
│ To use the manifest version as the base, run again with --adopt:
│ bump patch --adopt → 1.2.1Quiet
With --quiet, bump prints only the warnings and the failures on stderr. After a release, it prints each new tag on its own line on stdout, with no label and no color:
$ bump minor --quiet
@acme/core@1.3.0
@acme/cli@0.4.2A quiet dry run, or a quiet run with nothing to release, prints nothing. With --json, --quiet removes the log from stderr, and the JSON stays on stdout.
Color
bump decides on color in this order:
FORCE_COLORis set: color is on, unless its value is0.NO_COLORis set to a value that is not empty: color is off.- Else, color is on only when stdout and stderr are both terminals.
With --json, the log has no color.
When stdout closes early, as in bump patch | head -1, bump ignores it and finishes the release.
Exit codes
| Code | Meaning |
|---|---|
0 |
bump made a release, finished a dry run, or found nothing to release. --help and --version also exit with 0. |
1 |
An error. See Errors. |
130 |
A SIGINT (for example, Ctrl+C) stopped the release. bump undid it first. |
143 |
A SIGTERM stopped the release. bump undid it first. |
$ bump patch
BUMP 1.2.0 → 1.2.1 (changed)
FAIL Stopped by SIGINT
│ The release was undone: no files, commits, or tags changed.Help text
$ bump --help
Usage
bump <type | version> [...targets] [options]
Types
major, minor, patch, premajor, preminor, prepatch, prerelease
or an exact version, for example 2.0.0
Options
-A, --all Release every unit, changed or not
--preid <id> Preid for a new prerelease line (default: "preid" of bump.json, else next)
--adopt Release units that have no tag, as changed
-D, --dryrun Print the release, and write nothing
-q, --quiet Print only the new tags, and problems
--json Print the result as JSON on stdout
-C, --cwd <dir> Directory to start from (default .)
-v, --version Print the version
-h, --help Print this message
Examples
bump patch
bump minor --dryrun
bump prerelease --preid rc
bump 2.0.0 @acme/cli