[170][30][261] Linux-App: AppImage im Container gebaut und mit Playwright-Electron geprüft, vier Fehler behoben
Linux ist ab 1.0 offiziell (Entscheid 16.11.). Das AppImage wird wie im Release gebaut (npm run build && npm run electron:pack) und mit `npm run test:linux-app` bedient (e2e/linuxApp170.spec.ts, Playwright _electron, Xvfb; im normalen e2e-Lauf übersprungen): Start, Kern, Wand per Befehlszeile, Speichern atomar mit .obp~, Strg+S, Öffnen per Dialog und per Argument, PDF/DXF auf die Platte, Autosave-Wiederherstellen nach kill -9. Grün über FUSE, mit APPIMAGE_EXTRACT_AND_RUN=1 und entpackt (linux-unpacked). Behoben: - scripts/electron-files.cjs fehlte in `files` von electron-builder.yml: das gepackte Programm startete nicht („Cannot find module“). Test src/native/electronPackage.test.ts prüft alle require() von Hauptprozess und Preload gegen die Paketliste. - `dossier datei.obp`: Datei wurde hinter dem Startbildschirm geladen bzw. wartete auf eine Rückfrage, die dort nicht erscheint; jetzt direkt in den Editor (onLaunchFile). - Strg+S / Strg+Umschalt+S / Strg+O gab es nur im nativen Tauri-Menü; jetzt auch im Browser/Electron (useFileShortcuts, fileShortcutFor + Test). - Datei → „Exportieren: PDF“ fehlte im Browser/Electron (nur natives Menü); ergänzt, e2e io.spec.ts. Buildnummer [261]: Vite schreibt dist/build-info.json; scripts/electron-pack.cjs gibt sie über die electron-builder-API als buildVersion und extraMetadata.dossierBuild weiter (über `-c.` auf der Kommandozeile würde „261116.10“ zur Zahl). release.yml: `--version=` statt `-c.extraMetadata.version`, neuer Schritt „AppImage prüfen“ (xvfb, libfuse2t64; nicht auf GitHub gelaufen). Doku: doc/RELEASE-1.0.md Abschnitt 15 (Linux-App, Status je Schritt), Release-Notes Linux, README „Linux installieren“, TODO [170]/[261]. Geprüft: npm run check --fast (tsc, vitest) grün; e2e io/datensicherheit116/start im Browser grün; test:linux-app dreimal grün. Nicht geprüft: Rust-Tests (nichts geändert), echte GPU, Wayland, GTK-Dialoge von Hand, Sandbox als normaler Benutzer, Mac/Tauri.
This commit is contained in:
22 files changed
+643
-30
No files matched your search
@@ -32,6 +32,13 @@ const gpu = process.env.DOSSIER_GPU || (ozone === "wayland" ? "minimal" : "vulka
|
||||
if (gpu === "vulkan") app.commandLine.appendSwitch("enable-features", "Vulkan,VulkanFromANGLE,DefaultANGLEVulkan");
|
||||
else if (gpu === "angle") app.commandLine.appendSwitch("enable-features", "VulkanFromANGLE,DefaultANGLEVulkan");
|
||||
console.log(`[dossier] GPU-Modus: ${gpu}${ozone ? `, Plattform: ${ozone}` : ""}`);
|
||||
// [261] Version und Buildnummer ins Log (Fehlerberichte); `dossierBuild` setzt scripts/electron-pack.cjs ins gepackte package.json.
|
||||
try {
|
||||
const build = require("../package.json").dossierBuild;
|
||||
console.log(`[dossier] Version ${app.getVersion()}${build ? ` (Build ${build})` : ""}`);
|
||||
} catch {
|
||||
/* ohne package.json: kein Log */
|
||||
}
|
||||
if (ozone) app.commandLine.appendSwitch("ozone-platform", ozone);
|
||||
|
||||
const DEV_URL = "http://localhost:5187";
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env node
|
||||
// electron-pack.cjs — Linux-Paket (AppImage x86_64) mit electron-builder bauen ([170]); `npm run electron:pack` nach `npm run build`.
|
||||
// Buildnummer ([261]): kommt aus dem GEBAUTEN dist (`dist/build-info.json`, geschrieben vom Vite-Plugin in vite.config.ts),
|
||||
// damit Oberfläche und Paket dieselbe Nummer tragen, auch wenn zwischen `build` und `pack` ein Commit liegt. electron-builder
|
||||
// bekommt sie als `buildVersion` (unter Linux nur Metadaten) und `extraMetadata.dossierBuild` (package.json im Paket).
|
||||
// Über die JS-Schnittstelle, nicht `-c.…` auf der Kommandozeile: dort würde „261116.10“ zur Zahl 261116.1.
|
||||
// Optional `--version=1.2.3` (Release aus einem Tag) überschreibt die Version aus package.json.
|
||||
const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
const { BUILD_RE } = require("./build-number.cjs");
|
||||
|
||||
/** Liest `{version, build}` aus `<distDir>/build-info.json`; `null`, wenn sie fehlt oder ungültig ist. */
|
||||
function readDistBuild(distDir) {
|
||||
try {
|
||||
const info = JSON.parse(fs.readFileSync(path.join(distDir, "build-info.json"), "utf8"));
|
||||
if (typeof info?.version !== "string" || typeof info?.build !== "string" || !BUILD_RE.test(info.build)) return null;
|
||||
return { version: info.version, build: info.build };
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** Konfiguration für electron-builder: erbt `electron-builder.yml`, ergänzt Buildnummer (als Zeichenkette) und ggf. Version. */
|
||||
function packConfig(build, version) {
|
||||
const extraMetadata = { dossierBuild: String(build) };
|
||||
if (version) extraMetadata.version = String(version);
|
||||
return { extends: "./electron-builder.yml", buildVersion: String(build), extraMetadata };
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const root = path.join(__dirname, "..");
|
||||
const info = readDistBuild(path.join(root, "dist"));
|
||||
if (!info) {
|
||||
console.error("electron-pack: dist/build-info.json fehlt oder ist ungültig — zuerst `npm run build`.");
|
||||
process.exit(1);
|
||||
}
|
||||
const versionArg = process.argv.slice(2).find((a) => a.startsWith("--version="));
|
||||
const version = versionArg ? versionArg.slice("--version=".length) : undefined;
|
||||
console.log(`electron-pack: Dossier ${version ?? info.version} (Build ${info.build})`);
|
||||
const { build, Platform, Arch } = require("electron-builder");
|
||||
await build({
|
||||
projectDir: root,
|
||||
targets: Platform.LINUX.createTarget("AppImage", Arch.x64),
|
||||
publish: "never",
|
||||
config: packConfig(info.build, version),
|
||||
});
|
||||
}
|
||||
|
||||
if (require.main === module)
|
||||
main().catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
module.exports = { packConfig, readDistBuild };
|
||||
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env node
|
||||
// test-linux-app.mjs — prüft das gebaute Linux-Paket ([170]): `npm run build && npm run electron:pack`, dann `npm run test:linux-app`.
|
||||
// Paket: DOSSIER_ELECTRON_BIN, sonst das neueste `release/*.AppImage`, sonst `release/linux-unpacked/dossier`.
|
||||
// Ohne Bildschirm (kein DISPLAY/WAYLAND_DISPLAY) läuft der Test unter `xvfb-run -a`. Ohne FUSE startet der Test das
|
||||
// AppImage mit APPIMAGE_EXTRACT_AND_RUN=1 (e2e/linuxApp170.spec.ts). Weitere Argumente gehen an `playwright test`.
|
||||
import { existsSync, readdirSync, statSync } from "node:fs";
|
||||
import { join, resolve } from "node:path";
|
||||
import { spawnSync } from "node:child_process";
|
||||
|
||||
const root = resolve(import.meta.dirname, "..");
|
||||
|
||||
function findBin() {
|
||||
if (process.env.DOSSIER_ELECTRON_BIN) return resolve(process.env.DOSSIER_ELECTRON_BIN);
|
||||
const rel = join(root, "release");
|
||||
if (!existsSync(rel)) return null;
|
||||
const images = readdirSync(rel)
|
||||
.filter((f) => f.endsWith(".AppImage"))
|
||||
.map((f) => join(rel, f))
|
||||
.sort((a, b) => statSync(b).mtimeMs - statSync(a).mtimeMs);
|
||||
if (images.length) return images[0];
|
||||
const unpacked = join(rel, "linux-unpacked", "dossier");
|
||||
return existsSync(unpacked) ? unpacked : null;
|
||||
}
|
||||
|
||||
const bin = findBin();
|
||||
if (!bin || !existsSync(bin)) {
|
||||
console.error("test-linux-app: kein Paket gefunden — zuerst `npm run build && npm run electron:pack` (oder DOSSIER_ELECTRON_BIN setzen).");
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`test-linux-app: prüfe ${bin}`);
|
||||
const pw = [join(root, "node_modules", ".bin", "playwright"), "test", "-c", "playwright.electron.config.ts", ...process.argv.slice(2)];
|
||||
const headless = !process.env.DISPLAY && !process.env.WAYLAND_DISPLAY;
|
||||
const [cmd, ...args] = headless ? ["xvfb-run", "-a", "-s", "-screen 0 1920x1080x24", ...pw] : pw;
|
||||
const r = spawnSync(cmd, args, { cwd: root, stdio: "inherit", env: { ...process.env, DOSSIER_ELECTRON_BIN: bin } });
|
||||
if (r.error) console.error(`test-linux-app: ${r.error.message}${headless ? " (xvfb-run installiert?)" : ""}`);
|
||||
process.exit(r.status ?? 1);
|
||||
Reference in new issue
Block a user