# package-version-git-tag

> Add Git tag corresponding to the version field of package.json

Latest version **3.0.0** (published 2020-06-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install package-version-git-tag
pnpm add package-version-git-tag
yarn add package-version-git-tag
bun add package-version-git-tag
```

Provides the command `package-version-git-tag`.

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2020-06-02 |
| First published | 2019-07-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | 10.x \|\| 12.x \|\| 14.x |
| Dependencies | 3 |
| Unpacked size | 65.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | sounisi5011 |
| Maintainers | sounisi5011 |
| Keywords | cli, git, git-tag, package, tag, version |

## Links

- npm: https://www.npmjs.com/package/package-version-git-tag
- Repository: https://github.com/sounisi5011/package-version-git-tag
- Homepage: https://github.com/sounisi5011/package-version-git-tag#readme
- Issues: https://github.com/sounisi5011/package-version-git-tag/issues
- npm.io page: https://npm.io/package/package-version-git-tag

## Dependencies (3)

- [cac](https://npm.io/package/cac.md) ^6.5.8
- [cross-spawn](https://npm.io/package/cross-spawn.md) ^7.0.2
- [command-join](https://npm.io/package/command-join.md) ^3.0.0

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 3.0.0 (latest) — 2020-06-02
- 2.1.0 — 2020-04-30
- 2.0.3 — 2020-04-21
- 2.0.2 — 2019-11-12
- 2.0.1 — 2019-11-11
- 2.0.0 — 2019-11-11
- 1.2.0 — 2019-11-09
- 1.1.2 — 2019-09-10
- 1.1.1 — 2019-09-02
- 1.1.0 — 2019-08-02
- 1.0.0 — 2019-07-12

## README

# package-version-git-tag

[![Go to the latest release page on npm](https://img.shields.io/npm/v/package-version-git-tag.svg)][npm]
[![License: MIT](https://img.shields.io/static/v1?label=license&message=MIT&color=green)][github-license]
![Supported Node.js version: 10.x || 12.x || 14.x](https://img.shields.io/static/v1?label=node&message=10.x%20%7C%7C%2012.x%20%7C%7C%2014.x&color=brightgreen)
[![Minified Bundle Size Details](https://img.shields.io/bundlephobia/min/package-version-git-tag/3.0.0)](https://bundlephobia.com/result?p=package-version-git-tag@3.0.0)
[![Install Size Details](https://packagephobia.now.sh/badge?p=package-version-git-tag@3.0.0)](https://packagephobia.now.sh/result?p=package-version-git-tag@3.0.0)
[![Dependencies Status](https://david-dm.org/sounisi5011/package-version-git-tag/status.svg)](https://david-dm.org/sounisi5011/package-version-git-tag)
[![Build Status](https://dev.azure.com/sounisi5011/npm%20projects/_apis/build/status/sounisi5011.package-version-git-tag?branchName=master)](https://dev.azure.com/sounisi5011/npm%20projects/_build/latest?definitionId=2&branchName=master)
[![Maintainability Status](https://api.codeclimate.com/v1/badges/ac675a219746d53b79bc/maintainability)](https://codeclimate.com/github/sounisi5011/package-version-git-tag/maintainability)

[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`.

## Install

```sh
npm install --save-dev package-version-git-tag
```

## Usage

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

### 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](https://classic.yarnpkg.com/docs/cli/version#toc-git-tags).
  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](https://classic.yarnpkg.com/docs/yarnrc):

  **`.yarnrc`**
  ```
  # Set the tag prefix to "foo-bar-"
  version-tag-prefix foo-bar-
  ```

  Note: Currently, **[Yarn 2](https://github.com/yarnpkg/berry) is not supported**.

[yarn]: https://yarnpkg.com

* Otherwise, change [the `tag-version-prefix` setting of npm](https://docs.npmjs.com/misc/config#tag-version-prefix).
  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](https://docs.npmjs.com/files/npmrc):

  **`.npmrc`**
  ```ini
  ; 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`:

```sh
npm install
npm test
```

## Change Log

see [CHANGELOG.md](https://github.com/sounisi5011/package-version-git-tag/tree/v3.0.0/CHANGELOG.md)

## Contributing

see [CONTRIBUTING.md](https://github.com/sounisi5011/package-version-git-tag/tree/master/CONTRIBUTING.md)

## Related

* [taggit](https://github.com/okunishinishi/node-taggit)

---
_Source: https://npm.io/package/package-version-git-tag · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
