diff --git a/bun.lockb b/bun.lockb index de1a3d2..9f74060 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/config/site.toml b/config/site.toml new file mode 100644 index 0000000..f8b225d --- /dev/null +++ b/config/site.toml @@ -0,0 +1,12 @@ +title = "davesmithhayes.com" + +[owner] +name = "Dave Smith-Hayes" +email = "me@davesmithhayes.com" + +[site] +description = "Personal website of Dave Smith-Hayes - a father, developer, and musician." +url = "https://davesmithhayes.com" +repo = "https://git.davesmithhayes.com/dsh/blog" +language = "en" +copyright = "All rights reserved, Dave Smith-Hayes" diff --git a/package.json b/package.json index 062425e..cec3596 100644 --- a/package.json +++ b/package.json @@ -5,11 +5,13 @@ }, "dependencies": { "@types/yaml-front-matter": "^4.1.3", + "feed": "^4.2.2", "highlight.js": "^11.10.0", "hono": "^4.4.13", "marked": "^13.0.2", "marked-highlight": "^2.1.3", "remark": "^15.0.1", + "smol-toml": "^1.3.0", "yaml-front-matter": "^4.1.1" }, "devDependencies": { diff --git a/src/config.ts b/src/config.ts index 8d62b5f..168469b 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,3 +1,4 @@ export const POST_PATH: string = __dirname + '/../posts'; +export const CONFIG_PATH: string = __dirname + '/../config'; export const STATIC_PATH: string = __dirname + '/assets'; export const POST_ROUTE_PREFIX: string = '/posts' diff --git a/src/services/config.test.ts b/src/services/config.test.ts new file mode 100644 index 0000000..2a76e1b --- /dev/null +++ b/src/services/config.test.ts @@ -0,0 +1,9 @@ +import { describe, expect, test } from 'bun:test' +import { getSiteConfig } from '@blog/services/config'; + +describe("Test the global config for the site", () => { + test("Parses the Owner", async () => { + const siteConfig = await getSiteConfig(); + expect(siteConfig.owner.email).toBe("me@davesmithhayes.com"); + }) +}) diff --git a/src/services/config.ts b/src/services/config.ts new file mode 100644 index 0000000..6065132 --- /dev/null +++ b/src/services/config.ts @@ -0,0 +1,10 @@ +import TOML from 'smol-toml'; +import { CONFIG_PATH } from '@blog/config'; + +export async function getSiteConfig() { + const siteConfig = CONFIG_PATH + '/site.toml'; + const file = Bun.file(siteConfig); + const data = await file.text(); + + return TOML.parse(data); +} diff --git a/src/services/feed-generator.ts b/src/services/feed-generator.ts new file mode 100644 index 0000000..47d0493 --- /dev/null +++ b/src/services/feed-generator.ts @@ -0,0 +1,14 @@ +// generate the feed +// + +import { Feed, FeedOptions } from 'feed'; + +export async function feedFactory(): Feed { + +} + +export async function generateFeed(posts: PostService, feed: Feed): Feed { + const feed = new Feed({}); + + return feed; +}