Alexander Mills
Alexander Mills

Reputation: 100000

Get latest Git tag for NPM project

Looks like when you run npm publish it creates a git tag for you. That's weird that it does that automatically.

When I run git describe --tags, I see:

v1.1.512218-311-g9f79efe

when I run git tag, I see:

0.0.2
v1.1.512215
v1.1.512216
v1.1.512217
v1.1.512218
v1.1.512219
v1.1.512220
v1.1.512221
v1.1.512222
v1.1.51243

my question is - how do I get the latest git tag for all git branches? How do I get the latest git tag for just the master branch?

What I want to do is compare the most recent commit in a Git repo, with the latest tag, to see if there is a difference. If there is a difference, then I need to create a new tag and publish a new version to NPM.

Upvotes: 0

Views: 1469

Answers (1)

MrPickles
MrPickles

Reputation: 949

~ I think you will need to link them as thay are not linked. ~

~~ NPN version are in the package.json file and git tags are a command of there own ~~

~~ I think this stack overflow post Automate Git commit + versioning + tag by npm node will help ~~

Edit: After comments:

I see the supported node version is >=6 but there is nothing in the .npmrc file about versions. This may be a silly question but you are using the right node version?

Upvotes: 1

Related Questions