diff --git a/build/update-version.js b/build/update-version.js index f4c97f2..0bdfc16 100644 --- a/build/update-version.js +++ b/build/update-version.js @@ -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}`); \ No newline at end of file