semver bump

For filters.

Bump a semantic version to the next level.

Command Type

built-in

Signature

> semver bump {flags} (level)

Flags

  • --ignore-errors, -i: If the input is not a valid semver version, return the original input unchanged
  • --preserve-build-metadata, -p: Preserve the existing build metadata from the input version
  • --loose, -l: Allow common non-strict prefixes such as v1.2.3, v.1.2.3, v:1.2.3, v-1.2.3, or v_1.2.3 when parsing string input; the prefix is preserved on the result
  • --build-metadata, -b {string}: Additionally set the build metadata. Takes precedence over —preserve-build-metadata

Parameters

  • level: The level to bump: major, minor, patch, alpha, beta, rc, release.

Input/output types:

input output
semver semver
string semver

Examples

Bump major version

> '1.2.3' | into semver | semver bump major
2.0.0

Bump minor version

> '1.2.3' | into semver | semver bump minor
1.3.0

Bump patch version

> '1.2.3' | into semver | semver bump patch
1.2.4

Bump patch version with string input

> '1.2.3' | semver bump patch
1.2.4

Add alpha prerelease

> '1.2.3' | into semver | semver bump alpha
1.2.3-alpha.1

Remove prerelease

> '1.2.3-alpha' | into semver | semver bump release
1.2.3

Bump with preserved build metadata

> '1.2.3+build.5' | into semver | semver bump patch --preserve-build-metadata
1.2.4+build.5

Bump a loosely-prefixed version string

> 'v1.2.3' | semver bump patch --loose | to text
v1.2.4

Bump after converting with —loose (prefix is preserved)

> 'v1.2.3' | into semver --loose | semver bump major | to text
v2.0.0

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.