« get me outta code hell

upd8, write: cleaner buildConfig step fallback logic - 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-03-26 16:50:40 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-01 20:00:45 -0300
commitc3d3d65145105c15b1cfa69c927067de48a37862 (patch)
treebdd27fddebcc334608c5a467318e50005f414c51
parentb2ed2806528adbccb1cff4380516460766549dee (diff)
upd8, write: cleaner buildConfig step fallback logic
-rwxr-xr-xsrc/upd8.js25
-rw-r--r--src/write/build-modes/live-dev-server.js8
-rw-r--r--src/write/build-modes/repl.js2
-rw-r--r--src/write/build-modes/static-build.js6
4 files changed, 29 insertions, 12 deletions
diff --git a/src/upd8.js b/src/upd8.js
index f955e5f3..96a1e9e8 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -551,18 +551,29 @@ async function main() {
           logWarn`Redundant option ${cliPart}`;
         }
       } else {
-        if (cliFlagNegates) {
-          step.status = STATUS_NOT_APPLICABLE;
-          step.annotation = `--${cliFlag} provided`;
-        }
+        step.status =
+          (cliFlagNegates
+            ? STATUS_NOT_APPLICABLE
+            : STATUS_NOT_STARTED);
+
+        step.annotation = `--${cliFlag} provided`;
+
         if (cliFlagWarning) {
           for (const line of cliFlagWarning.split('\n')) {
             logWarn(line);
           }
         }
+
+        return;
       }
     }
 
+    if (buildConfig?.required === true) {
+      step.status = STATUS_NOT_STARTED;
+      step.annotation = `required for --${selectedBuildModeFlag}`;
+      return;
+    }
+
     if (buildConfig?.applicable === false) {
       step.status = STATUS_NOT_APPLICABLE;
       step.annotation = `N/A for --${selectedBuildModeFlag}`;
@@ -575,6 +586,12 @@ async function main() {
       return;
     }
 
+    if (buildConfig?.default === 'perform') {
+      step.status = STATUS_NOT_STARTED;
+      step.annotation = `default for --${selectedBuildModeFlag}`;
+      return;
+    }
+
     switch (defaultValue) {
       case 'skip':
         step.status = STATUS_NOT_APPLICABLE;
diff --git a/src/write/build-modes/live-dev-server.js b/src/write/build-modes/live-dev-server.js
index 24e18320..b2c3b73d 100644
--- a/src/write/build-modes/live-dev-server.js
+++ b/src/write/build-modes/live-dev-server.js
@@ -27,19 +27,19 @@ export const description = `Hosts a local HTTP server which generates page conte
 
 export const config = {
   fileSizes: {
-    default: true,
+    default: 'perform',
   },
 
   languageReloading: {
-    default: true,
+    default: 'perform',
   },
 
   mediaValidation: {
-    default: true,
+    default: 'perform',
   },
 
   thumbs: {
-    default: true,
+    default: 'perform',
   },
 };
 
diff --git a/src/write/build-modes/repl.js b/src/write/build-modes/repl.js
index 20985595..b300e8e8 100644
--- a/src/write/build-modes/repl.js
+++ b/src/write/build-modes/repl.js
@@ -6,7 +6,7 @@ export const config = {
   },
 
   languageReloading: {
-    default: true,
+    default: 'perform',
   },
 
   mediaValidation: {
diff --git a/src/write/build-modes/static-build.js b/src/write/build-modes/static-build.js
index a355a002..679d39d8 100644
--- a/src/write/build-modes/static-build.js
+++ b/src/write/build-modes/static-build.js
@@ -38,7 +38,7 @@ export const description = `Generates all page content in one build (according t
 
 export const config = {
   fileSizes: {
-    default: true,
+    default: 'perform',
   },
 
   languageReloading: {
@@ -46,11 +46,11 @@ export const config = {
   },
 
   mediaValidation: {
-    default: true,
+    default: 'perform',
   },
 
   thumbs: {
-    default: true,
+    default: 'perform',
   },
 };