33 lines
974 B
TypeScript
33 lines
974 B
TypeScript
/**
|
|
* Generates the favicon set and manifest from the runtime `GERBEUR_SITE_EMOJI`.
|
|
* Runs before the server starts, so changing the emoji only requires a restart
|
|
* — no rebuild.
|
|
*
|
|
* The output directory is passed as the first argument (relative to cwd), and
|
|
* defaults to `dist`:
|
|
* - prod (`deno task start` / `serve`): `dist` — what the Oak server serves
|
|
* - dev (`deno task dev`): `public` — what the Vite server serves
|
|
*
|
|
* @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}`);
|