Add Git tag corresponding to the version field of package.json
npm install package-version-git-tag![Go to the latest release page on npm][npm]
![License: MIT][github-license]
!Supported Node.js version: 10.x || 12.x || 14.x





[npm]: https://www.npmjs.com/package/package-version-git-tag
[github-license]: https://github.com/sounisi5011/package-version-git-tag/tree/v3.0.0/LICENSE
Add Git tag corresponding to the version field of package.json.
``sh`
npm install --save-dev package-version-git-tag
`console
$ package-version-git-tag --help
package-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:
`json`
{
"name": "my-awesome-package",
"version": "1.2.3",
...
}
In this case, this command is:
`sh`
package-version-git-tag
Equivalent to this operation:
`console`
$ 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:
`sh`
package-version-git-tag --push
Equivalent to this operation:
`console`
$ git tag v1.2.3 -m 1.2.3
$ git push origin v1.2.3
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:
`sh`
# 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.
[yarn]: https://yarnpkg.com
* Otherwise, change the tag-version-prefix setting of npm.
This can be achieved by executing the following command:
`sh`
# Set the tag prefix to "foo-bar-"
npm config set tag-version-prefix foo-bar-
Another way is to create the .npmrc file:
.npmrc
`ini`
; Set the tag prefix to "foo-bar-"
tag-version-prefix = "foo-bar-"
To run the test suite, first install the dependencies, then run npm test:
`sh``
npm install
npm test
see CHANGELOG.md
see CONTRIBUTING.md
* taggit