From dbce40d19523d6e0f6b28d573b718fe8446ca663 Mon Sep 17 00:00:00 2001
From: "Jocelyn Badgley (Twipped)" <joc@twipped.com>
Date: Tue, 7 Apr 2020 10:31:52 -0700
Subject: [PATCH] Include rev manifest in posts output

---
 build/cache.js | 2 ++
 build/index.js | 9 ++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/build/cache.js b/build/cache.js
index 06e4682..c1af1a2 100644
--- a/build/cache.js
+++ b/build/cache.js
@@ -239,6 +239,8 @@ module.exports = exports = class Manifest {
       revManifest && fs.writeFile(resolve(REV_MANIFEST), JSON.stringify(revManifest, null, 2)),
       this.writeManifest(true),
     ]);
+
+    return { revManifest: revManifest || {}, manifest: this.manifest };
   }
 
 };
diff --git a/build/index.js b/build/index.js
index d963199..216864b 100644
--- a/build/index.js
+++ b/build/index.js
@@ -42,9 +42,11 @@ exports.everything = function (prod = false) {
 
 
     // prime tweet data for all pages
-    const pages = await primeTweets(PublicFiles.pages.filter((p) => !p.meta.ignore));
+    let pages = await primeTweets(PublicFiles.pages.filter((p) => !p.meta.ignore));
+    pages = pages.filter(Boolean);
 
     let posts = await primeTweets(PostFiles.pages.filter((p) => !p.meta.ignore));
+    posts = posts.filter(Boolean);
     posts = sortBy(posts, 'date');
     posts.reverse();
 
@@ -68,10 +70,11 @@ exports.everything = function (prod = false) {
     const cache = new Cache({ prod });
     await cache.load();
     await evaluate(tasks.flat(), cache);
-    await cache.save();
+    const { revManifest } = await cache.save();
 
     const engines = await getEngines(prod);
-    const postIndex = await pageWriter(engines, pages, posts, prod);
+    const postIndex = await pageWriter(prod, engines, pages, posts);
+    postIndex.rev = revManifest;
     await fs.writeFile(resolve('dist/tweets/index.json'), prod ? JSON.stringify(postIndex) : JSON.stringify(postIndex, null, 2));
   }