1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-19 05:15:34 -04:00

fs -> fs/promises -> asyncify all note parsing

This commit is contained in:
2022-04-26 17:22:44 -04:00
parent 36e0835947
commit a3870a15db
6 changed files with 31 additions and 21 deletions

View File

@@ -9,11 +9,10 @@ import type { ParsedUrlQuery } from "querystring";
// handles literally *everything* about building the server-side rss/atom feeds and writing the response.
// all the page needs to do is `return buildFeed(context, { format: "rss" })` from getServerSideProps.
export const buildFeed = (
export const buildFeed = async (
context: GetServerSidePropsContext<ParsedUrlQuery, PreviewData>,
options?: { type: "rss" | "atom" }
): { props: Record<string, unknown> } => {
): Promise<{ props: Record<string, unknown> }> => {
const { res } = context;
// https://github.com/jpmonette/feed#example
@@ -37,7 +36,7 @@ export const buildFeed = (
});
// add notes separately using their frontmatter
const notes = getAllNotes();
const notes = await getAllNotes();
notes.forEach((note) => {
feed.addItem({
guid: note.permalink,