« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/upd8.js26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/upd8.js b/src/upd8.js
index 5515f5d7..c7fe0ca5 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -150,6 +150,9 @@ async function main() {
     initializeDefaultLanguage:
       {...defaultStepStatus, name: `initialize default language`},
 
+    verifyImagePaths:
+      {...defaultStepStatus, name: `verify missing/misplaced image paths`},
+
     preloadFileSizes:
       {...defaultStepStatus, name: `preload file sizes`},
 
@@ -970,9 +973,30 @@ async function main() {
 
   const urls = generateURLs(urlSpec);
 
-  const {missing: missingImagePaths} =
+  stepStatusSummary.verifyImagePaths.status = STATUS_STARTED_NOT_DONE;
+
+  const {missing: missingImagePaths, misplaced: misplacedImagePaths} =
     await verifyImagePaths(mediaPath, {urls, wikiData});
 
+  if (empty(missingImagePaths) && empty(misplacedImagePaths)) {
+    stepStatusSummary.verifyImagePaths.status = STATUS_DONE_CLEAN;
+  } else if (empty(missingImagePaths)) {
+    Object.assign(stepStatusSummary.verifyImagePaths, {
+      status: STATUS_HAS_WARNINGS,
+      annotation: `misplaced images detected`,
+    });
+  } else if (empty(misplacedImagePaths)) {
+    Object.assign(stepStatusSummary.verifyImagePaths, {
+      status: STATUS_HAS_WARNINGS,
+      annotation: `missing images detected`,
+    });
+  } else {
+    Object.assign(stepStatusSummary.verifyImagePaths, {
+      status :STATUS_HAS_WARNINGS,
+      annotation: `missing and misplaced images detected`,
+    });
+  }
+
   const fileSizePreloader = new FileSizePreloader();
 
   // File sizes of additional files need to be precalculated before we can