Skip to content
Snippets Groups Projects
Commit 6ae9a915 authored by Rhys Arkins's avatar Rhys Arkins
Browse files

fix(composer): lazy evaluate fromVersion major

parent 77d6a29b
No related branches found
No related tags found
No related merge requests found
......@@ -55,7 +55,6 @@ const minSatisfyingVersion = (versions, range) =>
semver.minSatisfyingVersion(versions.map(composer2npm), composer2npm(range));
function getNewValue(currentValue, rangeStrategy, fromVersion, toVersion) {
const fromMajor = getMajor(fromVersion);
const toMajor = getMajor(toVersion);
const toMinor = getMinor(toVersion);
let newValue;
......@@ -84,7 +83,7 @@ function getNewValue(currentValue, rangeStrategy, fromVersion, toVersion) {
newValue = `~${toMajor}`;
} else if (currentValue.match(/^~([0-9]*(?:\.[0-9]*)?)$/)) {
// handle ~4.1 case
if (toMajor > fromMajor) {
if (fromVersion && toMajor > getMajor(fromVersion)) {
newValue = `~${toMajor}.0`;
} else {
newValue = `~${toMajor}.${toMinor}`;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment