README
bumpversion
Bump the version to a json file (VERSION.json)
Getting Started
Install the module with: npm install bumpversion
After the installation, you can run
$ bumpversion -m v0.1.1 -c 1
And it would return would something like
version bumped to:
{
"cache": 1,
"timestamp": "2013-06-03T03:57:17.273Z",
"main": "v0.1.1"
}
Meanwhile, a file named VERSION.json would be created with same content.
VERSION.json
- main A string field, indicating the main version. Could be something like "release/v1.2.3"
- cache A integer field indicating the cache version. A good usercase of this field is CDN versioning. If you do not specify "-c", this field would be self increment.
- timestamp A GMT timestamp indicating when the file being generated.
- last_commits If you are using git, you can call bumpversion -lc 3, it would include last three commits version hash and log message into last_commits.
Examples
If you execute "bumpversion" inside a git repository without specifying "-m", it will automatically take the branch name as main version.
Take git branch as main version.
Now I am inside a git repository:
$ git branch
develop
master
* release/0.1.1
Now execute "bumpversion"
$ bumpversion
version bumped to:
{
"cache": 5,
"timestamp": "2013-06-03T03:53:55.972Z",
"main": "release/0.1.1"
}
Include the last N GIT commit hash / log into VERSION.json
Including last 2 commits
bumpversion -lc 2
version bumped to:
{
"cache": 2,
"timestamp": "2013-06-03T04:16:18.487Z",
"main": "release/0.1.1",
"last_commits": [
"0f0ef3da436f5f5f71dcbf78ce720bcd2ff47e7e version bumped",
"a9b14b2ee13a532534d8e75e0e83192534cbd8cc Merge branch 'release/0.1' into develop"
]
}
Including last 5 commits
bumpversion -lc 5
version bumped to:
{
"cache": 3,
"timestamp": "2013-06-03T04:19:07.317Z",
"main": "release/0.1.1",
"last_commits": [
"0f0ef3da436f5f5f71dcbf78ce720bcd2ff47e7e version bumped",
"a9b14b2ee13a532534d8e75e0e83192534cbd8cc Merge branch 'release/0.1' into develop",
"82f901f53fe61fc469c869a5da009aaec26d4b06 include the test",
"73a5c11f9675f67556ad691f023255761568bf97 misc changes",
"83c4c440ac4b47fc0d6fbb5f5b84339889e0e075 add package.json"
]
}
Usage
Displaying the help