chore: version 0.9.4 release
This commit is contained in:
@@ -4,35 +4,17 @@ import { fileURLToPath } from "node:url";
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
const CONFIG_DIR = path.dirname(fileURLToPath(import.meta.url));
|
||||
const APPLICATION_CONFIG_PATH = path.resolve(CONFIG_DIR, "../backend/src/main/resources/application.yml");
|
||||
const POM_PATH = path.resolve(CONFIG_DIR, "../backend/pom.xml");
|
||||
function resolveAppVersion() {
|
||||
const lines = fs.readFileSync(APPLICATION_CONFIG_PATH, "utf8").split(/\r?\n/);
|
||||
let inMuhSection = false;
|
||||
let inAppSection = false;
|
||||
for (const line of lines) {
|
||||
const trimmedLine = line.trim();
|
||||
if (!trimmedLine || trimmedLine.startsWith("#")) {
|
||||
continue;
|
||||
}
|
||||
const indentation = line.length - line.trimStart().length;
|
||||
if (indentation === 0) {
|
||||
inMuhSection = trimmedLine === "muh:";
|
||||
inAppSection = false;
|
||||
continue;
|
||||
}
|
||||
if (inMuhSection && indentation === 2) {
|
||||
inAppSection = trimmedLine === "app:";
|
||||
continue;
|
||||
}
|
||||
if (inMuhSection && inAppSection && indentation === 4 && trimmedLine.startsWith("version:")) {
|
||||
const version = trimmedLine.slice("version:".length).trim().replace(/^['"]|['"]$/g, "");
|
||||
if (/^\d+\.\d+\.\d+$/.test(version)) {
|
||||
return version;
|
||||
}
|
||||
throw new Error(`Ungueltige Versionsnummer in ${APPLICATION_CONFIG_PATH}: ${version}`);
|
||||
}
|
||||
const content = fs.readFileSync(POM_PATH, "utf8");
|
||||
const parentRange = content.indexOf("<parent>");
|
||||
const parentEnd = content.indexOf("</parent>");
|
||||
const withoutParent = content.slice(0, parentRange) + content.slice(parentEnd + "</parent>".length);
|
||||
const match = withoutParent.match(/<version>(\d+\.\d+\.\d+)<\/version>/);
|
||||
if (match) {
|
||||
return match[1];
|
||||
}
|
||||
throw new Error(`muh.app.version konnte nicht aus ${APPLICATION_CONFIG_PATH} ermittelt werden.`);
|
||||
throw new Error(`Version konnte nicht aus ${POM_PATH} ermittelt werden.`);
|
||||
}
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
|
||||
Reference in New Issue
Block a user