I am trying to find a solution to publish a npm artefact based on the git information.
I looked to npm version and release-it, but these tools automate git actions (commit/push) to make the link between npm artefact version and git, it doesnot get the information from git.
I would like to publish npm artefact with git identification of its source, something like the result of git describe --tags --always
.
Like this it could be possible to make the link between git/npm easily and the only git action is tagging, the continous integration pipeline could publish the artefact through npm publish
.
git-tag-version seems making a part of the job, but doesnot makes the link with artefact version.
I will probably try to go in this way, but maybe there is some features in npm that allow to do this more easily ?
npm version from-git
seems not far from what I liked to do, except :
So finally I was using:
npm config set git-tag-version=false
npm version $(git describe --tags)
npm publish
This doesnot commit the package json modification and allow to works with lightweight tag
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With