chore: Version auf 1.1.256 erhöht – automatische Synchronisierung durch Husky

This commit is contained in:
ISA
2025-06-12 11:25:23 +02:00
parent 5bf06cee74
commit 38d0f0b694
6 changed files with 41 additions and 22 deletions

View File

@@ -1,36 +1,39 @@
// @/scripts/bumpVersion.js
const fs = require("fs");
const path = require("path");
// Pfad zur appVersion.js
// Pfade definieren
const versionFilePath = path.join(__dirname, "../config/appVersion.js");
const packageJsonPath = path.join(__dirname, "../package.json");
// Datei einlesen
let content = fs.readFileSync(versionFilePath, "utf8");
// Version auslesen (wichtig: export const muss dabei sein wegen Next.js)
// Aktuelle Version aus appVersion.js lesen
let appVersionContent = fs.readFileSync(versionFilePath, "utf8");
const versionRegex = /export const APP_VERSION = "(\d+)\.(\d+)\.(\d+)"/;
const match = content.match(versionRegex);
const match = appVersionContent.match(versionRegex);
if (!match) {
console.error("Konnte Version nicht finden!");
console.error("Konnte APP_VERSION nicht finden!");
process.exit(1);
}
let major = Number(match[1]);
let minor = Number(match[2]);
let patch = Number(match[3]);
let [_, major, minor, patch] = match.map(Number);
let newPatch = patch + 1;
const newVersion = `${major}.${minor}.${newPatch}`;
// Patch erhöhen
patch++;
// 🟢 appVersion.js aktualisieren
appVersionContent = appVersionContent.replace(
versionRegex,
`export const APP_VERSION = "${newVersion}"`
);
fs.writeFileSync(versionFilePath, appVersionContent, "utf8");
// Neue Version zusammenbauen
const newVersion = `${major}.${minor}.${patch}`;
// 🟢 package.json aktualisieren
const pkgPath = path.resolve(packageJsonPath);
const pkg = JSON.parse(fs.readFileSync(pkgPath));
pkg.version = newVersion;
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2), "utf8");
// Dateiinhalt ersetzen
const newContent = content.replace(versionRegex, `export const APP_VERSION = "${newVersion}"`);
// Datei speichern
fs.writeFileSync(versionFilePath, newContent, "utf8");
// ✅ Log (optional bei DEBUG)
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
console.log(`✅ Version erhöht auf: ${newVersion}`);
}