Something went wrong. Try again.
fork of prime agent with changes i want but are not upstreamable probqbly (and some fixes)
Something went wrong. Try again.
1.1 kB · 36 lines
JavaScript
12345678910111213141516171819202122232425262728293031323334353637import { writeFileSync } from "node:fs";import { tmpdir } from "node:os";import { join } from "node:path";import { build } from "esbuild";
const outputPath = join(tmpdir(), "pi-browser-smoke.js");const errorLogPath = join(tmpdir(), "pi-browser-smoke-errors.log");
try { await build({ entryPoints: ["scripts/browser-smoke-entry.ts"], bundle: true, platform: "browser", format: "esm", logLevel: "silent", outfile: outputPath, }); process.exit(0);} catch (error) { let detailedErrors = ""; if (error && typeof error === "object" && "errors" in error && Array.isArray(error.errors)) { detailedErrors = error.errors .map((entry) => { const location = entry.location ? `${entry.location.file}:${entry.location.line}:${entry.location.column}` : ""; return [location, entry.text].filter(Boolean).join(" "); }) .join("\n"); }
const baseError = error instanceof Error ? (error.stack ?? error.message) : String(error); writeFileSync(errorLogPath, [detailedErrors, baseError].filter(Boolean).join("\n\n"), "utf-8"); console.error(`Browser smoke check failed. See ${errorLogPath}`); process.exit(1);}