Remove unnecessary blocking generators

This commit is contained in:
Shadowfacts 2020-07-09 14:10:39 -04:00
parent 2a0f1ab773
commit f7dea0647f
Signed by untrusted user: shadowfacts
GPG Key ID: 94A5AB95422746E5
4 changed files with 15 additions and 9 deletions

View File

@ -30,9 +30,9 @@ async function generate(theme: string) {
}
export default async function css() {
await generate("light");
await generate("dark");
await generate("auto");
generate("light");
generate("dark");
generate("auto");
if (process.env.NODE_ENV === "development") {
require("fs").watch("site/css/", css);

View File

@ -4,7 +4,7 @@ import css from "./css";
import errors from "./errors";
import homepage from "./homepage";
import posts from "./posts";
import rss from "./rss";
import * as rss from "./rss";
import tutorials from "./tutorials";
import years from "./years";

View File

@ -24,12 +24,18 @@ async function generateFeed(posts: Page[], permalink: string, category?: string)
util.write(dest, text);
}
export default async function rss(posts: Page[], categories: Map<string, Page[]>, tutorials: TutorialSeries[]) {
export async function posts(posts: Page[]) {
generateFeed(posts, "/");
}
export async function categories(categories: Map<string, Page[]>) {
categories.forEach((posts, category) => {
generateFeed(posts, `/${category}/`, category);
});
}
export async function tutorials(tutorials: TutorialSeries[]) {
tutorials.forEach(series => {
generateFeed(series.posts, `/tutorials/${series.series}/`, series.seriesName);
});
}
}

View File

@ -16,13 +16,13 @@ async function generate(): Promise<Page[]> {
generators.css();
generators.errors();
const tutorials = await generators.tutorials();
generators.tutorials().then(generators.rss.tutorials);
const posts = await generators.posts();
generators.homepage(posts);
generators.years(posts);
const categories = await generators.categories(posts);
await generators.rss(posts, categories, tutorials);
generators.rss.posts(posts)
generators.categories(posts).then(generators.rss.categories);
return posts;
}