25 lines
825 B
TypeScript
25 lines
825 B
TypeScript
// /incrementVersion.ts
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
const versionFilePath = path.join(process.cwd(), "config/webVersion.ts");
|
|
const versionFile = fs.readFileSync(versionFilePath, "utf8");
|
|
|
|
// Regex, um Versionsnummer zu finden
|
|
const versionRegex = /(\d+)\.(\d+)\.(\d+)\.(\d+)/;
|
|
const match = versionFile.match(versionRegex);
|
|
|
|
if (match) {
|
|
let [major, minor, patch, build] = match.slice(1).map(Number);
|
|
build++; // Erhöhe die Build-Nummer automatisch
|
|
|
|
const newVersion = `${major}.${minor}.${patch}.${build}`;
|
|
const updatedFile = versionFile.replace(versionRegex, newVersion);
|
|
|
|
fs.writeFileSync(versionFilePath, updatedFile, "utf8");
|
|
console.log(`✅ Webversion aktualisiert auf: ${newVersion}`);
|
|
} else {
|
|
console.error("❌ Konnte die Version nicht finden!");
|
|
process.exit(1);
|
|
}
|