Files
hyperframes/packages/cli/scripts/pin-chrome.ts
T
James RussoandClaude Fable 5.2 bf26dcbaab build(chrome): pin chrome-headless-shell 158.0.8127.88 wherever the repo installs it (#8748)
Chrome Stable moved to 158.0.8127.88. The managed shell, the render,
test, Cloud Run, Lambda and example images and the CI setup action move
with it, each with the archive or folder digest of the new build.

Signed: Rames Jusso

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 19:29:45 +00:00

46 lines
1.8 KiB
TypeScript

// Prints PINNED_SHELL_DIGESTS for packages/engine/src/services/chromeHostCeiling.ts: each pinned build's headless
// shell, downloaded from Chrome for Testing with the installer the CLI uses, digested as the CLI checks it.
//
// bun run --cwd packages/cli pin:chrome 158.0.8127.88 150.0.7871.124
import { mkdtempSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { dirname, join } from "node:path";
import { Browser, BrowserPlatform, install } from "@puppeteer/browsers";
import { headlessShellDigest, managedChromeVersion } from "@hyperframes/engine/chrome-host-ceiling";
const PLATFORMS = [
BrowserPlatform.MAC_ARM,
BrowserPlatform.MAC,
BrowserPlatform.LINUX,
BrowserPlatform.WIN32,
BrowserPlatform.WIN64,
];
const builds = process.argv.slice(2);
if (builds.length === 0) throw new Error("Name the builds to pin.");
const digests: Record<string, string[]> = {};
for (const buildId of builds) {
digests[buildId] = [];
for (const platform of PLATFORMS) {
// Only macOS 12 is ever given a build other than the current one (managedChromeVersion).
if (buildId !== managedChromeVersion("linux") && !platform.startsWith("mac")) continue;
const cacheDir = mkdtempSync(join(tmpdir(), "hf-pin-chrome-"));
try {
const { executablePath } = await install({
browser: Browser.CHROMEHEADLESSSHELL,
buildId,
platform,
cacheDir,
});
const digest = headlessShellDigest(dirname(executablePath));
if (!digest) throw new Error(`${buildId} ${platform}: the unpacked folder holds a link`);
console.error(`${buildId} ${platform} ${digest}`);
digests[buildId].push(digest);
} finally {
rmSync(cacheDir, { recursive: true, force: true });
}
}
}
console.log(JSON.stringify(digests, null, 2));