Changed how build versioning works

This commit is contained in:
AloeSapling 2025-08-23 19:15:34 +02:00
parent 0e87db27e8
commit bad61cf713

View file

@ -16,8 +16,10 @@ console.log(`${consoleStyle.GREEN}Read version from manifest.json.${consoleStyle
// Update the version number
const versionNums = manifest.version.split('.'); // Split the version numbers into individual strings
versionNums[versionNums.length-1] = Number(versionNums[versionNums.length-1])+1; // Add one to the last version number position
manifest.version = versionNums.join('.'); // Combine the version numbers back int a whoel string
const lastSegment = versionNums[versionNums.length-1].split("-"); // Other than numbers, the version can optionally end with a hyphen and identifier
lastSegment[0] = Number(lastSegment[0])+1; // Add one to the last version number position
versionNums[versionNums.length-1] = lastSegment.join("-") // Join the last number and identifier back into one string
manifest.version = versionNums.join('.'); // Combine the version numbers back into a whole string
fs.writeFileSync('dist/manifest.json', JSON.stringify(manifest));
console.log(`${consoleStyle.GREEN}Updated userscript version.${consoleStyle.RESET} Version: ${consoleStyle.MAGENTA}${manifest.version}${consoleStyle.RESET}`);