0

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.

Alexander Mills
  • 90,741
  • 139
  • 482
  • 817

1 Answers1

1

~ 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?

MrPickles
  • 810
  • 1
  • 9
  • 27
  • bro, please do research before you comment/answer. If you watch this video, it explains that when `npm publish` is run, npm creates a git tag for you. https://docs.npmjs.com/getting-started/publishing-npm-packages – Alexander Mills Jun 13 '18 at 20:09
  • sorry this must be an update I have missed. Things do move fast and I am the first to admit I miss stuff from time to time. – MrPickles Jun 13 '18 at 20:12
  • ... Done research (watch the link). Is it possible to see the `package.json` and `.npmrc` file please. That me help me. – MrPickles Jun 13 '18 at 20:18
  • I think it is the `npm version` command that generates the git tag, not `npm publish` - https://github.com/npm/npm/issues/6711 – Alexander Mills Jun 13 '18 at 20:26
  • I must admit now you mention it. I was not paying 100% to that part. it was defo' worth playing it! .... also LOL -> `"start": "echo 'this is not what you are looking for.'"` – MrPickles Jun 13 '18 at 20:28
  • yeah haha I don't like `npm scripts`, I think they are a bad crutch, etc – Alexander Mills Jun 13 '18 at 20:29
  • also I see [yarn stuff in your repo](https://github.com/sumanjs/suman/blob/master/.gitignore#L19) does that have an affect or is it just a hangover from, times past. – MrPickles Jun 13 '18 at 20:30
  • Yeah I am not using yarn on that project, for the moment – Alexander Mills Jun 13 '18 at 20:39
  • Updated awnser but I think I am about done in how I can help you at this point as my typing (English skills) suck :( – MrPickles Jun 13 '18 at 20:49
  • hey np, maybe come back to it later, thanks anyway though – Alexander Mills Jun 13 '18 at 20:50