From ab5a83202ef41f4a6aefe95cce2b65dc9b368271 Mon Sep 17 00:00:00 2001 From: Dave Smith-Hayes Date: Tue, 22 Oct 2024 20:50:47 -0400 Subject: [PATCH] Add the site config type --- src/services/config.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/services/config.ts b/src/services/config.ts index 6065132..e531069 100644 --- a/src/services/config.ts +++ b/src/services/config.ts @@ -1,10 +1,24 @@ import TOML from 'smol-toml'; import { CONFIG_PATH } from '@blog/config'; -export async function getSiteConfig() { +export type SiteConfig = { + title: string; + owner: { + name: string; + email: string; + }; + site: { + description: string; + url: string; + repo: string; + language: string; + copyright: string; + } +} + +export async function getSiteConfig(): Promise { const siteConfig = CONFIG_PATH + '/site.toml'; const file = Bun.file(siteConfig); const data = await file.text(); - - return TOML.parse(data); + return TOML.parse(data) as SiteConfig; }