https://github.com/f3ath/pubspec-version
A CLI tool to get/set/bump the `version` key in pubspec.yaml.
https://github.com/f3ath/pubspec-version
dart dart-library dart2 dartlang flutter pubspec pubspec-maintenance
Last synced: about 1 year ago
JSON representation
A CLI tool to get/set/bump the `version` key in pubspec.yaml.
- Host: GitHub
- URL: https://github.com/f3ath/pubspec-version
- Owner: f3ath
- License: mit
- Created: 2018-10-04T03:38:23.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-26T19:27:25.000Z (almost 6 years ago)
- Last Synced: 2025-03-25T11:02:31.741Z (about 1 year ago)
- Topics: dart, dart-library, dart2, dartlang, flutter, pubspec, pubspec-maintenance
- Language: Dart
- Homepage: https://pub.dartlang.org/packages/pubspec_version
- Size: 41 KB
- Stars: 27
- Watchers: 1
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# The project has moved to [cider](https://pub.dev/packages/cider). This package is archived.
---
---
---
---
---
CLI tool to set/bump the `version` key in pubspec.yaml. Semver-compliant (Almost.
It uses [pub_semver](https://pub.dartlang.org/packages/pub_semver) which is a bit different.)
## Installing
Install the package from the command line:
```
pub global activate pubspec_version
```
This will add the **pubver** binary to your `~/.pub-cache/bin`.
## Usage
### Bumping the version
```
pubver bump
```
where `` can be either **breaking**, **major**, **minor**, **patch** or **build**.
#### Examples
Before | Command | After
--- | --- | ---
1.2.3 | `pubver bump breaking` | 2.0.0
0.2.1 | `pubver bump breaking` | 0.3.0
0.2.1 | `pubver bump major` | 1.0.0
0.2.1 | `pubver bump minor` | 0.3.0
0.2.1 | `pubver bump patch` | 0.2.2
0.2.1 | `pubver bump build` | 0.2.1+1
0.2.1+42 | `pubver bump build` | 0.2.1+43
0.2.1+foo | `pubver bump build` | 0.2.1+foo.1
0.2.1+42.foo | `pubver bump build` | 0.2.1+43.foo
0.2.1+foo.bar.1.2 | `pubver bump build` | 0.2.1+foo.bar.2.0
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.
Before | Command | After
--- | --- | ---
1.2.3+42 | `pubver bump breaking` | 2.0.0
0.2.1+42 | `pubver bump breaking -b` | 0.3.0+42
0.2.1+42 | `pubver bump patch` | 0.2.2
0.2.1+42 | `pubver bump patch -b` | 0.2.2+42
### Setting the version
```
pubver set
```
where `` can be any arbitrary version.
### Getting the version
```
pubver get
```
### Output
The tool prints the new version to stdout. This allows post processing, e.g. making a git commit.
```bash
git ci . -m "Release $(pubver bump breaking)"
```