feat: add AgendaMax PWA metadata and icons
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { chromium } from "playwright";
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const svg = await fs.readFile(path.join(root, "public", "favicon.svg"), "utf8");
|
||||
const svgDataUrl = `data:image/svg+xml;base64,${Buffer.from(svg).toString("base64")}`;
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
|
||||
try {
|
||||
for (const size of [192, 512]) {
|
||||
const page = await browser.newPage({ viewport: { width: size, height: size }, deviceScaleFactor: 1 });
|
||||
await page.setContent(`<!doctype html><style>html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#fff}img{display:block;width:100%;height:100%}</style><img src="${svgDataUrl}" alt="">`);
|
||||
await page.screenshot({ path: path.join(root, "public", `icon-${size}.png`), type: "png" });
|
||||
await page.close();
|
||||
}
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
Reference in New Issue
Block a user