// Auteur : Simon-Pierre Boucher — contact@spboucher.ai // ka-ui/gen-logos-512.mjs — rend chaque assets//favicon.svg en logo-512.png // (512×512, fond transparent) pour les apps natives iOS/Android/macOS. // Usage : node gen-logos-512.mjs import { chromium } from "playwright"; import { readFileSync, readdirSync, existsSync } from "fs"; import { dirname, join } from "path"; import { fileURLToPath } from "url"; const here = dirname(fileURLToPath(import.meta.url)); const assets = join(here, "assets"); const browser = await chromium.launch(); const page = await browser.newPage({ viewport: { width: 512, height: 512 } }); for (const id of readdirSync(assets)) { const svgPath = join(assets, id, "favicon.svg"); if (!existsSync(svgPath)) continue; const svg = readFileSync(svgPath, "utf8").replace( 'width="64" height="64"', 'width="512" height="512"', ); await page.setContent(`${svg}`); await page.screenshot({ path: join(assets, id, "logo-512.png"), omitBackground: true }); console.log("✓", id); } await browser.close();