fix semver handling with prereleases - fixes #24

This commit is contained in:
silverwind 2019-04-25 19:50:03 +02:00
parent cab7350391
commit 543cea72ce
Signed by: silverwind
GPG Key ID: 2E62B41C93869443
3 changed files with 31 additions and 7 deletions

28
test.js

@ -47,7 +47,12 @@ async function main() {
old: "0.0.0",
new: "1.0.0",
info: "https://github.com/fisker/jpeg-buffer-orientation",
}
},
"styled-components": {
old: "2.5.0-1",
new: "4.2.0",
info: "https://github.com/styled-components/styled-components",
},
}
});
@ -77,7 +82,12 @@ async function main() {
old: "0.0.0",
new: "1.0.0",
info: "https://github.com/fisker/jpeg-buffer-orientation",
}
},
"styled-components": {
old: "2.5.0-1",
new: "4.2.0",
info: "https://github.com/styled-components/styled-components",
},
}
});
@ -112,7 +122,12 @@ async function main() {
old: "0.0.0",
new: "1.0.0",
info: "https://github.com/fisker/jpeg-buffer-orientation",
}
},
"styled-components": {
old: "2.5.0-1",
new: "4.2.0",
info: "https://github.com/styled-components/styled-components",
},
}
});
@ -147,7 +162,12 @@ async function main() {
old: "0.0.0",
new: "1.0.0",
info: "https://github.com/fisker/jpeg-buffer-orientation",
}
},
"styled-components": {
old: "2.5.0-1",
new: "4.2.0",
info: "https://github.com/styled-components/styled-components",
},
}
});

@ -5,6 +5,7 @@
"svgstore": "^3.0.0",
"html-webpack-plugin": "4.0.0-alpha.2",
"noty": "3.1.0",
"jpeg-buffer-orientation": "0.0.0"
"jpeg-buffer-orientation": "0.0.0",
"styled-components": "2.5.0-1"
}
}

@ -409,12 +409,15 @@ function rangeToVersion(range) {
function findVersion(data, versions, opts) {
let tempVersion = rangeToVersion(opts.range);
let tempDate = 0;
let semvers = opts.semvers.slice();
const semvers = opts.semvers.slice();
const usePre = isRangePrerelease(opts.range) || opts.usePre;
if (usePre) {
semvers = semvers.concat(["prerelease", "prepatch", "preminor", "premajor"]);
semvers.push("prerelease");
if (semvers.includes("patch")) semvers.push("prepatch");
if (semvers.includes("minor")) semvers.push("preminor");
if (semvers.includes("major")) semvers.push("premajor");
}
for (const version of versions) {