Remove unnecessary blocking generators

This commit is contained in:
Shadowfacts 2020-07-09 14:10:39 -04:00
parent 2a0f1ab773
commit f7dea0647f
Signed by: 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() { export default async function css() {
await generate("light"); generate("light");
await generate("dark"); generate("dark");
await generate("auto"); generate("auto");
if (process.env.NODE_ENV === "development") { if (process.env.NODE_ENV === "development") {
require("fs").watch("site/css/", css); require("fs").watch("site/css/", css);

View File

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

View File

@ -24,11 +24,17 @@ async function generateFeed(posts: Page[], permalink: string, category?: string)
util.write(dest, text); 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, "/"); generateFeed(posts, "/");
}
export async function categories(categories: Map<string, Page[]>) {
categories.forEach((posts, category) => { categories.forEach((posts, category) => {
generateFeed(posts, `/${category}/`, category); generateFeed(posts, `/${category}/`, category);
}); });
}
export async function tutorials(tutorials: TutorialSeries[]) {
tutorials.forEach(series => { tutorials.forEach(series => {
generateFeed(series.posts, `/tutorials/${series.series}/`, series.seriesName); generateFeed(series.posts, `/tutorials/${series.series}/`, series.seriesName);
}); });

View File

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