fix: update CI preload artifact name to .cjs and add freshness grace period for dev startup

- Update CI verification step to check preload.cjs instead of preload.js,
  matching the tsdown CJS output format.
- Add 10s grace period to bundle freshness check in dev-electron.mjs to
  avoid race condition when parallel processes write bundles before the
  script records its start time.

Applied via @cursor push command
This commit is contained in:
cursor[bot] authored and GitHub committed 2026-02-17 01:40:20 +00:00
commit 1478184dec
2 files changed
+4 -3

No files matched your search

+2 -2
View File
@@ -50,8 +50,8 @@ jobs:
- name: Verify preload bundle output
run: |
test -f apps/desktop/dist-electron/preload.js
grep -nE "desktopBridge|getWsUrl|PICK_FOLDER_CHANNEL|wsUrl" apps/desktop/dist-electron/preload.js
test -f apps/desktop/dist-electron/preload.cjs
grep -nE "desktopBridge|getWsUrl|PICK_FOLDER_CHANNEL|wsUrl" apps/desktop/dist-electron/preload.cjs
- name: Install desktop runtime deps (Linux)
if: runner.os == 'Linux'
+2 -1
View File
@@ -26,6 +26,7 @@ async function canConnect(host, probePort, timeoutMs = 1_000) {
}
function waitForDesktopBundles(timeoutMs) {
const FRESHNESS_GRACE_MS = 10_000;
const startedAt = Date.now();
const bundleFiles = [
{ path: "dist-electron/main.mjs", requireFresh: true },
@@ -48,7 +49,7 @@ function waitForDesktopBundles(timeoutMs) {
}
try {
const stat = fs.statSync(bundleFile.path);
if (stat.mtimeMs < startedAt) {
if (stat.mtimeMs < startedAt - FRESHNESS_GRACE_MS) {
stale.push(bundleFile.path);
}
} catch {