Update version check logic
This commit is contained in:
@@ -17,6 +17,7 @@ class ApolloVersion {
|
||||
this.versionMajor = this.versionParts ? this.versionParts[0] : null;
|
||||
this.versionMinor = this.versionParts ? this.versionParts[1] : null;
|
||||
this.versionPatch = this.versionParts ? this.versionParts[2] : null;
|
||||
this.versionIncremental = this.versionParts ? this.versionParts[3] : null;
|
||||
}
|
||||
|
||||
parseVersion(version) {
|
||||
@@ -27,10 +28,10 @@ class ApolloVersion {
|
||||
if (v.indexOf("v") === 0) {
|
||||
v = v.substring(1);
|
||||
}
|
||||
return v.split('.').map(Number);
|
||||
return v.split('.').map(i => parseInt(i, 10));
|
||||
}
|
||||
|
||||
isGreater(otherVersion) {
|
||||
isGreater(otherVersion, checkIncremental) {
|
||||
let otherVersionParts;
|
||||
if (otherVersion instanceof ApolloVersion) {
|
||||
otherVersionParts = otherVersion.versionParts;
|
||||
@@ -43,7 +44,7 @@ class ApolloVersion {
|
||||
if (!this.versionParts || !otherVersionParts) {
|
||||
return false;
|
||||
}
|
||||
for (let i = 0; i < Math.min(3, this.versionParts.length, otherVersionParts.length); i++) {
|
||||
for (let i = 0; i < Math.min(checkIncremental && 4 || 3, this.versionParts.length, otherVersionParts.length); i++) {
|
||||
if (this.versionParts[i] > otherVersionParts[i]) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
if (!this.preReleaseVersion || !this.githubVersion || !this.version) {
|
||||
return false;
|
||||
}
|
||||
return this.preReleaseVersion.isGreater(this.version) && this.preReleaseVersion.isGreater(this.githubVersion);
|
||||
return this.preReleaseVersion.isGreater(this.version, true) && this.preReleaseVersion.isGreater(this.githubVersion, true);
|
||||
},
|
||||
buildVersionIsDirty() {
|
||||
return this.version.version?.split(".").length === 5 &&
|
||||
|
||||
Reference in New Issue
Block a user