this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 39 lines 1.7 kB view raw
1import sharp from "npm:sharp@0.34.5"; 2import { Buffer } from "node:buffer"; 3import { readFile, writeFile } from "node:fs/promises"; 4import { dirname, join } from "node:path"; 5import { fileURLToPath } from "node:url"; 6 7const root = join(dirname(fileURLToPath(import.meta.url)), ".."); 8 9const ogSvg = await readFile(join(root, "static/og-hero.svg")); 10const ogPng = await sharp(ogSvg).png().resize(1200, 630).toBuffer(); 11await writeFile(join(root, "static/og-hero.png"), ogPng); 12console.log("Wrote static/og-hero.png", ogPng.length, "bytes"); 13 14const exploreOgSvg = await readFile(join(root, "static/og-explore.svg")); 15const exploreOgPng = await sharp(exploreOgSvg).png().resize(1200, 630) 16 .toBuffer(); 17await writeFile(join(root, "static/og-explore.png"), exploreOgPng); 18console.log("Wrote static/og-explore.png", exploreOgPng.length, "bytes"); 19 20const developerOgSvg = await readFile(join(root, "static/og-developer.svg")); 21const developerOgPng = await sharp(developerOgSvg).png().resize(1200, 630) 22 .toBuffer(); 23await writeFile(join(root, "static/og-developer.png"), developerOgPng); 24console.log("Wrote static/og-developer.png", developerOgPng.length, "bytes"); 25 26const unionSvg = await readFile(join(root, "static/union.svg")); 27const bg = { r: 0, g: 0, b: 0, alpha: 0 }; 28const icon32 = await sharp(unionSvg).resize(32, 32, { 29 fit: "contain", 30 background: bg, 31}).png().toBuffer(); 32const icon16 = await sharp(unionSvg).resize(16, 16, { 33 fit: "contain", 34 background: bg, 35}).png().toBuffer(); 36const pngToIco = (await import("npm:png-to-ico@3.0.1")).default; 37const ico = await pngToIco([icon16, icon32]); 38await writeFile(join(root, "static/favicon.ico"), Buffer.from(ico)); 39console.log("Wrote static/favicon.ico");