Skip to content

Commit bf49183

Browse files
committed
don't blindly clobber local dist-tags
If packages are being published to verdaccio as well as upstream to npmjs.org, then when the cache is updated from npmjs.org it uses the dist-tags from the upstream even if the locally published version is actually newer. This makes it very difficult to use verdaccio as a staging registry for testing out potential releases. This change partially reverts a change in behaviour that was introduced in rlidwka#8 which caused a regression for the staging style workflow that was supported by sinopia.
1 parent f84ca18 commit bf49183

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/storage.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -511,8 +511,8 @@ Storage._merge_versions = function(local, up, config) {
511511
// refresh dist-tags
512512
for (var i in up['dist-tags']) {
513513
if (local['dist-tags'][i] !== up['dist-tags'][i]) {
514-
local['dist-tags'][i] = up['dist-tags'][i]
515-
if (i === 'latest') {
514+
local['dist-tags'][i] = Utils.semver_sort([up['dist-tags'][i], local['dist-tags'][i]]).reverse()[0]
515+
if (i === 'latest' && local['dist-tags'][i] === up['dist-tags'][i]) {
516516
// if remote has more fresh package, we should borrow its readme
517517
local.readme = up.readme
518518
}

0 commit comments

Comments
 (0)