// Renders the app icon to the PNG sizes browsers need to install the app. // Run after changing the icon: node scripts/generate-icons.mjs import { chromium } from '@playwright/test' const shield = (stroke) => ` ` // Regular icon: rounded tile. Maskable: full-bleed square with the mark inside the safe zone. const regular = `${shield(2.2)}` const maskable = `${shield(2.4)}` const outputs = [ ['public/icons/icon-192.png', regular, 192], ['public/icons/icon-512.png', regular, 512], ['public/icons/maskable-512.png', maskable, 512], ['public/icons/apple-touch-icon.png', maskable, 180], ] const browser = await chromium.launch() const page = await browser.newPage() for (const [path, svg, size] of outputs) { await page.setViewportSize({ width: size, height: size }) await page.setContent(``) await page.locator('img').screenshot({ path, omitBackground: true }) console.log('wrote', path) } await browser.close()