Skip to content

Commit 32a68e0

Browse files
committed
chore: Fix major version calculation
1 parent 113086d commit 32a68e0

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

  • OpenActive.DatasetSite.NET.Generator

OpenActive.DatasetSite.NET.Generator/app.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,21 @@ function updateReadme() {
3333
}));
3434
}
3535

36+
function getMajorVersion(version) {
37+
return version.substring(0, version.indexOf("."));
38+
}
39+
3640
function updateVersionFile() {
3741
// Align version number major version to version of template
3842
updateFile(VERSION_FILE_PATH, x => {
3943
const json = JSON.parse(x);
40-
const newVersion = `${getStaticAssetsVersion()}.0`;
41-
if (json.version == newVersion) {
44+
const oldMajorVersion = getMajorVersion(json.version);
45+
const newMajorVersion = getStaticAssetsVersion();
46+
if (parseInt(newMajorVersion) <= parseInt(oldMajorVersion)) {
4247
console.log("NO MAJOR VERSION CHANGE DETECTED: Hence no update is required. Updates to the template within dataset-site-template must come with a major version bump");
4348
exit();
4449
}
45-
json.version = newVersion;
50+
json.version = `${newMajorVersion}.0`;
4651
return JSON.stringify(json, null, 2);
4752
});
4853
}

0 commit comments

Comments
 (0)