Add the site config type
This commit is contained in:
parent
c8b5f72657
commit
ab5a83202e
@ -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<SiteConfig> {
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user