The project has moved to cider. This package is archived.

CLI tool to set/bump the version key in pubspec.yaml. Semver-compliant (Almost. It uses pub_semver which is a bit different.)


Install the package from the command line:

pub global activate pubspec_version

This will add the pubver binary to your ~/.pub-cache/bin.


Bumping the version

pubver bump <part>

where <part> can be either breaking, major, minor, patch or build.


1.2.3pubver bump breaking2.0.0
0.2.1pubver bump breaking0.3.0
0.2.1pubver bump major1.0.0
0.2.1pubver bump minor0.3.0
0.2.1pubver bump patch0.2.2
0.2.1pubver bump build0.2.1+1
0.2.1+42pubver bump build0.2.1+43
0.2.1+foopubver bump build0.2.1+foo.1
0.2.1+42.foopubver bump bump

The bump build command is a bit tricky. It either increments the first numeric part of the build (if there is a numeric part) setting other numeric parts to zeroes, or appends .1 to the build (otherwise).

Retaining the build number

When bumping either major, minor, or patch versions, it is possible to retain the existing build number (if any). To do so, pass --retain-build (-b) flag.

1.2.3+42pubver bump breaking2.0.0
0.2.1+42pubver bump breaking -b0.3.0+42
0.2.1+42pubver bump patch0.2.2
0.2.1+42pubver bump patch -b0.2.2+42

Setting the version

pubver set <version>

where <version> can be any arbitrary version.

Getting the version

pubver get


The tool prints the new version to stdout. This allows post processing, e.g. making a git commit.

git ci . -m "Release $(pubver bump breaking)"