34 lines
875 B
JavaScript
34 lines
875 B
JavaScript
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
// Pfad zur appVersion.js
|
|
const versionFilePath = path.join(__dirname, "../config/appVersion.js");
|
|
|
|
// Datei einlesen
|
|
let content = fs.readFileSync(versionFilePath, "utf8");
|
|
|
|
// Version auslesen
|
|
const versionRegex = /export const APP_VERSION = "(\d+)\.(\d+)\.(\d+)"/;
|
|
const match = content.match(versionRegex);
|
|
|
|
if (!match) {
|
|
console.error("Konnte Version nicht finden!");
|
|
process.exit(1);
|
|
}
|
|
|
|
let [fullMatch, major, minor, patch] = match.map(Number);
|
|
|
|
// Dritte Stelle (Patch) erhöhen
|
|
patch++;
|
|
|
|
// Neue Version zusammenbauen
|
|
const newVersion = `${major}.${minor}.${patch}`;
|
|
|
|
// Dateiinhalt ersetzen
|
|
const newContent = content.replace(versionRegex, `APP_VERSION = "${newVersion}"`);
|
|
|
|
// Datei speichern
|
|
fs.writeFileSync(versionFilePath, newContent, "utf8");
|
|
|
|
console.log(`✅ Version erhöht auf: ${newVersion}`);
|