package-version-git-tag
Add Git tag corresponding to the version
field of package.json
.
Install
npm install --save-dev package-version-git-tag
Usage
$ package-version-git-tag --helppackage-version-git-tag v3.0.0 Add Git tag corresponding to the version field of package.json Usage: $ package-version-git-tag [options] Options: -V, -v, --version Display version number -h, --help Display this message --push `git push` the added tag to the remote repository --verbose show details of executed git commands -n, --dry-run perform a trial run with no changes made
For example, suppose that package.json
exists in the current directory, and version is 1.2.3
:
In this case, this command is:
package-version-git-tag
Equivalent to this operation:
$ git tag v1.2.3 -m 1.2.3
If you add the --push
flag, it will also run git push
. That is, this command is:
package-version-git-tag --push
Equivalent to this operation:
$ git tag v1.2.3 -m 1.2.3$ git push origin v1.2.3
Customize tag name format
If you want to customize the tag name format, you can take the following steps:
-
If you are execute this command with yarn, change the
version-tag-prefix
setting of yarn. This can be achieved by executing the following command:# Set the tag prefix to "foo-bar-"yarn config set version-tag-prefix foo-bar-Another way is to create the
.yarnrc
file:.yarnrc
# Set the tag prefix to "foo-bar-" version-tag-prefix foo-bar-
Note: Currently, Yarn 2 is not supported.
-
Otherwise, change the
tag-version-prefix
setting of npm. This can be achieved by executing the following command:# Set the tag prefix to "foo-bar-"npm config set tag-version-prefix foo-bar-Another way is to create the
.npmrc
file:.npmrc
; Set the tag prefix to "foo-bar-"tag-version-prefix = "foo-bar-"
Tests
To run the test suite, first install the dependencies, then run npm test
:
npm installnpm test
Change Log
see CHANGELOG.md
Contributing
see CONTRIBUTING.md