mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 23:00:03 +00:00
fix(cli,engine): close review gaps in Chrome resolution fix
Address PR #2082 review feedback: - Route studio thumbnail + render call sites through preferManagedChrome so studio renders no longer silently fall back to whatever system Chrome happens to be installed. - `hyperframes browser ensure` now resolves through the same preferManagedChrome path render uses, so it reports what render will actually pick instead of any system Chrome it happens to find. - Point the unsupported-Chrome fallback log at `browser ensure --force` instead of `doctor`, which doesn't check Chrome/drawElement capability. - Fix stale findFromCache comment: the HF pin is now a Dev-channel build that can be newer than a user's puppeteer-cache Stable install.
This commit is contained in:
@@ -63,24 +63,38 @@ async function runEnsure(options?: { force?: boolean }): Promise<void> {
|
||||
|
||||
const s = clack.spinner();
|
||||
if (!options?.force) {
|
||||
// Resolve with `preferManagedChrome` so this reports what `render`
|
||||
// actually uses — a system Chrome without our pinned HF cache still
|
||||
// downloads on the next render, so it shouldn't be reported as "found".
|
||||
s.start("Looking for an existing browser...");
|
||||
|
||||
const existing = await findBrowser();
|
||||
if (existing) {
|
||||
s.stop(c.success("Browser found"));
|
||||
console.log();
|
||||
console.log(` ${c.dim("Source:")} ${c.bold(existing.source)}`);
|
||||
console.log(` ${c.dim("Path:")} ${c.bold(existing.executablePath)}`);
|
||||
console.log();
|
||||
clack.outro(c.success("Ready to render."));
|
||||
return;
|
||||
}
|
||||
let lastPct = -1;
|
||||
const existing = await ensureBrowser({
|
||||
preferManagedChrome: true,
|
||||
onProgress: (downloaded, total) => {
|
||||
if (total <= 0) return;
|
||||
const pct = Math.floor((downloaded / total) * 100);
|
||||
if (pct > lastPct) {
|
||||
lastPct = pct;
|
||||
s.message(
|
||||
`Downloading Chrome Headless Shell ${c.dim("v" + CHROME_VERSION)} — ${c.progress(pct + "%")} ${c.dim("(" + formatBytes(downloaded) + " / " + formatBytes(total) + ")")}`,
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
s.stop("No browser found — downloading");
|
||||
} else {
|
||||
s.start("Purging cached download and re-downloading...");
|
||||
if (existing.source === "download") trackBrowserInstall();
|
||||
s.stop(c.success(existing.source === "download" ? "Download complete" : "Browser found"));
|
||||
console.log();
|
||||
console.log(` ${c.dim("Source:")} ${c.bold(existing.source)}`);
|
||||
console.log(` ${c.dim("Path:")} ${c.bold(existing.executablePath)}`);
|
||||
console.log();
|
||||
clack.outro(c.success("Ready to render."));
|
||||
return;
|
||||
}
|
||||
|
||||
s.start("Purging cached download and re-downloading...");
|
||||
|
||||
const downloadSpinner = clack.spinner();
|
||||
downloadSpinner.start(`Downloading Chrome Headless Shell ${c.dim("v" + CHROME_VERSION)}...`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user