#39 manifest link auf latest umstellen
This commit was merged in pull request #40.
This commit is contained in:
1 parent
1723a4dd6b
commit
4ab69c0905
1 file changed
+5
-17
+5
-17
@@ -2,7 +2,6 @@ import fs from "fs";
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import { ZipArchive } from "archiver";
|
import { ZipArchive } from "archiver";
|
||||||
|
|
||||||
// Pfade definieren
|
|
||||||
const GITEA_URL = process.env.GITEA_URL;
|
const GITEA_URL = process.env.GITEA_URL;
|
||||||
const REPO = process.env.GITEA_REPOSITORY;
|
const REPO = process.env.GITEA_REPOSITORY;
|
||||||
const RELEASE_TAG = process.env.GITEA_REF_NAME || "v1.0.0";
|
const RELEASE_TAG = process.env.GITEA_REF_NAME || "v1.0.0";
|
||||||
@@ -18,12 +17,12 @@ if (fs.existsSync(systemJsonPath)) {
|
|||||||
const systemJson = JSON.parse(fs.readFileSync(systemJsonPath, "utf8"));
|
const systemJson = JSON.parse(fs.readFileSync(systemJsonPath, "utf8"));
|
||||||
|
|
||||||
systemJson.version = cleanVersion;
|
systemJson.version = cleanVersion;
|
||||||
systemJson.manifest = `${GITEA_URL}/${REPO}/releases/download/${RELEASE_TAG}/system.json`;
|
systemJson.manifest = `${GITEA_URL}/${REPO}/releases/download/latest/system.json`;
|
||||||
systemJson.download = `${GITEA_URL}/${REPO}/releases/download/${RELEASE_TAG}/midgard6-lvd.zip`;
|
systemJson.download = `${GITEA_URL}/${REPO}/releases/download/${RELEASE_TAG}/midgard6-lvd.zip`;
|
||||||
|
|
||||||
fs.writeFileSync(systemJsonPath, JSON.stringify(systemJson, null, 2));
|
fs.writeFileSync(systemJsonPath, JSON.stringify(systemJson, null, 2));
|
||||||
console.log(
|
console.log(
|
||||||
`\x1b[32m✅ system.json erfolgreich auf Version ${cleanVersion} aktualisiert.\x1b[0m`
|
`\x1b[32m✅ system.json erfolgreich auf Version ${cleanVersion} aktualisiert.\x1b[0m`,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
console.error(`\x1b[31m❌ system.json nicht gefunden unter: ${systemJsonPath}\x1b[0m`);
|
console.error(`\x1b[31m❌ system.json nicht gefunden unter: ${systemJsonPath}\x1b[0m`);
|
||||||
@@ -37,7 +36,7 @@ if (fs.existsSync(packageJsonPath)) {
|
|||||||
|
|
||||||
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
||||||
console.log(
|
console.log(
|
||||||
`\x1b[32m✅ package.json erfolgreich auf Version ${cleanVersion} aktualisiert.\x1b[0m`
|
`\x1b[32m✅ package.json erfolgreich auf Version ${cleanVersion} aktualisiert.\x1b[0m`,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
console.log(`\x1b[33m⚠️ package.json nicht gefunden – Schritt übersprungen.\x1b[0m`);
|
console.log(`\x1b[33m⚠️ package.json nicht gefunden – Schritt übersprungen.\x1b[0m`);
|
||||||
@@ -57,11 +56,10 @@ async function zipDirectory(sourceDir, outPath) {
|
|||||||
|
|
||||||
archive.pipe(stream);
|
archive.pipe(stream);
|
||||||
archive.directory(sourceDir, false);
|
archive.directory(sourceDir, false);
|
||||||
archive.finalize(); // Finalize anstoßen
|
archive.finalize();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name auf "build-zip" geändert, um Konflikte mit Vites "dist"-Ordner zu vermeiden!
|
|
||||||
const zipTmpDir = path.resolve("./build-zip");
|
const zipTmpDir = path.resolve("./build-zip");
|
||||||
|
|
||||||
if (fs.existsSync(zipTmpDir)) {
|
if (fs.existsSync(zipTmpDir)) {
|
||||||
@@ -69,15 +67,7 @@ if (fs.existsSync(zipTmpDir)) {
|
|||||||
}
|
}
|
||||||
fs.mkdirSync(zipTmpDir);
|
fs.mkdirSync(zipTmpDir);
|
||||||
|
|
||||||
// Passe diese Liste an! Da Vite in "dist" baut, müssen die Pfade eventuell dorthin zeigen
|
const filesToInclude = ["system.json", "templates", "dist", "lang", "assets"];
|
||||||
// Beispiel: Wenn dein CSS in dist/styles/M6.css liegt, schreibe 'dist/styles/M6.css' in die Liste.
|
|
||||||
const filesToInclude = [
|
|
||||||
"system.json",
|
|
||||||
"templates",
|
|
||||||
"dist", // Kopiert den gesamten Inhalt deines echten Vite-Build-Ordners mit in die Zip!
|
|
||||||
"lang",
|
|
||||||
"assets"
|
|
||||||
];
|
|
||||||
|
|
||||||
for (const file of filesToInclude) {
|
for (const file of filesToInclude) {
|
||||||
if (fs.existsSync(file)) {
|
if (fs.existsSync(file)) {
|
||||||
@@ -91,9 +81,7 @@ for (const file of filesToInclude) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wir zippen jetzt den sicheren "build-zip" Ordner
|
|
||||||
await zipDirectory(zipTmpDir, "./midgard6-lvd.zip");
|
await zipDirectory(zipTmpDir, "./midgard6-lvd.zip");
|
||||||
console.log("\x1b[32m✅ system.zip wurde erfolgreich generiert.\x1b[0m");
|
console.log("\x1b[32m✅ system.zip wurde erfolgreich generiert.\x1b[0m");
|
||||||
|
|
||||||
// Optional: Den temporären Ordner nach dem Zippen wieder aufräumen
|
|
||||||
fs.rmSync(zipTmpDir, { recursive: true, force: true });
|
fs.rmSync(zipTmpDir, { recursive: true, force: true });
|
||||||
Reference in new issue
Block a user