/**
* Draws the favicons and writes the manifest from {@link SITE_EMOJI} and
* {@link OG_SITE_NAME}, so changing them needs a restart and no rebuild.
* `deno task icons
` runs it before the server starts, into the directory
* the frontend is served from, relative to the working directory. That is
* dist/ for `start` and `serve`, and public/, which Vite serves, for `dev`.
* It does nothing when the directory doesn't exist.
*
* @module
*/
import { OG_SITE_NAME, SITE_EMOJI, THEME_COLOR } from "../config.ts";
import { generateSiteIcons } from "../lib/site-icons.ts";
const outDir = `${Deno.cwd()}/${Deno.args[0] ?? "dist"}`;
try {
await Deno.stat(outDir);
} catch {
console.log(`[icons] ${outDir} not found — skipping favicon generation.`);
Deno.exit(0);
}
await generateSiteIcons({
emoji: SITE_EMOJI,
outDir,
siteName: OG_SITE_NAME,
bgColor: THEME_COLOR,
});
console.log(`[icons] Generated favicons for "${SITE_EMOJI}" into ${outDir}`);