fix updates between prereleases

This commit is contained in:
silverwind 2019-02-25 21:50:12 +01:00
parent 665e13cfcb
commit 96c53233ef
Signed by: silverwind
GPG Key ID: 2E62B41C93869443
3 changed files with 23 additions and 6 deletions

21
test.js

@ -20,7 +20,7 @@ async function main() {
results: {
"gulp-sourcemaps": {
old: "2.0.0",
new: "2.6.4",
new: "2.6.5",
info: "https://github.com/gulp-sourcemaps/gulp-sourcemaps",
},
"prismjs": {
@ -32,6 +32,11 @@ async function main() {
old: "^3.0.0",
new: "^3.0.0-2",
info: "https://github.com/svgstore/svgstore",
},
"html-webpack-plugin": {
old: "4.0.0-alpha.2",
new: "4.0.0-beta.5",
info: "https://github.com/jantimon/html-webpack-plugin",
}
}
});
@ -40,13 +45,18 @@ async function main() {
results: {
"gulp-sourcemaps": {
old: "2.0.0",
new: "2.6.4",
new: "2.6.5",
info: "https://github.com/gulp-sourcemaps/gulp-sourcemaps",
},
"prismjs": {
old: "1.0.0",
new: "9000.0.2",
info: "https://github.com/LeaVerou/prism",
},
"html-webpack-plugin": {
old: "4.0.0-alpha.2",
new: "4.0.0-beta.5",
info: "https://github.com/jantimon/html-webpack-plugin",
}
}
});
@ -55,7 +65,7 @@ async function main() {
results: {
"gulp-sourcemaps": {
old: "2.0.0",
new: "2.6.4",
new: "2.6.5",
info: "https://github.com/gulp-sourcemaps/gulp-sourcemaps",
},
"prismjs": {
@ -67,6 +77,11 @@ async function main() {
old: "^3.0.0",
new: "^3.0.0-2",
info: "https://github.com/svgstore/svgstore",
},
"html-webpack-plugin": {
old: "4.0.0-alpha.2",
new: "4.0.0-beta.5",
info: "https://github.com/jantimon/html-webpack-plugin",
}
}
});

@ -2,6 +2,7 @@
"dependencies": {
"gulp-sourcemaps": "2.0.0",
"prismjs": "1.0.0",
"svgstore": "^3.0.0"
"svgstore": "^3.0.0",
"html-webpack-plugin": "4.0.0-alpha.2"
}
}

@ -444,13 +444,14 @@ function findNewVersion(data, opts) {
const oldVersion = semver.coerce(opts.range).version;
const oldIsPre = isRangePrerelease(opts.range);
const newIsPre = isVersionPrerelease(version);
const isGreater = semver.gt(version, oldVersion);
// update to new prerelease
if (opts.usePre && newIsPre && isGreater) {
if (opts.usePre || (oldIsPre && newIsPre)) {
return version;
}
const isGreater = semver.gt(version, oldVersion);
// update from prerelease to release
if (oldIsPre && !newIsPre && isGreater) {
return version;