import { readFile } from 'node:fs/promises' import path from 'node:path' import { chromium } from '@playwright/test' const root = path.resolve(import.meta.dirname, '..') const source = await readFile(path.join(root, 'public/app-icon.svg'), 'utf8') const browser = await chromium.launch({ headless: true }) try { for (const [file, size] of [['apple-touch-icon.png', 180], ['pwa-192.png', 192], ['pwa-512.png', 512]]) { const page = await browser.newPage({ viewport: { width: size, height: size }, deviceScaleFactor: 1 }) await page.setContent(`${source}`) await page.screenshot({ path: path.join(root, 'public', file), omitBackground: false }) await page.close() } } finally { await browser.close() }