Husky eingerichtet mit post-commit Hook für automatische Versionsanpassung

This commit is contained in:
ISA
2025-03-04 14:10:33 +01:00
parent 7efbc4f6d8
commit d2af447a64
5 changed files with 80 additions and 3 deletions

33
scripts/bumpVersion.js Normal file
View File

@@ -0,0 +1,33 @@
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 = /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}`);