Refactor round: ship web/index.html, drop the remote browser, fix stale comments and README
- `.gitignore` said `index.html` unanchored, which also caught the Vite source page; a fresh clone could neither `dev` nor `build`. Anchored to `/index.html`, page added. - Removed GM_REMOTE (tools/remote/gm-browser.ps1 and the ssh/scp branch in browser.mjs): the Windows test machine is gone and the only flaky check that lived on it is closed (#37). - Removed `npm run preview`, undocumented and unused. - Comments: wrong number in collider.test.ts (250 → 200), the "declarations used to…" history in listItems.ts and friends, the 24 px/28 contradiction, section banners in nodes/index.ts, node-catalog.test.ts and api/index.php, name paraphrases, and the stale step numbers in tools/e2e/11-…23- from the old global count. - README: asset types include `animation`, kind order Number/Text/Boolean, tagged colour and texture items, 6/5 kinds, the `Texture` node, `./build.sh`, PROJECT_FORMAT_VERSION, and the file tree (kinds.ts, listItems.ts, propertyPorts.ts, Breadcrumb.ts, beads.ts, tools/assets/). - tests/helpers.ts takes the duplicated `findObject` and `sceneWithCamera`. Proof: ./check.sh 797 tests, full e2e ALL PASSED 633 checks against this bundle. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
d86a655a4d
commit
6471671f7d
44 files changed
+196
-445
No files matched your search
+10
-90
@@ -1,14 +1,4 @@
|
||||
/**
|
||||
* Launches the check browser locally, or with `GM_REMOTE=user@host` on another machine with the CDP port
|
||||
* forwarded over SSH, since this 8 GB host has little memory to spare.
|
||||
*/
|
||||
import { spawn, execFileSync } from 'node:child_process';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { homedir } from 'node:os';
|
||||
|
||||
const HERE = dirname(fileURLToPath(import.meta.url));
|
||||
const LAUNCHER = join(HERE, '..', 'remote', 'gm-browser.ps1');
|
||||
import { spawn } from 'node:child_process';
|
||||
|
||||
const FLAGS = [
|
||||
'--headless',
|
||||
@@ -29,89 +19,19 @@ const FLAGS = [
|
||||
'--mute-audio',
|
||||
];
|
||||
|
||||
function sshArgs(key) {
|
||||
return [
|
||||
'-i',
|
||||
key,
|
||||
'-o',
|
||||
'IdentitiesOnly=yes',
|
||||
'-o',
|
||||
'BatchMode=yes',
|
||||
'-o',
|
||||
'StrictHostKeyChecking=accept-new',
|
||||
'-o',
|
||||
'ConnectTimeout=15',
|
||||
// A dead peer must surface as a closed socket, not as a run that waits forever.
|
||||
'-o',
|
||||
'ServerAliveInterval=10',
|
||||
'-o',
|
||||
'ServerAliveCountMax=3',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the browser and returns its process plus a `stop()` that ends it the way that host
|
||||
* needs. `proc.stderr` carries the browser's own last words either way.
|
||||
*/
|
||||
/** Starts chromium with the CDP port open; `proc.stderr` carries its last words. */
|
||||
export function launchBrowser({ port, width, height }) {
|
||||
const remote = process.env.GM_REMOTE;
|
||||
if (!remote) {
|
||||
const proc = spawn(
|
||||
'chromium',
|
||||
// --no-sandbox: this container runs as root, where chromium refuses to start otherwise.
|
||||
[
|
||||
...FLAGS,
|
||||
'--no-sandbox',
|
||||
`--remote-debugging-port=${port}`,
|
||||
`--window-size=${width},${height}`,
|
||||
'about:blank',
|
||||
],
|
||||
{ stdio: ['ignore', 'ignore', 'pipe'] },
|
||||
);
|
||||
return { proc, stop: () => proc.kill('SIGTERM'), where: 'local chromium' };
|
||||
}
|
||||
|
||||
const key = process.env.GM_REMOTE_KEY ?? join(homedir(), '.ssh', 'gm-win.key');
|
||||
// Copied every run so the remote never runs a stale launcher.
|
||||
execFileSync('scp', [...sshArgs(key), LAUNCHER, `${remote}:gm-browser.ps1`], { stdio: 'pipe' });
|
||||
|
||||
const proc = spawn(
|
||||
'ssh',
|
||||
'chromium',
|
||||
// --no-sandbox: this container runs as root, where chromium refuses to start otherwise.
|
||||
[
|
||||
...sshArgs(key),
|
||||
'-o',
|
||||
'ExitOnForwardFailure=yes',
|
||||
'-L',
|
||||
`${port}:127.0.0.1:${port}`,
|
||||
remote,
|
||||
`powershell -NoProfile -ExecutionPolicy Bypass -File gm-browser.ps1 -Port ${port} -Size ${width},${height}`,
|
||||
...FLAGS,
|
||||
'--no-sandbox',
|
||||
`--remote-debugging-port=${port}`,
|
||||
`--window-size=${width},${height}`,
|
||||
'about:blank',
|
||||
],
|
||||
{ stdio: ['ignore', 'ignore', 'pipe'] },
|
||||
);
|
||||
|
||||
return {
|
||||
proc,
|
||||
/**
|
||||
* Ends the browser now rather than after the launcher's idle window. Kill only this pid: the host is
|
||||
* someone's desktop, and killing by name would close their browser.
|
||||
*/
|
||||
stop: () => {
|
||||
const pidFile = `$env:TEMP\\gm-browser-${port}.pid`;
|
||||
try {
|
||||
execFileSync(
|
||||
'ssh',
|
||||
[
|
||||
...sshArgs(key),
|
||||
remote,
|
||||
`powershell -NoProfile -Command "if (Test-Path ${pidFile}) { Stop-Process -Id (Get-Content ${pidFile}) -Force -ErrorAction SilentlyContinue }"`,
|
||||
],
|
||||
{ stdio: 'pipe', timeout: 20_000 },
|
||||
);
|
||||
} catch {
|
||||
// Unreachable host, denied, already gone: the idle window still collects it.
|
||||
}
|
||||
proc.kill('SIGTERM');
|
||||
},
|
||||
where: `remote browser on ${remote}`,
|
||||
};
|
||||
return { proc, stop: () => proc.kill('SIGTERM'), where: 'local chromium' };
|
||||
}
|
||||
Reference in new issue
Block a user