Skip to content

Commit bcef387

Browse files
authored
Merge pull request #2859 from video-dev/greater-version-check
always check version is greater than previous
2 parents fb07628 + b70ecbb commit bcef387

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

scripts/set-package-version.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,13 @@ try {
4747
: `0.alpha.${getCommitNum()}`;
4848

4949
newVersion = `${intermediateVersion}${isStable ? '-' : '.'}${suffix}`;
50-
51-
if (!versionParser.isGreater(newVersion, latestVersion)) {
52-
throw new Error(`New version "${newVersion}" is not > than latest version "${latestVersion}" on this branch.`);
53-
}
5450
} else {
5551
throw new Error('Unsupported travis mode: ' + TRAVIS_MODE);
5652
}
5753

54+
if (!versionParser.isGreaterOrEqual(newVersion, latestVersion)) {
55+
throw new Error(`New version "${newVersion}" is not >= latest version "${latestVersion}" on this branch.`);
56+
}
5857
packageJson.version = newVersion;
5958
fs.writeFileSync('./package.json', JSON.stringify(packageJson));
6059
console.log('Set version: ' + newVersion);

scripts/version-parser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ module.exports = {
1919
}
2020
return newVersion;
2121
},
22-
isGreater: (newVersion, previousVersion) => {
23-
return semver.gt(newVersion, previousVersion);
22+
isGreaterOrEqual: (newVersion, previousVersion) => {
23+
return semver.gte(newVersion, previousVersion);
2424
},
2525
// returns true if the provided version is definitely greater than any existing
2626
// auto generated alpha versions

0 commit comments

Comments
 (0)