aboutsummaryrefslogtreecommitdiffstats
path: root/src/server/build.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/build.ts')
-rw-r--r--src/server/build.ts31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/server/build.ts b/src/server/build.ts
new file mode 100644
index 0000000..d6ed1ab
--- /dev/null
+++ b/src/server/build.ts
@@ -0,0 +1,31 @@
+import { posts } from "./template/Post.js"
+import { pages } from "./template/Base.js"
+
+const postMod = [
+]
+
+const pageMod = [
+ ...postMod,
+ "./content/about.js",
+ "./content/index.js"
+]
+
+const routes = [
+ ...pageMod,
+ "./content/webmanifest.js",
+ "./content/robots.js",
+ "./content/blog.js",
+ "./content/sitemap.js",
+ "./content/feed.js",
+]
+
+function datecmp(a: { date_mod?: Date| undefined }, b: { date_mod?: Date | undefined }): number {
+ return (a.date_mod ?? new Date()).valueOf() - (b.date_mod ?? new Date()).valueOf()
+}
+
+await Promise.all(postMod.map(mod => import(mod)))
+posts.sort(datecmp).reverse()
+await Promise.all(pageMod.map(mod => import(mod)))
+pages.sort(datecmp).reverse()
+await Promise.all(routes.map(mod => import(mod)))
+