package-version-git-tag
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

package-version-git-tag

Go to the latest release page on npm License: MIT Supported Node.js version: 10.x || 12.x || 14.x Minified Bundle Size Details Install Size Details Dependencies Status Build Status Maintainability Status

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 --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:

{
    "name": "my-awesome-package",
    "version": "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 install
npm test

Change Log

see CHANGELOG.md

Contributing

see CONTRIBUTING.md

Related

Package Sidebar

Install

npm i package-version-git-tag

Weekly Downloads

661

Version

3.0.0

License

MIT

Unpacked Size

67.3 kB

Total Files

20

Last publish

Collaborators

  • sounisi5011