forked from silverwind/updates
fix handling of version 0.0.0 - fixes #23
This commit is contained in:
parent
efcd4e003b
commit
20a74217bf
49
test.js
49
test.js
@ -25,7 +25,7 @@ async function main() {
|
||||
},
|
||||
"prismjs": {
|
||||
old: "1.0.0",
|
||||
new: "1.15.0",
|
||||
new: "1.16.0",
|
||||
info: "https://github.com/LeaVerou/prism",
|
||||
},
|
||||
"svgstore": {
|
||||
@ -42,6 +42,11 @@ async function main() {
|
||||
old: "3.1.0",
|
||||
new: "3.2.0-beta",
|
||||
info: "https://github.com/needim/noty",
|
||||
},
|
||||
"jpeg-buffer-orientation": {
|
||||
old: "0.0.0",
|
||||
new: "1.0.0",
|
||||
info: "https://github.com/fisker/jpeg-buffer-orientation",
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -67,6 +72,11 @@ async function main() {
|
||||
old: "3.1.0",
|
||||
new: "3.1.4",
|
||||
info: "https://github.com/needim/noty",
|
||||
},
|
||||
"jpeg-buffer-orientation": {
|
||||
old: "0.0.0",
|
||||
new: "1.0.0",
|
||||
info: "https://github.com/fisker/jpeg-buffer-orientation",
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -97,6 +107,11 @@ async function main() {
|
||||
old: "3.1.0",
|
||||
new: "3.2.0-beta",
|
||||
info: "https://github.com/needim/noty",
|
||||
},
|
||||
"jpeg-buffer-orientation": {
|
||||
old: "0.0.0",
|
||||
new: "1.0.0",
|
||||
info: "https://github.com/fisker/jpeg-buffer-orientation",
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -110,7 +125,7 @@ async function main() {
|
||||
},
|
||||
"prismjs": {
|
||||
old: "1.0.0",
|
||||
new: "1.15.0",
|
||||
new: "1.16.0",
|
||||
info: "https://github.com/LeaVerou/prism",
|
||||
},
|
||||
"svgstore": {
|
||||
@ -127,9 +142,39 @@ async function main() {
|
||||
old: "3.1.0",
|
||||
new: "3.1.4",
|
||||
info: "https://github.com/needim/noty",
|
||||
},
|
||||
"jpeg-buffer-orientation": {
|
||||
old: "0.0.0",
|
||||
new: "1.0.0",
|
||||
info: "https://github.com/fisker/jpeg-buffer-orientation",
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
assert.deepStrictEqual(await run("-j -P -f test.json"), {
|
||||
results: {
|
||||
"gulp-sourcemaps": {
|
||||
old: "2.0.0",
|
||||
new: "2.0.1",
|
||||
info: "https://github.com/floridoo/gulp-sourcemaps",
|
||||
},
|
||||
"svgstore": {
|
||||
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",
|
||||
},
|
||||
"noty": {
|
||||
old: "3.1.0",
|
||||
new: "3.1.4",
|
||||
info: "https://github.com/needim/noty",
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
main().then(exit).catch(exit);
|
||||
|
@ -4,6 +4,7 @@
|
||||
"prismjs": "1.0.0",
|
||||
"svgstore": "^3.0.0",
|
||||
"html-webpack-plugin": "4.0.0-alpha.2",
|
||||
"noty": "3.1.0"
|
||||
"noty": "3.1.0",
|
||||
"jpeg-buffer-orientation": "0.0.0"
|
||||
}
|
||||
}
|
||||
|
@ -388,7 +388,9 @@ function isValidSemverRange(range) {
|
||||
}
|
||||
|
||||
function isVersionPrerelease(version) {
|
||||
return Boolean(semver.parse(version).prerelease.length);
|
||||
const parsed = semver.parse(version);
|
||||
if (!parsed) return false;
|
||||
return Boolean(parsed.prerelease.length);
|
||||
}
|
||||
|
||||
function isRangePrerelease(range) {
|
||||
@ -400,7 +402,7 @@ function rangeToVersion(range) {
|
||||
try {
|
||||
return semver.coerce(range).version;
|
||||
} catch (err) {
|
||||
return "0.0.0";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -435,7 +437,7 @@ function findVersion(data, versions, opts) {
|
||||
}
|
||||
}
|
||||
|
||||
return tempVersion === "0.0.0" ? null : tempVersion;
|
||||
return tempVersion || null;
|
||||
}
|
||||
|
||||
function findNewVersion(data, opts) {
|
||||
|
Loading…
Reference in New Issue
Block a user