unisong reported in #1206 that tests under scripts/ fail on Windows on main. Reproduced on the Windows box at origin/main (bun test scripts): 23 pass, 8 fail. - opencode2.test.mjs took the packages folder from a file URL's pathname, "/C:/…", and join made it "\C:\…", so seven imports failed ("Cannot find module"). It is fileURLToPath now. - scripts/sync-proc.mjs had the same pathname root. proc.test.mjs imports it, so the whole file failed to load (the eighth red). - With it loading, proc.test.mjs showed five more on Windows: its fake readFile matched "/fake-proc/123/stat" while proc.mjs joins with the system's separator, and the kill(pid, 0) walk's skip list (written with "/") skipped nothing, so it walked test folders and passed its 5s bound. The fake now matches join()'s path, and the walk compares "/" paths. proc.mjs itself is unchanged: it reads /proc on Linux only. Only scripts/ changes; no package's files, so no version. Run: - win-run (Windows 11) bun test scripts: 39 pass, 0 fail (origin/main: 23 pass, 8 fail). - mica-run (macOS) bun test scripts: 39 pass; node scripts/sync-proc.mjs ok, and on Windows too. Not tried: Linux (CI runs it).
47 lines
1.5 KiB
JavaScript
47 lines
1.5 KiB
JavaScript
#!/usr/bin/env node
|
|
import { copyFileSync, mkdirSync, readFileSync } from "node:fs";
|
|
import { dirname, resolve } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const root = resolve(fileURLToPath(new URL("..", import.meta.url)));
|
|
const source = "scripts/proc.mjs";
|
|
export const procTargets = [
|
|
"packages/agent-console/lib/proc.mjs",
|
|
"packages/agent-office/lib/proc.mjs",
|
|
"packages/agy-cli/proc.mjs",
|
|
"packages/astudio/proc.mjs",
|
|
"packages/deepzora/proc.mjs",
|
|
"packages/gcp-ai/lib/proc.mjs",
|
|
"packages/gumloop/proc.mjs",
|
|
"packages/goanyapi/src/proc.mjs",
|
|
"packages/kimi-desktop/proc.mjs",
|
|
"packages/mclaw/proc.mjs",
|
|
"packages/nanobot/proc.mjs",
|
|
"packages/nowledge-mem-agent/lib/proc.mjs",
|
|
"packages/page-harnessweight/lib/proc.mjs",
|
|
"packages/reasonix-desktop/proc.mjs",
|
|
"packages/respire-memory/proc.mjs",
|
|
"packages/search1api/src/proc.mjs",
|
|
"packages/window-warmup/src/proc.mjs",
|
|
];
|
|
|
|
const check = process.argv.includes("--check");
|
|
const bytes = readFileSync(resolve(root, source));
|
|
for (const relative of procTargets) {
|
|
const target = resolve(root, relative);
|
|
if (check) {
|
|
try {
|
|
if (!readFileSync(target).equals(bytes)) {
|
|
console.error(`Out of sync: ${relative}`);
|
|
process.exitCode = 1;
|
|
}
|
|
} catch (error) {
|
|
console.error(`Missing sync target: ${relative} (${error?.code ?? error})`);
|
|
process.exitCode = 1;
|
|
}
|
|
continue;
|
|
}
|
|
mkdirSync(dirname(target), { recursive: true });
|
|
copyFileSync(resolve(root, source), target);
|
|
}
|