bump
v1.0.0-rc.0

Prereleases

A prerelease is a version such as 1.3.0-next.0. A prerelease line is a run of prereleases of one version with one preid: 1.3.0-next.0, 1.3.0-next.1, and so on. The preid is the name of the line, here next.

The pre* types make prereleases of one form only: <version>-<preid>.<number>. An exact version can be any valid prerelease, such as 1.3.0-0.

The examples on this page release one package, app, at 1.2.0, with the tag v1.2.0. Each release follows a new commit.

Start a line

Use premajor, preminor, or prepatch:

Terminal
$ bump preminor
BUMP 1.2.0 → 1.3.0-next.0  (changed)
DONE Committed d90797e v1.3.0-next.0
     Tagged v1.3.0-next.0

From a stable 1.2.3:

Type New version
premajor 2.0.0-next.0
preminor 1.3.0-next.0
prepatch 1.2.4-next.0
prerelease 1.2.4-next.0, the same as prepatch

Continue a line

Use prerelease:

Terminal
$ bump prerelease
BUMP 1.3.0-next.0 → 1.3.0-next.1  (changed)
DONE Committed 1c0a8d5 v1.3.0-next.1
     Tagged v1.3.0-next.1

prerelease keeps the current preid. A version with a preid and no number, such as 1.3.0-next, continues to 1.3.0-next.0.

From a prerelease, the other pre* types always start a new line. From 1.3.0-next.2, premajor gives 2.0.0-next.0, preminor gives 1.4.0-next.0, and prepatch gives 1.3.1-next.0.

Change the preid

Give --preid to prerelease. It starts a new line on the same version:

Terminal
$ bump prerelease --preid rc
BUMP 1.3.0-next.1 → 1.3.0-rc.0  (changed)
DONE Committed a210b59 v1.3.0-rc.0
     Tagged v1.3.0-rc.0

The new version must be greater than the current one. Prerelease ids sort as text, so beta comes before rc:

Terminal
$ bump prerelease --preid beta
FAIL The next version must be greater than 1.3.0-rc.0, but is 1.3.0-beta.0

Graduate

To end a line, use patch, minor, or major. Each removes the prerelease part when the version already has the right shape:

Terminal
$ bump minor
BUMP 1.3.0-rc.0 → 1.3.0  (changed)
DONE Committed cbfb77e v1.3.0
     Tagged v1.3.0
Current Type New version Rule
1.3.0-next.2 patch 1.3.0 Always graduates.
1.3.0-next.2 minor 1.3.0 Graduates when the patch number is 0.
1.3.1-next.0 minor 1.4.0
2.0.0-next.3 major 2.0.0 Graduates when the minor and patch numbers are 0.
1.3.0-next.2 major 2.0.0

Which preid

When a type starts a line, bump takes the first of:

  1. --preid;
  2. preid in the config;
  3. next.
bump.jsonJSONC
{
  "preid": "beta"
}

When prerelease continues a line, bump keeps the current preid, unless you give --preid.

A preid must start with a letter, and then have only letters, digits, and -: ^[A-Za-z][0-9A-Za-z-]*$. Thus rc, beta, and next-2 are valid, and 1rc and rc.1 are not:

Terminal
$ bump prerelease --preid 1rc
FAIL Invalid --preid value: "1rc"

--preid works only with the pre* types. With major, minor, patch, or an exact version, it is an error:

Terminal
$ bump minor --preid rc
FAIL Cannot use --preid with "minor"

Other forms

bump cannot continue a prerelease of another form, such as 1.3.0-0 or 1.3.0-a.b.c. Here app is at 1.3.0-0:

Terminal
$ bump prerelease
FAIL Cannot continue the "1.3.0-0" prerelease; use an exact version

Give an exact version, such as bump 1.3.0-next.0. Or start a new line with bump prerelease --preid next.

Exact versions

Give the version in place of the type. These examples start at 1.3.0-rc.0, before the graduate step:

