Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Have `npm version` not prepend "v" to the git tag

Tags:

npm

Is there a way to tell npm version not to add the "v" prefix to the git tags? The reason I'm trying to do this is because I'm using dockerhub to build the node/docker project and the tags is used in the version of the docker image, having a "v" there is unusual and pointless.

like image 558
Reto Gmür Avatar asked Jun 13 '16 11:06

Reto Gmür


People also ask

Does npm version create a git tag?

from-git will try to read the latest git tag, and use that as the new npm version. If run in a git repo, it will also create a version commit and tag. This behavior is controlled by git-tag-version (see below), and can be disabled on the command line by running npm --no-git-tag-version version .

What does npm version patch do?

Purpose. This NPM command allows easy incrementing in both package files and git tags, with a given tag or increment level. Run this in a package directory to bump the version and write the new data back to package.

What is npm in git?

NPM is a node package management tool used to download or publish node packages via the npm package registry. It comes bundled with node. js setup. npmjs offers numerous open-source packages, such as Lodash, React, and Chalk to accelerate the development process.

What happens when you commit to a new version of NPM?

After the commit, it pushes the new commit and tag up to the server, and deletes the build/temp directory. Prevents throwing an error when npm version is used to set the new version to the same value as the current version. Commit and tag the version change.

How do I add a Git version signature to an NPM file?

If set to true, then the npm version command will tag the version using -s to add a signature. Note that git requires you to have set up GPG keys in your git configs for this to work properly.

How do I run git commit hooks from npm?

Run git commit hooks when using the npm version command. Tag the commit when using the npm version command. Setting this to false results in no commit being made at all.

How do I disable Git tag in NPM?

This behavior is controlled by git-tag-version (see below), and can be disabled on the command line by running npm --no-git-tag-version version . It will fail if the working directory is not clean, unless the -f or --force flag is set.


1 Answers

Use a .npmrc file - you may already have one (it stores your configuration for npm). You can either have:

  • a global one in somewhere like ~/.npmrc
  • or a specific for each project in /var/myprojects/awesomeproject/.npmrc

Then, just specify the tag-version-prefix key in it like:

tag-version-prefix=""

like image 136
topheman Avatar answered Oct 14 '22 12:10

topheman