chore: zentrale Versionsverwaltung verbessert und appVersion.js entfernt

- Versionsnummer wird nun automatisch in package.json, package-lock.json, .env.development und .env.production aktualisiert
- appVersion.js entfernt, da die Version nun direkt über process.env.NEXT_PUBLIC_APP_VERSION verwendet wird
- bumpVersion-Skript aktualisiert und vereinfacht
- Vorbereitungen für klarere Versionshistorie und Releases
This commit is contained in:
ISA
2025-06-17 13:55:27 +02:00
parent b4c5aca8c9
commit 23ec079eb9
8 changed files with 63 additions and 45 deletions

View File

@@ -24,3 +24,5 @@ NEXT_PUBLIC_USE_MOCKS=true
# z.B. http://10.10.0.13/xyz/index.aspx -> NEXT_PUBLIC_BASE_PATH=/xyz
NEXT_PUBLIC_BASE_PATH=/talas5
# Oder leer lassen für direkten Zugriff -> NEXT_PUBLIC_BASE_PATH=
# App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.1.268

View File

@@ -24,3 +24,6 @@ NEXT_PUBLIC_USE_MOCKS=false
# z.B. http://10.10.0.13/xyz/index.aspx -> NEXT_PUBLIC_BASE_PATH=/xyz
NEXT_PUBLIC_BASE_PATH=/talas5
# Oder leer lassen für direkten Zugriff -> NEXT_PUBLIC_BASE_PATH=
# App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.1.268

View File

@@ -11,7 +11,7 @@ import PoiUpdateModal from "@/components/pois/poiUpdateModal/PoiUpdateModal.js";
import { ToastContainer, toast } from "react-toastify";
import plusRoundIcon from "../icons/devices/overlapping/PlusRoundIcon.js";
import { restoreMapSettings, checkOverlappingMarkers } from "../../utils/mapUtils.js";
import { APP_VERSION } from "@/config/appVersion.js";
import addItemsToMapContextMenu from "@/components/contextmenu/useMapContextMenu.js";
import useAreaMarkersLayer from "@/hooks/useAreaMarkersLayer.js";
import { setupPolylines } from "@/utils/polylines/setupPolylines.js";
@@ -87,6 +87,7 @@ import { setGisStationsStaticDistrict } from "@/redux/slices/webservice/gisStati
//-----------------------------------------------------------------------------------------------------
const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
//-------------------------------
const appVersion = process.env.NEXT_PUBLIC_APP_VERSION;
const dispatch = useDispatch();
// useDataUpdater();
const [triggerUpdate, setTriggerUpdate] = useState(false);
@@ -915,7 +916,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
<div>
<span className="text-black text-lg font-semibold"> TALAS.Map </span>
<br />
<span className="text-black text-lg">Version {APP_VERSION}</span>
<span className="text-black text-lg">Version {appVersion}</span>
</div>
<div>
<button onClick={openVersionInfoModal}>
@@ -927,7 +928,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
<VersionInfoModal
showVersionInfoModal={showVersionInfoModal}
closeVersionInfoModal={closeVersionInfoModal}
APP_VERSION={APP_VERSION}
APP_VERSION={appVersion}
/>
</>
);

View File

