From 57315c52be96d2a2c013f0cfb0de5429980e301a Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 2 Nov 2025 17:49:34 +0900 Subject: refactor(blog): rename directory, services/{blog => nuldoc}/ --- services/blog/nuldoc-src/config.ts | 41 -------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 services/blog/nuldoc-src/config.ts (limited to 'services/blog/nuldoc-src/config.ts') diff --git a/services/blog/nuldoc-src/config.ts b/services/blog/nuldoc-src/config.ts deleted file mode 100644 index adcb563..0000000 --- a/services/blog/nuldoc-src/config.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { join } from "@std/path"; -import { parse as parseToml } from "@std/toml"; -import { z } from "zod/mod.ts"; - -const ConfigSchema = z.object({ - locations: z.object({ - contentDir: z.string(), - destDir: z.string(), - staticDir: z.string(), - }), - rendering: z.object({ - html: z.object({ - indentWidth: z.number(), - }), - }), - blog: z.object({ - author: z.string(), - fqdn: z.string(), - siteName: z.string(), - siteCopyrightYear: z.number(), - postsPerPage: z.number().default(10), - tagLabels: z.record(z.string(), z.string()), - }), -}); - -export type Config = z.infer; - -export function getTagLabel(c: Config, slug: string): string { - if (!(slug in c.blog.tagLabels)) { - throw new Error(`Unknown tag: ${slug}`); - } - return c.blog.tagLabels[slug]; -} - -export function getDefaultConfigPath(): string { - return join(Deno.cwd(), "nuldoc.toml"); -} - -export async function loadConfig(filePath: string): Promise { - return ConfigSchema.parse(parseToml(await Deno.readTextFile(filePath))); -} -- cgit v1.2.3-70-g09d2