Skip to content

Commit 36278fb

Browse files
authored
Merge branch 'master' into rave/github-action-publish
2 parents 8f92c26 + d383e58 commit 36278fb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

scripts/release/version.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,16 @@ async function getVersion() {
3737

3838
async function parseVersion(rawVersion) {
3939
try {
40+
const current = rootPackageJson.version;
4041
const exact = semver.valid(rawVersion);
4142
if (exact) {
4243
// answer is a semver version
43-
return exact;
44+
if (semver.gt(exact, current)) {
45+
return exact;
46+
}
47+
throw new Error(`Release version ${rawVersion} is not greater than ${current}.`);
4448
}
45-
const incremented = semver.inc(rootPackageJson.version, rawVersion);
49+
const incremented = semver.inc(current, rawVersion);
4650
if (incremented) {
4751
// answer is a semver release type (major/minor/etc.)
4852
return incremented;

0 commit comments

Comments
 (0)