aboutsummaryrefslogtreecommitdiffhomepage
path: root/services/nuldoc/nuldoc-src/config.ts
diff options
context:
space:
mode:
Diffstat (limited to 'services/nuldoc/nuldoc-src/config.ts')
-rw-r--r--services/nuldoc/nuldoc-src/config.ts52
1 files changed, 0 insertions, 52 deletions
diff --git a/services/nuldoc/nuldoc-src/config.ts b/services/nuldoc/nuldoc-src/config.ts
deleted file mode 100644
index 267a8f99..00000000
--- a/services/nuldoc/nuldoc-src/config.ts
+++ /dev/null
@@ -1,52 +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(),
- }),
- site: z.object({
- author: z.string(),
- copyrightYear: z.number(),
- }),
- sites: z.object({
- default: z.object({
- fqdn: z.string(),
- siteName: z.string(),
- }),
- about: z.object({
- fqdn: z.string(),
- siteName: z.string(),
- }),
- blog: z.object({
- fqdn: z.string(),
- siteName: z.string(),
- postsPerPage: z.number(),
- }),
- slides: z.object({
- fqdn: z.string(),
- siteName: z.string(),
- }),
- }),
- tagLabels: z.record(z.string(), z.string()),
-});
-
-export type Config = z.infer<typeof ConfigSchema>;
-
-export function getTagLabel(c: Config, slug: string): string {
- if (!(slug in c.tagLabels)) {
- throw new Error(`Unknown tag: ${slug}`);
- }
- return c.tagLabels[slug];
-}
-
-export function getDefaultConfigPath(): string {
- return join(Deno.cwd(), "nuldoc.toml");
-}
-
-export async function loadConfig(filePath: string): Promise<Config> {
- return ConfigSchema.parse(parseToml(await Deno.readTextFile(filePath)));
-}