next-ver
v1.8.0
Published
Tells you the next semantic version for your local package
Downloads
28
Readme
next-ver
Tells you the next semantic version for your local package
Install and use
Imagine a local package with current version 2.3.0 and a single semantic
commit fix(something): fix the login
. This tools computes the next
version that should be used.
npm install -g next-ver
next-ver
next version should be 2.3.1
Then you can publish, for example using npm version command or one of the good helper CLI tools, like publish-please, np or ci-publish.
npm version 2.3.1
Incrementing version in package file
If there is a new version, you can update the version in the "package.json"
file and commit the change, including creating a tag, just like the
command npm version <new version>
does.
Just add --go
to the next-ver
command
next-ver --go
Semantic version rules
A semantic version has form "major.minor.patch"
A typical semantic commit has message of the form "type(scope): message". Commits that do not follow this format are ignored when computing next version.
If there is a commit fix(something): ...
then new version should increment
the "patch" number. A commit feat(something): ...
will increment the
"minor" number. Finally, a commit with text "BREAKING" anywhere in the message
or the message body text will increment the "major" number.
When there are multiple numbers, the will be only the highest single digit increment. For example, these 4 commits will increment the "minor" number only.
fix(this): ...
fix(that): ...
feat(log): ...
feat(server): ...
CLI options
--go
increments the version in the current folder'spackage.json
--version, -v
shows the version ofnext-ver
itself
Related
I recommend enforcing commit message format using pre-git with its default simple-commit-message format validator. They work great with semantic-release tool.
- latest-version-or-tag is
used to fetch NPM tags and compare latest to the version in
package.json
Testing and development
Uses separate repo next-ver-test for testing this tool via dont-break
Small print
Author: Gleb Bahmutov <[email protected]> © 2016
License: MIT - do anything with the code, but don't blame me if it does not work.
Support: if you find any problems with this module, email / tweet / open issue on Github
MIT License
Copyright (c) 2016 Gleb Bahmutov <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.