Files
CPLv4.0/incrementVersion.ts
2025-02-10 19:13:31 +01:00

25 lines
724 B
TypeScript

// /incrementVersion.ts
import fs from "fs";
import path from "path";
const filePath = path.join(__dirname, "../config/webVersion.ts");
const fileContent = fs.readFileSync(filePath, "utf8");
const versionRegex = /const webVersion = "(\d+)\.(\d+)\.(\d+)\.(\d+)";/;
const match = fileContent.match(versionRegex);
if (!match) {
console.error("Version format not found!");
process.exit(1);
}
const [_, major, minor, build, patch] = match;
const newVersion = `${major}.${minor}.${build}.${parseInt(patch, 10) + 1}`;
const updatedContent = fileContent.replace(
versionRegex,
`const webVersion = "${newVersion}";`
);
fs.writeFileSync(filePath, updatedContent, "utf8");
console.log(`Version updated to ${newVersion}`);