Schleifen Chart von bis Kalendar
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
// /incrementVersion.ts
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const filePath = path.join(__dirname, "../config/webVersion.ts");
|
||||
const fileContent = fs.readFileSync(filePath, "utf8");
|
||||
const versionFilePath = path.join(process.cwd(), "config/webVersion.ts");
|
||||
const versionFile = fs.readFileSync(versionFilePath, "utf8");
|
||||
|
||||
const versionRegex = /const webVersion = "(\d+)\.(\d+)\.(\d+)\.(\d+)";/;
|
||||
const match = fileContent.match(versionRegex);
|
||||
// Regex, um Versionsnummer zu finden
|
||||
const versionRegex = /(\d+)\.(\d+)\.(\d+)\.(\d+)/;
|
||||
const match = versionFile.match(versionRegex);
|
||||
|
||||
if (!match) {
|
||||
console.error("Version format not found!");
|
||||
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);
|
||||
}
|
||||
|
||||
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}`);
|
||||
|
||||
Reference in New Issue
Block a user