vers
updates version in JavaScript projects.
In general, vers
does the following:
- updates
package.json
- updates
package-lock.json
(if exists) - creates CHANGELOG.md file
- creates commit using formatting:
Version bump: v0.1.0
- creates an annotated git tag
- and pushes changes
vers
works only with git.
vers
doesn't work inmain
branch by design, works only in feature branches.
You can use it as a binary or as a library.
You should choose a version type: major
, minor
, or patch
. And include changes:
vers minor --info "some changes"
USAGE:
vers [FLAGS] [OPTIONS] <version_type>
ARGS:
<version_type> [possible values: major, minor, patch]
FLAGS:
-h, --help Prints help information
-n, --no-commit Prevents committing your changes
-V, --version Prints version information
OPTIONS:
-i, --info <string> Sets info value
The crate is only available via git repo for now. You can include it using
rev
,tag
orbranch
key. Read more in Cargo docs.
You should add vers
crate to your Cargo.toml file:
[dependencies]
vers = { git = "https://github.com/ink8bit/vers", branch = "master" }
Updates CHANGELOG.md
, package.json
, package-lock.json
(if exists), commits changes, creates tag and pushes changes to the remote. Returns created version value.
match vers::update("minor", "changes", false) {
Ok(v) => println!("Updated version: {}", v),
Err(e) => eprintln!("{}", e),
}
Creates commit and tag. Returns created tag value.
match vers::save_changes("v1.2.3", "releaser", "some info") {
Ok(v) => println!("Created tag: {}", v),
Err(e) => eprintln!("{}", e),
}
Pushes changes to the remote. Returns current git branch value.
match vers::push_changes() {
Ok(v) => println!("Current git branch: {}", v),
Err(e) => eprintln!("{}", e),
}
Returns your git user name and user email, or your GitHub handle if you set env var VERS_GITHUB_NAME.
let releaser = match vers::releaser() {
Ok(value) => value,
Err(e) => panic!("{}", e),
};
Returns current git branch
value.
let branch = match vers::current_branch_name() {
Ok(value) => value,
Err(e) => panic!("{}", e),
};
Every changelog entry has these contents:
## v0.1.0
### Date string in RFC 2822 format
**Released by:** username <user email>
**Changes:** your changes
List of commits in feature branch
You can use your GitHub username in:
Released by:
field in your CHANGELOG.md fileTagged by:
field in your tagReleased by:
field in your commit message
You need to set env variable VERS_GITHUB_NAME
. For example:
export VERS_GITHUB_NAME=username
If
vers
could not get value from env varVERS_GITHUB_NAME
, your git user name and email will be used instead.