Skip to content

Commit f4a6b44

Browse files
t3dotggclaude
andcommitted
fix(desktop): skip the compile cache under AppImage, register entries with knip
AppImage mounts the app at a new /tmp/.mount_* path on every launch, and Node keys compile cache entries by path, so each launch missed and left another copy behind. Portable mode does not help because the relative path still contains the mount name. Also list boot.ts and compileCache.ts as knip entries, since Electron and the backend load them by filename. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 0dfd3ba commit f4a6b44

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

‎apps/desktop/src/compileCache.ts‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,19 @@ import * as NodePath from "node:path";
1010
// backend gets it with `--require`. Dev launches main.cjs directly and skips it.
1111
// Linux uses the user's cache dir because /tmp is shared between users; the
1212
// macOS and Windows temp dirs are already per user.
13+
//
14+
// Skipped under AppImage: it mounts the app at a new /tmp/.mount_* path each
15+
// launch, and Node keys entries by path, so every launch would miss and leave
16+
// another copy behind. The backend inherits APPIMAGE, so this covers it too.
1317
try {
14-
const cacheRoot =
15-
// oxlint-disable-next-line t3code/no-global-process-runtime -- Loads before any Effect runtime.
16-
process.platform === "linux"
17-
? process.env.XDG_CACHE_HOME || NodePath.join(NodeOS.homedir(), ".cache")
18-
: NodeOS.tmpdir();
19-
NodeModule.enableCompileCache(NodePath.join(cacheRoot, "t3code", "compile-cache"));
18+
if (!process.env.APPIMAGE) {
19+
const cacheRoot =
20+
// oxlint-disable-next-line t3code/no-global-process-runtime -- Loads before any Effect runtime.
21+
process.platform === "linux"
22+
? process.env.XDG_CACHE_HOME || NodePath.join(NodeOS.homedir(), ".cache")
23+
: NodeOS.tmpdir();
24+
NodeModule.enableCompileCache(NodePath.join(cacheRoot, "t3code", "compile-cache"));
25+
}
2026
} catch {
2127
// The cache is only a speedup. Never let it stop the app from starting.
2228
}

‎knip.jsonc‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
"src/snapShot/GlobalShiftShortcutWorker.ts!",
3939
"src/snapShot/RegionSnapShotWorker.ts!",
4040
"src/snapShot/SnapShotAccessibilityWorker.ts!",
41+
"src/boot.ts!",
42+
"src/compileCache.ts!",
4143
"src/main.ts!",
4244
"src/preload.ts!",
4345
"src/preview-pick-preload.ts!",

0 commit comments

Comments
 (0)