rlidwka / sinopia

Private npm repository server
5.5k stars 655 forks source link

npm publish command does not tag the published version as latest #160

Open oliamb opened 9 years ago

oliamb commented 9 years ago

Once I have a latest version tag defined (0.1.0 for example), it won't be overridden when I publish version 0.1.2 version using npm publish.

Steps to reproduce:

  1. Configure workspace to use your Sinopia instance...
  2. Create a new NPM package with package.json[version] = 0.1.0
  3. Run npm publish command
  4. Run npm show my-app-name --> check that dist-tags.latest property in the response is "0.1.0"
  5. Update package.json version to 0.1.2
  6. Run npm publish command
  7. Run npm show my-app-name

[expected] dist-tags.latest property in the response is "0.1.2" [actual] dist-tags.latest property is still "0.1.0"

Official NPM documentation states in multiple location that npm publish should update the latest tag by default:

If someone can confirm me that this is an actual issue rather than something wrong in my setup, I would be glad to submit a patch.

rlidwka commented 9 years ago

Official NPM documentation states in multiple location that npm publish should update the latest tag by default:

Yes, it should (unless other tag is specified).

What npm version do you use? It works fine for me with npm@2.

oliamb commented 9 years ago

I'm using 1.4.3 at this time. Will give a try to a 2. version.

Le 11 nov. 2014 à 03:10, Alex Kocharin notifications@github.com a écrit :

Official NPM documentation states in multiple location that npm publish should update the latest tag by default:

Yes, it should (unless other tag is specified).

What npm version do you use? It works fine for me with npm@2.

— Reply to this email directly or view it on GitHub.

oliamb commented 9 years ago

Just tried with npm@2, same issue. When I query for the package, dist_tags is in the same state than before the publication (either empty or with the previously manually tagged version).

rlidwka commented 9 years ago

You could take a look into storage/{package}/package.json to see what is actually tagged there.

We have a bit different behavior from npm, and if you publish two versions, they would both be tagged "latest", and it'll return the highest one. So if you publish 0.1.2 and then 0.1.0, latest would still be 0.1.2.

But I don't know why are you getting 0.1.0 as the latest. Also, I can't reproduce it.

You can also try latest sinopia with default config just to be sure.

vsenko commented 8 years ago

I have the same problem. Published 0.1.0, then 0.1.1, but Sinopia continued to return 0.1.0 as the latest version.

In Sinopia registry file "package.json" contained two version blocks (0.1.0 and 0.1.1) in "versions", two blocks in "_attachments". But "latest" in "dist-tags" contained only 0.1.0:

"dist-tags": {
    "latest": [
        "0.1.0"
    ]
},

I manually added 0.1.1 and now it works fine.

vsenko commented 8 years ago

Got the same issue again. $ sinopia -V 1.4.0 $ nodejs -v v0.12.7 $ npm -v 2.11.3

We have several packages in active development (published several times a day). Two different packages were affected.

Second package version was 0.3.0, then 0.3.2 was published, but "dist-tags"->"latest" was not updated.

yinrong commented 8 years ago

This is a series problem: production relase is using the wrong version if it's using the 'latest' tag.

npm show xxxx
{ name: 'xxxx',
  versions:
   [ '1.5.28',
     '1.5.29',
     '1.5.30',
     '1.5.31',
     '1.5.32' ],
  'dist-tags': { latest: '1.5.31' },
  version: '1.5.31',
...