MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / checkChrome

Function checkChrome

packages/cli/src/browser/preflight.ts:156–206  ·  view source on GitHub ↗
(browserPath?: string)

Source from the content-addressed store, hash-verified

154}
155
156async function checkChrome(browserPath?: string): Promise<EnvironmentCheckOutcome> {
157 if (browserPath) {
158 if (existsSync(browserPath)) {
159 return chromeSharedLibOutcome(browserPath, {
160 name: "Chrome",
161 ok: true,
162 level: "ok",
163 detail: `explicit: ${browserPath}`,
164 path: browserPath,
165 });
166 }
167 return {
168 name: "Chrome",
169 ok: false,
170 level: "error",
171 title: "Chrome not found",
172 detail: `Chrome binary not found at "${browserPath}".`,
173 hint: "Run: npx hyperframes browser ensure",
174 };
175 }
176
177 // A corrupt/partial browser cache (stub files where a version dir is
178 // expected, missing executable, malformed metadata) makes findBrowser throw.
179 // That is the exact condition this check exists to report, so treat any
180 // failure as "Chrome not found" rather than letting it crash the caller
181 // (notably `doctor`, which is documented to exit 0 even when checks fail).
182 let info: Awaited<ReturnType<typeof findBrowser>>;
183 try {
184 info = await findBrowser();
185 } catch {
186 info = undefined;
187 }
188 if (info) {
189 return chromeSharedLibOutcome(info.executablePath, {
190 name: "Chrome",
191 ok: true,
192 level: "ok",
193 detail: `${info.source}: ${info.executablePath}`,
194 path: info.executablePath,
195 });
196 }
197
198 return {
199 name: "Chrome",
200 ok: false,
201 level: "error",
202 title: "Chrome not found",
203 detail: "Chrome Headless Shell is required for local rendering.",
204 hint: "Run: npx hyperframes browser ensure",
205 };
206}
207
208function checkDisk(projectDir = "."): EnvironmentCheckOutcome {
209 const freeMb = getFreeDiskMb(projectDir);

Callers 1

runEnvironmentChecksFunction · 0.85

Calls 2

chromeSharedLibOutcomeFunction · 0.85
findBrowserFunction · 0.85

Tested by

no test coverage detected