« get me outta code hell

upd8: move buildSearchIndex nearly to bottom - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-05-30 21:04:57 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-31 12:11:57 -0300
commit7931244d09168988d72f7b757773ded5d66ed956 (patch)
tree868d16c9264db76808ec1c633bc3ff143c04481b
parentaa3fa649b9ea8efb54de6cfb63fe7d5acbff8a03 (diff)
upd8: move buildSearchIndex nearly to bottom
-rwxr-xr-xsrc/upd8.js82
1 files changed, 41 insertions, 41 deletions
diff --git a/src/upd8.js b/src/upd8.js
index 3ac9dcc7..eecc7e53 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -1485,47 +1485,6 @@ async function main() {
 
   const urls = generateURLs(urlSpec);
 
-  if (stepStatusSummary.buildSearchIndex.status === STATUS_NOT_STARTED) {
-    Object.assign(stepStatusSummary.buildSearchIndex, {
-      status: STATUS_STARTED_NOT_DONE,
-      timeStart: Date.now(),
-    });
-
-    try {
-      await writeSearchData({
-        thumbsCache,
-        urls,
-        wikiCachePath,
-        wikiData,
-      });
-
-      logInfo`Search data successfully written - nice!`;
-      paragraph = false;
-
-      Object.assign(stepStatusSummary.buildSearchIndex, {
-        status: STATUS_DONE_CLEAN,
-        timeEnd: Date.now(),
-      });
-    } catch (error) {
-      if (!paragraph) console.log('');
-      niceShowAggregate(error);
-
-      logError`There was an error preparing or writing search data.`;
-      fileIssue();
-      logWarn`Any existing search data will be reused, and search may be`;
-      logWarn`generally dysfunctional. The site should work otherwise, though!`;
-
-      console.log('');
-      paragraph = true;
-
-      Object.assign(stepStatusSummary.buildSearchIndex, {
-        status: STATUS_HAS_WARNINGS,
-        annotation: `see log for details`,
-        timeEnd: Date.now(),
-      });
-    }
-  }
-
   // Filter out any things with duplicate directories throughout the data,
   // warning about them too.
 
@@ -2182,6 +2141,47 @@ async function main() {
     }
   }
 
+  if (stepStatusSummary.buildSearchIndex.status === STATUS_NOT_STARTED) {
+    Object.assign(stepStatusSummary.buildSearchIndex, {
+      status: STATUS_STARTED_NOT_DONE,
+      timeStart: Date.now(),
+    });
+
+    try {
+      await writeSearchData({
+        thumbsCache,
+        urls,
+        wikiCachePath,
+        wikiData,
+      });
+
+      logInfo`Search data successfully written - nice!`;
+      paragraph = false;
+
+      Object.assign(stepStatusSummary.buildSearchIndex, {
+        status: STATUS_DONE_CLEAN,
+        timeEnd: Date.now(),
+      });
+    } catch (error) {
+      if (!paragraph) console.log('');
+      niceShowAggregate(error);
+
+      logError`There was an error preparing or writing search data.`;
+      fileIssue();
+      logWarn`Any existing search data will be reused, and search may be`;
+      logWarn`generally dysfunctional. The site should work otherwise, though!`;
+
+      console.log('');
+      paragraph = true;
+
+      Object.assign(stepStatusSummary.buildSearchIndex, {
+        status: STATUS_HAS_WARNINGS,
+        annotation: `see log for details`,
+        timeEnd: Date.now(),
+      });
+    }
+  }
+
   let webRouteSources = null;
   let preparedWebRoutes = null;