Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.
Rust chatgptclaudeclidesktopdesktop-appelectron-alternativegeminilinuxmacosnativefierno-electronrusttauriweb-to-desktopwebsite-to-appwebviewwindowsyoutube
test: run the build workspace fixture on Linux too
youxi7985783883bda22
diff --git a/AGENTS.md b/AGENTS.mdindex 19ae3e82..4cfe108f 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -114,7 +114,7 @@ Oracles per row live under `tests/unit/` (for example `event-link-guard.test.js`- Build preparation uses private workspaces before acquiring the shared compilation cache lock. Cancellation while waiting must clean only that workspace and leave the active owner's lock intact.- Native build gates use a fresh output directory, require exit code zero and the CLI JSON's exact output path, and verify macOS executable architectures from `CFBundleExecutable`. Compare existing artifact paths with `realpath`, since macOS `/var` and `/private/var` can identify the same file; retain a negative test for genuinely different files. Old bundles, empty directories, or timeout artifacts never prove a successful build.- Platform test mocks must preserve unrelated exports with a partial mock. `defaults.ts` calls `getDefaultLinuxTargets` on Linux during import, so a mock containing only platform booleans can pass on macOS but prevent the suite from loading on Linux. See `tests/unit/linux-multi-target.test.ts`.-- Shared Cargo caches are locked until artifact copying finishes; Cargo's own compilation lock alone does not protect that interval. Never reclaim a stale PID lock with read-then-delete, which can delete a new owner's lock. An abandoned lock fails with a recovery hint rather than risking concurrent artifacts. Cancellation and failed subprocesses must stop the compiler tree before releasing the lock; preserve the workspace and lock if termination cannot be confirmed. Ordinary success and failure discard the workspace, with cleanup warnings included before the JSON result. Verify with `node tests/integration/build-workspace.mjs` on macOS and the cross-platform workspace unit tests.+- Shared Cargo caches are locked until artifact copying finishes; Cargo's own compilation lock alone does not protect that interval. Never reclaim a stale PID lock with read-then-delete, which can delete a new owner's lock. An abandoned lock fails with a recovery hint rather than risking concurrent artifacts. Cancellation and failed subprocesses must stop the compiler tree before releasing the lock; preserve the workspace and lock if termination cannot be confirmed. Ordinary success and failure discard the workspace, with cleanup warnings included before the JSON result. Verify with `node tests/integration/build-workspace.mjs` on macOS or Linux and the cross-platform workspace unit tests.- Build workspaces preserve an existing root `rust-toolchain.toml` or legacy `rust-toolchain`; otherwise rustup may select a different default without the installed cross-compilation targets. Keep full stderr in real-build tests so compilation success cannot conceal a later target or bundling failure. GNU build flags must respect Cargo precedence: append required arguments to `CARGO_ENCODED_RUSTFLAGS` when present (including empty), otherwise to `RUSTFLAGS`; preserve user arguments and keep the override local to the build subprocess.- New user-visible CLI surface (a new flag, alias, subcommand, or extra help variant) needs a stated justification before implementation: name the user problem and why an existing flag, config key, or default cannot cover it, then get maintainer sign-off. Prefer quieter defaults over new options; never split help output into parallel variants.- Window/runtime options with platform-sensitive behavior include `--incognito`, `--new-window`, `--min-width`, `--min-height`, `--maximize`, multi-window behavior, notification click handling, and Linux/Wayland WebKit compositing defaults.diff --git a/tests/index.js b/tests/index.jsindex 0207db4c..eb92c247 100644--- a/tests/index.js+++ b/tests/index.js@@ -715,9 +715,9 @@ class PakeTestRunner {}async runLocalFileTest() {- if (process.platform !== "darwin") {+ if (!["darwin", "linux"].includes(process.platform)) {console.log(- "Local artifact fixture skipped: currently uses macOS .app paths; staging is covered by Vitest.",+ "Local artifact fixture skipped: covers macOS .app and Linux .deb paths; staging is covered by Vitest.",);return;}diff --git a/tests/integration/build-workspace.mjs b/tests/integration/build-workspace.mjsindex 078d6f4e..6c055951 100644--- a/tests/integration/build-workspace.mjs+++ b/tests/integration/build-workspace.mjs@@ -7,8 +7,11 @@ import assert from "node:assert/strict";import { execFile } from "node:child_process";import { promisify } from "node:util";-if (process.platform !== "darwin")- throw new Error("This artifact fixture uses macOS .app paths.");+if (!["darwin", "linux"].includes(process.platform))+ throw new Error(+ "This artifact fixture covers macOS .app and Linux .deb paths.",+ );+const isMac = process.platform === "darwin";const exec = promisify(execFile);const repo = process.cwd();const root = await fs.mkdtemp(@@ -22,23 +25,27 @@ const path = require('node:path');const { spawn } = require('node:child_process');const config = JSON.parse(fs.readFileSync('src-tauri/.pake/tauri.conf.json'));const name = config.productName;+const id = name.toLowerCase();const snapshot = {name, directory: process.cwd(),html: fs.readFileSync('dist/index.html', 'utf8'),custom: fs.readFileSync('src-tauri/src/inject/custom.js', 'utf8'),};-if (name === 'Fail') process.exit(9);-if (name.startsWith('Cancel')) {- const writes = path.join(process.env.PAKE_FIXTURE_ROOT, name + '-writes');+if (id === 'fail') process.exit(9);+if (id.startsWith('cancel')) {+ const writes = path.join(process.env.PAKE_FIXTURE_ROOT, id + '-writes');const child = spawn(process.execPath, ['-e', 'process.on("SIGTERM",()=>{});setInterval(()=>require("fs").appendFileSync(process.argv[1],"x"),10)', writes], {stdio:'ignore'});process.on('SIGTERM', () => {});- fs.writeFileSync(path.join(process.env.PAKE_FIXTURE_ROOT, name + '-ready.json'), JSON.stringify({directory:process.cwd(),pid:process.pid,child:child.pid}));+ fs.writeFileSync(path.join(process.env.PAKE_FIXTURE_ROOT, id + '-ready.json'), JSON.stringify({directory:process.cwd(),pid:process.pid,child:child.pid}));setInterval(() => {}, 10000);} else setTimeout(() => {- const arch = process.arch === 'arm64' ? 'aarch64' : 'x86_64';- const output = path.join(process.env.CARGO_TARGET_DIR, arch + '-apple-darwin', 'release', 'bundle', 'macos', name + '.app');- fs.mkdirSync(output, {recursive:true});- fs.writeFileSync(path.join(output, 'snapshot.json'), JSON.stringify(snapshot));+ const target = process.env.CARGO_TARGET_DIR;+ const arm = process.arch === 'arm64';+ const output = process.platform === 'darwin'+ ? path.join(target, (arm ? 'aarch64' : 'x86_64') + '-apple-darwin', 'release', 'bundle', 'macos', name + '.app', 'snapshot.json')+ : path.join(target, ...(arm ? ['aarch64-unknown-linux-gnu'] : []), 'release', 'bundle', 'deb', name + '_' + config.version + '_' + (arm ? 'arm64' : 'amd64') + '.deb');+ fs.mkdirSync(path.dirname(output), {recursive:true});+ fs.writeFileSync(output, JSON.stringify(snapshot));}, 100);`;@@ -90,10 +97,13 @@ try {"--name",name,"--targets",- "app",+ isMac ? "app" : "deb","--json","--icon",- path.join(repo, "src-tauri/icons/icon.icns"),+ path.join(+ repo,+ isMac ? "src-tauri/icons/icon.icns" : "src-tauri/icons/icon.png",+ ),"--inject",path.join(input, "custom.js"),],@@ -122,7 +132,7 @@ try {running.child.kill("SIGINT");} else if (signal) {running.catch(() => {});- const ready = path.join(root, name + "-ready.json");+ const ready = path.join(root, name.toLowerCase() + "-ready.json");const started = Date.now();for (;;) {try {@@ -134,7 +144,7 @@ try {await new Promise((resolve) => setTimeout(resolve, 25));}// Wait until the descendant has installed its TERM handler and written.- const writes = path.join(root, name + "-writes");+ const writes = path.join(root, name.toLowerCase() + "-writes");for (;;) {try {await fs.access(writes);@@ -168,9 +178,16 @@ try {for (const [index, name] of ["Alpha", "Beta"].entries()) {const result = JSON.parse(outcomes[index].stdout);assert.equal(result.ok, true);+ const artifact = isMac+ ? path.join(root, `${name}.app`)+ : path.join(root, `${name.toLowerCase()}.deb`);+ assert.equal(+ await fs.realpath(result.outputs[0].path),+ await fs.realpath(artifact),+ );const snapshot = JSON.parse(await fs.readFile(- path.join(root, `${name}.app`, "snapshot.json"),+ isMac ? path.join(artifact, "snapshot.json") : artifact,"utf8",),);@@ -199,11 +216,14 @@ try {return true;});const ready = JSON.parse(- await fs.readFile(path.join(root, name + "-ready.json"), "utf8"),+ await fs.readFile(+ path.join(root, name.toLowerCase() + "-ready.json"),+ "utf8",+ ),);await assert.rejects(fs.access(ready.directory));await assert.rejects(fs.access(path.join(cache, ".pake-build.lock")));- const writes = path.join(root, name + "-writes");+ const writes = path.join(root, name.toLowerCase() + "-writes");const size = (await fs.stat(writes)).size;await new Promise((resolve) => setTimeout(resolve, 100));assert.equal(@@ -231,7 +251,10 @@ try {for (const name of ["CancelInt", "CancelTerm"]) {try {const ready = JSON.parse(- await fs.readFile(path.join(root, name + "-ready.json"), "utf8"),+ await fs.readFile(+ path.join(root, name.toLowerCase() + "-ready.json"),+ "utf8",+ ),);for (const pid of [ready.pid, ready.child]) {try {