« 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')
-rw-r--r--src/data/composite/wiki-data/withResolvedContribs.js4
-rw-r--r--src/gen-thumbs.js25
-rwxr-xr-xsrc/upd8.js95
3 files changed, 90 insertions, 34 deletions
diff --git a/src/data/composite/wiki-data/withResolvedContribs.js b/src/data/composite/wiki-data/withResolvedContribs.js
index b4119604..fd3d8a0d 100644
--- a/src/data/composite/wiki-data/withResolvedContribs.js
+++ b/src/data/composite/wiki-data/withResolvedContribs.js
@@ -136,11 +136,11 @@ export default templateCompositeFrom({
 
     withPropertyFromList({
       list: '#contributions',
-      property: input.value('thing'),
+      property: input.value('artist'),
     }),
 
     withAvailabilityFilter({
-      from: '#contributions.thing',
+      from: '#contributions.artist',
     }),
 
     raiseResolvedReferenceList({
diff --git a/src/gen-thumbs.js b/src/gen-thumbs.js
index d08726c7..6c82761f 100644
--- a/src/gen-thumbs.js
+++ b/src/gen-thumbs.js
@@ -1264,11 +1264,28 @@ export function getExpectedImagePaths(mediaPath, {urls, wikiData}) {
 
   const paths = [
     wikiData.albumData
-      .flatMap(album => [
-        album.hasCoverArt && fromRoot.to('media.albumCover', album.directory, album.coverArtFileExtension),
-        !empty(CacheableObject.getUpdateValue(album, 'bannerArtistContribs')) && fromRoot.to('media.albumBanner', album.directory, album.bannerFileExtension),
-        !empty(CacheableObject.getUpdateValue(album, 'wallpaperArtistContribs')) && fromRoot.to('media.albumWallpaper', album.directory, album.wallpaperFileExtension),
+      .map(album => [
+        album.hasCoverArt && [
+          fromRoot.to('media.albumCover', album.directory, album.coverArtFileExtension),
+        ],
+
+        !empty(CacheableObject.getUpdateValue(album, 'bannerArtistContribs')) && [
+          fromRoot.to('media.albumBanner', album.directory, album.bannerFileExtension),
+        ],
+
+        !empty(CacheableObject.getUpdateValue(album, 'wallpaperArtistContribs')) &&
+        empty(album.wallpaperParts) && [
+          fromRoot.to('media.albumWallpaper', album.directory, album.wallpaperFileExtension),
+        ],
+
+        !empty(CacheableObject.getUpdateValue(album, 'wallpaperArtistContribs')) &&
+        !empty(album.wallpaperParts) &&
+          album.wallpaperParts.flatMap(part => [
+            part.asset &&
+              fromRoot.to('media.albumWallpaperPart', album.directory, part.asset),
+          ]),
       ])
+      .flat(2)
       .filter(Boolean),
 
     wikiData.artistData
diff --git a/src/upd8.js b/src/upd8.js
index 49c3217f..f4c6326a 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -323,11 +323,21 @@ async function main() {
       type: 'value',
     },
 
+    'skip-directory-validation': {
+      help: `Skips checking for duplicated directories, which speeds up the build but may cause the wiki to catch on fire`,
+      type: 'flag',
+    },
+
     'skip-reference-validation': {
       help: `Skips checking and reporting reference errors, which speeds up the build but may silently allow erroneous data to pass through`,
       type: 'flag',
     },
 
+    'skip-content-text-validation': {
+      help: `Skips checking and reporting content text errors, which speeds up the build but may silently allow misformatted or mislinked content to pass through`,
+      type: 'flag',
+    },
+
     // Thum8nail gener8tion is *usually* something you want, 8ut it can 8e
     // kinda a pain to run every time, since it does necessit8te reading
     // every media file at run time. Pass this to skip it.
@@ -651,9 +661,13 @@ async function main() {
       step.annotation = `--${cliFlag} provided`;
 
       if (cliFlagWarning) {
+        if (!paragraph) console.log('');
+
         for (const line of cliFlagWarning.split('\n')) {
           logWarn(line);
         }
+
+        paragraph = false;
       }
 
       for (const step of cliFlagDisablesSteps) {
@@ -732,6 +746,17 @@ async function main() {
       }
     };
 
+    fallbackStep('reportDirectoryErrors', {
+      default: 'perform',
+      cli: {
+        flag: 'skip-directory-validation',
+        negate: true,
+        warn:
+          `Skipping directory validation. If any directories are duplicated\n` +
+          `in data, the build will probably fail in unpredictable ways.`,
+      },
+    });
+
     fallbackStep('filterReferenceErrors', {
       default: 'perform',
       cli: {
@@ -740,7 +765,19 @@ async function main() {
         warn:
           `Skipping reference validation. If any reference errors are present\n` +
           `in data, they will be silently passed along to the build.`,
-      }
+      },
+    });
+
+    fallbackStep('reportContentTextErrors', {
+      default: 'perform',
+      cli: {
+        flag: 'skip-content-text-validation',
+        negate: true,
+        warn:
+          `Skipping content text validation. If any commentary or other content\n` +
+          `is misformatted or has bad links, it will be silently passed along\n` +
+          `to the build.`,
+      },
     });
 
     fallbackStep('generateThumbnails', {
@@ -1581,39 +1618,41 @@ async function main() {
   // Filter out any things with duplicate directories throughout the data,
   // warning about them too.
 
-  Object.assign(stepStatusSummary.reportDirectoryErrors, {
-    status: STATUS_STARTED_NOT_DONE,
-    timeStart: Date.now(),
-  });
-
-  try {
-    reportDirectoryErrors(wikiData, {getAllFindSpecs});
-    logInfo`No duplicate directories found - nice!`;
-    paragraph = false;
-
+  if (stepStatusSummary.reportDirectoryErrors.status === STATUS_NOT_STARTED) {
     Object.assign(stepStatusSummary.reportDirectoryErrors, {
-      status: STATUS_DONE_CLEAN,
-      timeEnd: Date.now(),
+      status: STATUS_STARTED_NOT_DONE,
+      timeStart: Date.now(),
     });
-  } catch (aggregate) {
-    if (!paragraph) console.log('');
-    niceShowAggregate(aggregate);
 
-    logWarn`The above duplicate directories were detected while reviewing data files.`;
-    logWarn`Since it's impossible to automatically determine which one's directory is`;
-    logWarn`correct, the build can't continue. Specify unique 'Directory' fields in`;
-    logWarn`some or all of these data entries to resolve the errors.`;
+    try {
+      reportDirectoryErrors(wikiData, {getAllFindSpecs});
+      logInfo`No duplicate directories found - nice!`;
+      paragraph = false;
+
+      Object.assign(stepStatusSummary.reportDirectoryErrors, {
+        status: STATUS_DONE_CLEAN,
+        timeEnd: Date.now(),
+      });
+    } catch (aggregate) {
+      if (!paragraph) console.log('');
+      niceShowAggregate(aggregate);
+
+      logWarn`The above duplicate directories were detected while reviewing data files.`;
+      logWarn`Since it's impossible to automatically determine which one's directory is`;
+      logWarn`correct, the build can't continue. Specify unique 'Directory' fields in`;
+      logWarn`some or all of these data entries to resolve the errors.`;
 
-    console.log('');
-    paragraph = true;
+      console.log('');
+      paragraph = true;
 
-    Object.assign(stepStatusSummary.reportDirectoryErrors, {
-      status: STATUS_FATAL_ERROR,
-      annotation: `duplicate directories found`,
-      timeEnd: Date.now(),
-    });
+      Object.assign(stepStatusSummary.reportDirectoryErrors, {
+        status: STATUS_FATAL_ERROR,
+        annotation: `duplicate directories found`,
+        timeEnd: Date.now(),
+      });
 
-    return false;
+      return false;
+    }
   }
 
   // Filter out any reference errors throughout the data, warning about them