import { chromium } from "playwright"; const base = process.env.BASE_URL || "http://127.0.0.1:4173"; const browser = await chromium.launch({ executablePath: process.env.PLAYWRIGHT_EXECUTABLE_PATH || (process.platform === "win32" ? "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe" : undefined), headless: true, }); try { const page = await browser.newPage(); for (const device of ["desktop", "mobile"]) for (const theme of ["light", "dark"]) { const width = device === "desktop" ? 640 : 300, height = device === "desktop" ? 570 : 780; await page.setViewportSize({ width: width * 3, height: (height + 35) * 2, }); await page.setContent( `${["relay", "ledger", "signal", "axis", "dock", "grid"].map((c) => `
${c.toUpperCase()} / ${theme} / ${device}
`).join("")}`, ); await page .locator("img") .evaluateAll((imgs) => Promise.all(imgs.map((i) => i.decode()))); await page.screenshot({ path: `references/concepts-${theme}-${device}.jpg`, type: "jpeg", quality: 90, }); } } finally { await browser.close(); }