Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

test: read event.js with LF in the new-tab link test, and check sources out with LF

Tw934cf6ae3e9e38
diff --git a/.claude/rules/cli.md b/.claude/rules/cli.md
index 78db5d1d..306403af 100644
--- a/.claude/rules/cli.md
+++ b/.claude/rules/cli.md
@@ -16,7 +16,7 @@ paths:
- 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`.
-- A test that reads a source file runs on `windows-latest` too, where the checkout has CRLF line endings: normalize what it read (`.replace(/\r\n/g, '\n')`) before any pattern or `indexOf` that spans a line break. Two macOS-only source tests written on a Mac kept the Windows Quality jobs red for five commits (2026-11-17), so after pushing a new test read that commit's Quality run on all three systems, not only the local pass.
+- A test that reads a source file runs on `windows-latest` too, where a checkout used to have CRLF line endings: `.gitattributes` now checks `src-tauri/src/**` and `tests/**` out with LF everywhere (2026-11-18, after a Rust `include_str!` test hit the same trap a day after two Vitest ones), and a test still normalizes what it read (`.replace(/\r\n/g, '\n')`, `.replace("\r\n", "\n")` in Rust) before any pattern or `indexOf` that spans a line break, for a clone made before the attribute. Two macOS-only source tests written on a Mac kept the Windows Quality jobs red for five commits (2026-11-17), so after pushing a new test read that commit's Quality run on all three systems, not only the local pass.
- 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.
diff --git a/.gitattributes b/.gitattributes
index ad7b404f..388bde0e 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -25,3 +25,9 @@ src-tauri/.cargo/**/* linguist-vendored
# Exclude injection system (since it's mostly JS/CSS)
src-tauri/src/inject/**/* linguist-vendored
+
+# Source is checked out with LF on every system. Tests read these files as
+# text, from Vitest and from Rust's include_str!, and a pattern that spans a
+# line break did not match the CRLF a Windows checkout gave them.
+src-tauri/src/** text eol=lf
+tests/** text eol=lf
diff --git a/src-tauri/src/app/window.rs b/src-tauri/src/app/window.rs
index 77c82087..df233437 100644
--- a/src-tauri/src/app/window.rs
+++ b/src-tauri/src/app/window.rs
@@ -277,7 +277,7 @@ mod popup_tests {
// link in the system browser, handled by the page or not. The click
// guard must retarget before it asks about --new-window, and the
// in-app window must wait for the end of the bubble.
- let script = include_str!("../inject/event.js");
+ let script = include_str!("../inject/event.js").replace("\r\n", "\n");
let retarget = script
.find(
"anchorElement.target = \"_self\";\n if (window.pakeConfig?.new_window) {",