fix dist-tag latest check, fixes #9

This commit is contained in:
silverwind 2018-11-19 15:37:20 +01:00
parent c1258ed489
commit 3442a30846
Signed by: silverwind
GPG Key ID: 2E62B41C93869443

@ -325,9 +325,11 @@ function findNewVersion(data, opts) {
}
}
// special case for when pre-releases are tagged as latest
// Special case for when pre-releases are tagged as latest. This ignores the
// --prerelease option, but it's how npm and other tools work so we copy
// their behaviour.
const latestTag = data["dist-tags"].latest;
if (!opts.useGreatest && latestTag !== newVersion[0]) {
if (!opts.useGreatest && latestTag !== newVersion[0] && semver.diff(newVersion[0], latestTag) === "prerelease") {
newVersion[0] = latestTag;
}