aboutsummaryrefslogtreecommitdiff
path: root/index.js
diff options
context:
space:
mode:
authorFuwn <[email protected]>2020-11-06 18:24:26 -0800
committerFuwn <[email protected]>2020-11-06 18:24:26 -0800
commit9cdce4254700691301608c6f1d3081950023cc4f (patch)
tree9d24529acc19b354f80cb2d610aa1e7686f4d530 /index.js
downloadblog-9cdce4254700691301608c6f1d3081950023cc4f.tar.xz
blog-9cdce4254700691301608c6f1d3081950023cc4f.zip
repo: initial :star:
Diffstat (limited to 'index.js')
-rw-r--r--index.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..1265c75
--- /dev/null
+++ b/index.js
@@ -0,0 +1,42 @@
+const glob = require("glob");
+const generateTags = require("./generate-tags.js");
+const loadArticle = require("./load-article.js");
+const saveArticle = require("./save-article.js");
+const saveIndex = require("./save-index.js");
+const saveStaticFile = require("./save-static-file.js");
+const save32x32 = require("./save-32x32.js");
+
+glob("articles/*.md", (err, articles) => {
+ if (err) { throw err; }
+
+ Promise.all(articles.map(loadArticle))
+ .then(articles => {
+ const promises = articles.map(saveArticle);
+
+ promises.push(saveIndex(articles, "output/index.html"));
+ promises.push(generateTags(articles));
+
+ return Promise.all(promises);
+ })
+ .then(
+ () => console.log("Articles built."),
+ err => {
+ console.log("Error building articles.");
+ console.log(err);
+ }
+ );
+});
+
+glob("public/**/*.*", (err, staticFiles) => {
+ if (err) { throw err; }
+
+ Promise.all(staticFiles.map(saveStaticFile))
+ //.then(save32x32)
+ .then(
+ () => console.log("Static files built."),
+ err => {
+ console.log("Error saving static files.");
+ console.log(err);
+ }
+ );
+});