« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/upd8.js30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/upd8.js b/src/upd8.js
index 19c7f229..045bf139 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -397,11 +397,21 @@ async function main() {
       type: 'flag',
     },
 
+    'refresh-online-thumbs': {
+      help: `Downloads a fresh copy of the online file size cache, so changes there are immediately reflected`,
+      type: 'flag',
+    },
+
     'skip-file-sizes': {
       help: `Skips preloading file sizes for images and additional files, which will be left blank in the build`,
       type: 'flag',
     },
 
+    'refresh-online-file-sizes': {
+      help: `Downloads a fresh copy of the online file size cache, so changes there are immediately reflected`,
+      type: 'flag',
+    },
+
     'skip-media-validation': {
       help: `Skips checking and reporting missing and misplaced media files, which isn't necessary if you aren't adding or removing data or updating directories`,
       type: 'flag',
@@ -2030,10 +2040,12 @@ async function main() {
     let readError = null;
     let writeError = null;
 
-    try {
-      onlineThumbsCache = JSON.parse(await readFile(cacheFile));
-    } catch (caughtError) {
-      readError = caughtError;
+    if (!cliOptions['refresh-online-thumbs']) {
+      try {
+        onlineThumbsCache = JSON.parse(await readFile(cacheFile));
+      } catch (caughtError) {
+        readError = caughtError;
+      }
     }
 
     if (onlineThumbsCache) obliterateLocalCopy: {
@@ -2610,10 +2622,12 @@ async function main() {
     let readError = null;
     let writeError = null;
 
-    try {
-      onlineFileSizeCache = JSON.parse(await readFile(cacheFile));
-    } catch (caughtError) {
-      readError = caughtError;
+    if (!cliOptions['refresh-online-file-sizes']) {
+      try {
+        onlineFileSizeCache = JSON.parse(await readFile(cacheFile));
+      } catch (caughtError) {
+        readError = caughtError;
+      }
     }
 
     if (onlineFileSizeCache) obliterateLocalCopy: {