Terminal
$ bump 1.3.0-rc.5 --dryrun
BUMP 1.3.0-rc.0 → 1.3.0-rc.5  (changed)
DONE Dry run; no files were written

An exact version has no v prefix and no build metadata (+…). It must be greater than the current version:

Terminal
$ bump 1.3.0-rc.0
FAIL The next version must be greater than 1.3.0-rc.0, but is 1.3.0-rc.0

In independent mode, every released unit that is not a dependent gets the same exact version. Dependents follow the rules below.

Dependents

A dependent follows its dependencies onto a prerelease line. These examples are in independent mode: @acme/cli at 0.4.1 depends on @acme/core at 1.2.0.

A stable dependent

When a dependency gets a prerelease, a stable dependent gets a prepatch:

Terminal
$ bump preminor @acme/core
BUMP @acme/core 1.2.0 → 1.3.0-next.0  (target)
BUMP @acme/cli 0.4.1 → 0.4.2-next.0  (dependent)
EDIT @acme/cli dependencies["@acme/core"] ^1.2.0 → ^1.3.0-next.0
DONE Committed f1625fc release: @acme/core@1.3.0-next.0, @acme/cli@0.4.2-next.0
     Tagged @acme/core@1.3.0-next.0, @acme/cli@0.4.2-next.0

The dependent takes the preid of its dependencies. If they have different preids, it takes the command preid. An exact version works the same way. This dry run starts from the same versions as the release above, 1.2.0 and 0.4.1:

Terminal
$ bump 2.0.0-rc.0 @acme/core --dryrun
BUMP @acme/core 1.2.0 → 2.0.0-rc.0  (target)
BUMP @acme/cli 0.4.1 → 0.4.2-rc.0  (dependent)
EDIT @acme/cli dependencies["@acme/core"] ^1.2.0 → ^2.0.0-rc.0
DONE Dry run; no files were written

When the dependencies get stable versions, a stable dependent gets a patch.

A prerelease dependent

A dependent on a prerelease line continues its own line, with its own preid:

Terminal
$ bump prerelease @acme/core
BUMP @acme/core 1.3.0-next.0 → 1.3.0-next.1  (target)
BUMP @acme/cli 0.4.2-next.0 → 0.4.2-next.1  (dependent)
EDIT @acme/cli dependencies["@acme/core"] ^1.3.0-next.0 → ^1.3.0-next.1
DONE Committed deadba0 release: @acme/core@1.3.0-next.1, @acme/cli@0.4.2-next.1
     Tagged @acme/core@1.3.0-next.1, @acme/cli@0.4.2-next.1

--preid does not apply to dependents:

Terminal
$ bump prerelease @acme/core --preid rc
BUMP @acme/core 1.3.0-next.1 → 1.3.0-rc.0  (target)
BUMP @acme/cli 0.4.2-next.1 → 0.4.2-next.2  (dependent)
EDIT @acme/cli dependencies["@acme/core"] ^1.3.0-next.1 → ^1.3.0-rc.0
DONE Committed 46d9a8b release: @acme/core@1.3.0-rc.0, @acme/cli@0.4.2-next.2
     Tagged @acme/core@1.3.0-rc.0, @acme/cli@0.4.2-next.2

Graduate together

A dependent does not graduate by itself. To graduate a unit and its prerelease dependents in one release, name them all as targets:

Terminal
$ bump patch @acme/core @acme/cli --dryrun
BUMP @acme/core 1.3.0-rc.0 → 1.3.0  (target)
BUMP @acme/cli 0.4.2-next.2 → 0.4.2  (target)
EDIT @acme/cli dependencies["@acme/core"] ^1.3.0-rc.0 → ^1.3.0
DONE Dry run; no files were written

If you graduate only @acme/core, @acme/cli continues its line to 0.4.2-next.3. Then release it later with bump patch @acme/cli.

    Type to search page titles and sections.