All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 41s
28 lines
973 B
TypeScript
28 lines
973 B
TypeScript
// Generates the favicon set + 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):
|
|
// - prod (`deno task start` / `serve`): `dist` — what the Oak server serves
|
|
// - dev (`deno task dev`): `public` — what the Vite server serves
|
|
// Defaults to `dist` when omitted.
|
|
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}`);
|