@@ -2,22 +2,37 @@
import React from "react";
const VersionInfoModal = ({ showVersionInfoModal, closeVersionInfoModal, APP_VERSION }) => {
const appVersion = process.env.NEXT_PUBLIC_APP_VERSION;
return (
<>
{showVersionInfoModal && (
<div className="fixed inset-0 flex items-center justify-center z-50">
<div className="fixed inset-0 bg-black bg-opacity-50" onClick={closeVersionInfoModal}></div>
<div
className="fixed inset-0 bg-black bg-opacity-50"
onClick={closeVersionInfoModal}
></div>
<div className="bg-white p-6 rounded-lg shadow-lg z-60 max-w-lg mx-auto">
<img src="img/Logo_TALAS.png" alt="TALAS V5 Logo" className="w-1/2 mx-auto my-4" />
<div className="bg-white border p-6 rounded-lg shadow-lg z-60 max-w-lg mx-auto">
<h2 className="text-xl font-bold mb-6 text-start leading-tight">Littwin Systemtechnik GmbH & Co. KG</h2>
<h4 className="text-lg font-bold mb-2 text-start leading-tight">Bürgermeister-Brötje Str. 28</h4>
<h2 className="text-xl font-bold mb-6 text-start leading-tight">
Littwin Systemtechnik GmbH & Co. KG
</h2>
<h4 className="text-lg font-bold mb-2 text-start leading-tight">
Bürgermeister-Brötje Str. 28
</h4>
<h4 className="text-lg font-bold mb-2 text-start leading-tight">D-26180 Rastede</h4>
<h5 className="text-md mb-2 text-start leading-snug">T: +49 4402 9725 77-0</h5>
<h5 className="text-md mb-2 text-start leading-snug">E: kontakt@littwin-systemtechnik.de</h5>
<h5 className="text-md mb-2 text-start leading-snug">
E: kontakt@littwin-systemtechnik.de
</h5>
</div>
<p className="text-gray-700 text-center font-bold mt-4 leading-relaxed">TALAS.Map Version {APP_VERSION}</p>
<button onClick={closeVersionInfoModal} className="mt-4 bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-700 mx-auto block">
<p className="text-gray-700 text-center font-bold mt-4 leading-relaxed">
TALAS.Map Version {appVersion}
</p>
<button
onClick={closeVersionInfoModal}
className="mt-4 bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-700 mx-auto block"
>
Schließen
</button>
</div>

View File

@@ -1,2 +0,0 @@
// /config/appVersion
export const APP_VERSION = "1.1.268";

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "nodemap",
"version": "1.1.268",
"version": "1.1.270",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "nodemap",
"version": "1.1.268",
"version": "1.1.270",
"dependencies": {
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",

View File

@@ -1,6 +1,6 @@
{
"name": "nodemap",
"version": "1.1.268",
"version": "1.1.270",
"dependencies": {
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",

View File

@@ -1,46 +1,45 @@
// @/scripts/bumpVersion.js
// /scripts/bumpVersion.js
const fs = require("fs");
const path = require("path");
const { execSync } = require("child_process");
// Pfade definieren
const versionFilePath = path.join(__dirname, "../config/appVersion.js");
const packageJsonPath = path.join(__dirname, "../package.json");
const envPaths = [
path.join(__dirname, "../.env.development"),
path.join(__dirname, "../.env.production"),
];
const pkgPath = path.join(__dirname, "../package.json");
// Aktuelle Version aus appVersion.js lesen
let appVersionContent = fs.readFileSync(versionFilePath, "utf8");
const versionRegex = /export const APP_VERSION = "(\d+)\.(\d+)\.(\d+)"/;
const match = appVersionContent.match(versionRegex);
if (!match) {
console.error("❌ Konnte APP_VERSION nicht finden!");
process.exit(1);
}
let [_, major, minor, patch] = match.map(Number);
let newPatch = patch + 1;
const newVersion = `${major}.${minor}.${newPatch}`;
// 🟢 appVersion.js aktualisieren
appVersionContent = appVersionContent.replace(
versionRegex,
`export const APP_VERSION = "${newVersion}"`
);
fs.writeFileSync(versionFilePath, appVersionContent, "utf8");
// 🟢 Versionsnummer aus package.json holen
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
const [major, minor, patch] = pkg.version.split(".").map(Number);
const newVersion = `${major}.${minor}.${patch + 1}`;
// 🟢 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");
// ✅ Log (optional bei DEBUG)
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
console.log(`✅ Version erhöht auf: ${newVersion}`);
}
const { execSync } = require("child_process");
// 🟢 .env Dateien aktualisieren
envPaths.forEach(envFile => {
if (!fs.existsSync(envFile)) return;
let content = fs.readFileSync(envFile, "utf8");
const versionRegex = /^NEXT_PUBLIC_APP_VERSION=.*$/m;
if (versionRegex.test(content)) {
content = content.replace(versionRegex, `NEXT_PUBLIC_APP_VERSION=${newVersion}`);
} else {
content += `\nNEXT_PUBLIC_APP_VERSION=${newVersion}`;
}
fs.writeFileSync(envFile, content, "utf8");
});
// 🟢 package-lock.json aktualisieren
try {
execSync("npm install --package-lock-only", { stdio: "inherit" });
} catch (error) {
console.error("❌ Fehler beim Aktualisieren der package-lock.json:", error);
process.exit(1);
}
console.log(`✅ Version erhöht auf ${newVersion}`);