1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-19 13:55:31 -04:00

a bit more cleanup

This commit is contained in:
2025-03-07 14:56:49 -05:00
parent 354dade9aa
commit 9229f92c0c
23 changed files with 50 additions and 58 deletions

View File

@@ -1,10 +1,10 @@
import { Feed } from "feed";
import { getAllPosts } from "./posts";
import config from "../config";
import config from "../config/constants";
import meJpg from "../../app/me.jpg";
export const buildFeed = async (options: { type: "rss" | "atom" | "json" }): Promise<string> => {
export const buildFeed = async (): Promise<Feed> => {
// https://github.com/jpmonette/feed#example
const feed = new Feed({
id: config.baseUrl,
@@ -43,15 +43,5 @@ export const buildFeed = async (options: { type: "rss" | "atom" | "json" }): Pro
});
});
if (options.type === "rss") {
return feed.rss2();
} else if (options.type === "atom") {
return feed.atom1();
} else if (options.type === "json") {
// rare but including as an option because why not...
// https://www.jsonfeed.org/
return feed.json1();
} else {
throw new TypeError(`Invalid feed type "${options.type}", must be "rss", "atom", or "json".`);
}
return feed;
};

View File

@@ -5,7 +5,7 @@ import dayjsRelativeTime from "dayjs/plugin/relativeTime";
import dayjsLocalizedFormat from "dayjs/plugin/localizedFormat";
import dayjsAdvancedFormat from "dayjs/plugin/advancedFormat";
import "dayjs/locale/en";
import config from "../config";
import config from "../config/constants";
const IsomorphicDayJs = (date?: dayjs.ConfigType): dayjs.Dayjs => {
// plugins

View File

@@ -3,7 +3,7 @@ import glob from "fast-glob";
import pMap from "p-map";
import pMemoize from "p-memoize";
import { formatDate } from "./format-date";
import config from "../config";
import config from "../config/constants";
// path to directory with .mdx files, relative to project root
const POSTS_DIR = "notes";