Arno Moonen
Arno Moonen

Reputation: 1194

How do I tell npm version from-git to preserve the pre-release information if any?

In our CI pipeline, we run a special publish job whenever a tag is made. Within it we use npm version from-git before publishing, to make sure the package.json has the same version in there as is in the tag. To be precise, we call:

npm --allow-same-version --no-git-tag-version version from-git

This worked fine for tags like v1.2.3, but now we want to publish a prelease (e.g. v1.5.0-rc.1) and this is causing issues, as the pre-release information gets dropped (becomes 1.5.0, without the -rc.1).

From the NPM documentation, I don't see any obvious flag that I'm missing or configuration I need to set.

An alternative approach would be to add some shell script magic to get the tag, remove the v prefix and pass that directly to npm version. I did not try this yet, as I found it hard to believe that npm version would be unable to do this out of the box.

Does anyone one know how to get this to work?

Upvotes: 1

Views: 70

Answers (0)

Related Questions