« get me outta code hell

update old wikiInfo.features.X style accesses - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-02-16 22:31:36 -0400
committer(quasar) nebula <qznebula@protonmail.com>2022-02-16 22:31:36 -0400
commitebfd6037093b7bb28418b3f56b888df2f95692a3 (patch)
treeb274813359a45b0a2d06d4481176348107bd1330 /src
parentb3695dbb8cfdd819a82c6d0eed32b5f94a0c1e51 (diff)
update old wikiInfo.features.X style accesses
Diffstat (limited to 'src')
-rw-r--r--src/data/things.js2
-rw-r--r--src/listing-spec.js26
-rw-r--r--src/misc-templates.js2
-rw-r--r--src/page/artist.js10
-rw-r--r--src/page/flash.js2
-rw-r--r--src/page/group.js8
-rw-r--r--src/page/homepage.js8
-rw-r--r--src/page/listing.js2
-rw-r--r--src/page/news.js2
-rw-r--r--src/page/tag.js4
-rw-r--r--src/page/track.js4
-rwxr-xr-xsrc/upd8.js13
12 files changed, 41 insertions, 42 deletions
diff --git a/src/data/things.js b/src/data/things.js
index 88110a02..7151c507 100644
--- a/src/data/things.js
+++ b/src/data/things.js
@@ -793,7 +793,7 @@ FlashAct.propertyDescriptors = {
     flashesByRef: Thing.common.referenceList(Flash),
 };
 
-// WikiInfo
+// -> WikiInfo
 
 WikiInfo.propertyDescriptors = {
     // Update & expose
diff --git a/src/listing-spec.js b/src/listing-spec.js
index c5b9429e..2a1268d5 100644
--- a/src/listing-spec.js
+++ b/src/listing-spec.js
@@ -157,7 +157,7 @@ const listingSpec = [
                             artist.albums.asCoverArtist.length +
                             artist.albums.asWallpaperArtist.length +
                             artist.albums.asBannerArtist.length +
-                            (wikiData.wikiInfo.features.flashesAndGames
+                            (wikiData.wikiInfo.enableFlashesAndGames
                                 ? artist.flashes.asContributor.length
                                 : 0)
                         )
@@ -168,7 +168,7 @@ const listingSpec = [
                 // This is a kinda naughty hack, 8ut like, it's the only place
                 // we'd 8e passing wikiData to html() otherwise, so like....
                 // (Ok we do do this again once later.)
-                showAsFlashes: wikiData.wikiInfo.features.flashesAndGames
+                showAsFlashes: wikiData.wikiInfo.enableFlashesAndGames
             };
         },
 
@@ -289,7 +289,7 @@ const listingSpec = [
                 // (Ok we did it again.)
                 // This is a kinda naughty hack, 8ut like, it's the only place
                 // we'd 8e passing wikiData to html() otherwise, so like....
-                showAsFlashes: wikiData.wikiInfo.features.flashesAndGames
+                showAsFlashes: wikiData.wikiInfo.enableFlashesAndGames
             };
         },
 
@@ -331,7 +331,7 @@ const listingSpec = [
     {
         directory: 'groups/by-name',
         stringsKey: 'listGroups.byName',
-        condition: ({wikiData}) => wikiData.wikiInfo.features.groupUI,
+        condition: ({wikiData}) => wikiData.wikiInfo.enableGroupUI,
         data: ({wikiData}) => wikiData.groupData.slice().sort(sortByName),
 
         row(group, {link, strings}) {
@@ -347,7 +347,7 @@ const listingSpec = [
     {
         directory: 'groups/by-category',
         stringsKey: 'listGroups.byCategory',
-        condition: ({wikiData}) => wikiData.wikiInfo.features.groupUI,
+        condition: ({wikiData}) => wikiData.wikiInfo.enableGroupUI,
         data: ({wikiData}) => wikiData.groupCategoryData,
 
         html(groupCategoryData, {link, strings}) {
@@ -377,7 +377,7 @@ const listingSpec = [
     {
         directory: 'groups/by-albums',
         stringsKey: 'listGroups.byAlbums',
-        condition: ({wikiData}) => wikiData.wikiInfo.features.groupUI,
+        condition: ({wikiData}) => wikiData.wikiInfo.enableGroupUI,
 
         data({wikiData}) {
             return wikiData.groupData
@@ -396,7 +396,7 @@ const listingSpec = [
     {
         directory: 'groups/by-tracks',
         stringsKey: 'listGroups.byTracks',
-        condition: ({wikiData}) => wikiData.wikiInfo.features.groupUI,
+        condition: ({wikiData}) => wikiData.wikiInfo.enableGroupUI,
 
         data({wikiData}) {
             return wikiData.groupData
@@ -415,7 +415,7 @@ const listingSpec = [
     {
         directory: 'groups/by-duration',
         stringsKey: 'listGroups.byDuration',
-        condition: ({wikiData}) => wikiData.wikiInfo.features.groupUI,
+        condition: ({wikiData}) => wikiData.wikiInfo.enableGroupUI,
 
         data({wikiData}) {
             return wikiData.groupData
@@ -434,7 +434,7 @@ const listingSpec = [
     {
         directory: 'groups/by-latest-album',
         stringsKey: 'listGroups.byLatest',
-        condition: ({wikiData}) => wikiData.wikiInfo.features.groupUI,
+        condition: ({wikiData}) => wikiData.wikiInfo.enableGroupUI,
 
         data({wikiData}) {
             return sortByDate(wikiData.groupData
@@ -614,7 +614,7 @@ const listingSpec = [
     {
         directory: 'tracks/in-flashes/by-album',
         stringsKey: 'listTracks.inFlashes.byAlbum',
-        condition: ({wikiData}) => wikiData.wikiInfo.features.flashesAndGames,
+        condition: ({wikiData}) => wikiData.wikiInfo.enableFlashesAndGames,
 
         data({wikiData}) {
             return chunkByProperties(wikiData.trackData
@@ -648,7 +648,7 @@ const listingSpec = [
     {
         directory: 'tracks/in-flashes/by-flash',
         stringsKey: 'listTracks.inFlashes.byFlash',
-        condition: ({wikiData}) => wikiData.wikiInfo.features.flashesAndGames,
+        condition: ({wikiData}) => wikiData.wikiInfo.enableFlashesAndGames,
         data: ({wikiData}) => wikiData.flashData,
 
         html(flashData, {link, strings}) {
@@ -707,7 +707,7 @@ const listingSpec = [
     {
         directory: 'tags/by-name',
         stringsKey: 'listTags.byName',
-        condition: ({wikiData}) => wikiData.wikiInfo.features.artTagUI,
+        condition: ({wikiData}) => wikiData.wikiInfo.enableArtTagUI,
 
         data({wikiData}) {
             return wikiData.tagData
@@ -727,7 +727,7 @@ const listingSpec = [
     {
         directory: 'tags/by-uses',
         stringsKey: 'listTags.byUses',
-        condition: ({wikiData}) => wikiData.wikiInfo.features.artTagUI,
+        condition: ({wikiData}) => wikiData.wikiInfo.enableArtTagUI,
 
         data({wikiData}) {
             return wikiData.tagData
diff --git a/src/misc-templates.js b/src/misc-templates.js
index 090c437d..1fc05f0f 100644
--- a/src/misc-templates.js
+++ b/src/misc-templates.js
@@ -145,7 +145,7 @@ export function generateCoverLink({
                 square: true,
                 reveal: getRevealStringFromTags(tags, {strings})
             })}
-            ${wikiInfo.features.artTagUI && tags.filter(tag => !tag.isCW).length && fixWS`
+            ${wikiInfo.enableArtTagUI && tags.filter(tag => !tag.isCW).length && fixWS`
                 <p class="tags">
                     ${strings('releaseInfo.artTags')}
                     ${(tags
diff --git a/src/page/artist.js b/src/page/artist.js
index e6160be3..5cdb97f1 100644
--- a/src/page/artist.js
+++ b/src/page/artist.js
@@ -114,7 +114,7 @@ export function write(artist, {wikiData}) {
     const artGroups = countGroups(artThingsAll);
 
     let flashes, flashListChunks;
-    if (wikiInfo.features.flashesAndGames) {
+    if (wikiInfo.enableFlashesAndGames) {
         flashes = sortByDate(artist.flashes.asContributor.slice());
         flashListChunks = (
             chunkByProperties(flashes.map(flash => ({
@@ -232,7 +232,7 @@ export function write(artist, {wikiData}) {
                     asWallpaperArtist: artist.albums.asWallpaperArtist.map(serializeArtistsAndContrib('wallpaperArtists')),
                     asBannerArtist: artist.albums.asBannerArtist.map(serializeArtistsAndContrib('bannerArtists'))
                 },
-                flashes: wikiInfo.features.flashesAndGames ? {
+                flashes: wikiInfo.enableFlashesAndGames ? {
                     asContributor: artist.flashes.asContributor
                         .map(flash => getArtistsAndContrib(flash, 'contributors'))
                         .map(({ contrib, thing: flash }) => ({
@@ -303,7 +303,7 @@ export function write(artist, {wikiData}) {
                                     unreleasedTracks.length && `(<a href="#unreleased-tracks">${strings('artistPage.unreleasedTrackList.title')}</a>)`
                                 ].filter(Boolean).join(' '),
                                 artThingsAll.length && `<a href="#art">${strings('artistPage.artList.title')}</a>`,
-                                wikiInfo.features.flashesAndGames && flashes.length && `<a href="#flashes">${strings('artistPage.flashList.title')}</a>`,
+                                wikiInfo.enableFlashesAndGames && flashes.length && `<a href="#flashes">${strings('artistPage.flashList.title')}</a>`,
                                 commentaryThings.length && `<a href="#commentary">${strings('artistPage.commentaryList.title')}</a>`
                             ].filter(Boolean))
                         })}</p>
@@ -369,7 +369,7 @@ export function write(artist, {wikiData}) {
                                 `).join('\n')}
                             </dl>
                         `}
-                        ${wikiInfo.features.flashesAndGames && flashes.length && fixWS`
+                        ${wikiInfo.enableFlashesAndGames && flashes.length && fixWS`
                             <h2 id="flashes">${strings('artistPage.flashList.title')}</h2>
                             <dl>
                                 ${flashListChunks.map(({act, chunk, dateFirst, dateLast}) => fixWS`
@@ -492,7 +492,7 @@ function generateNavForArtist(artist, isGallery, hasGallery, {
     return {
         links: [
             {toHome: true},
-            wikiInfo.features.listings &&
+            wikiInfo.enableListings &&
             {
                 path: ['localized.listingIndex'],
                 title: strings('listingIndex.title')
diff --git a/src/page/flash.js b/src/page/flash.js
index 9c59016d..9d88bc79 100644
--- a/src/page/flash.js
+++ b/src/page/flash.js
@@ -13,7 +13,7 @@ import {
 // Page exports
 
 export function condition({wikiData}) {
-    return wikiData.wikiInfo.features.flashesAndGames;
+    return wikiData.wikiInfo.enableFlashesAndGames;
 }
 
 export function targets({wikiData}) {
diff --git a/src/page/group.js b/src/page/group.js
index 7282fc81..47828965 100644
--- a/src/page/group.js
+++ b/src/page/group.js
@@ -132,7 +132,7 @@ export function write(group, {wikiData}) {
                             time: `<b>${strings.count.duration(totalDuration, {unit: true})}</b>`
                         })
                     }</p>
-                    ${wikiInfo.features.groupUI && wikiInfo.features.listings && html.tag('p',
+                    ${wikiInfo.enableGroupUI && wikiInfo.enableListings && html.tag('p',
                         {class: 'quick-info'},
                         strings('groupGalleryPage.anotherGroupLine', {
                             link: link.listing(listingSpec.find(l => l.directory === 'groups/by-category'), {
@@ -179,7 +179,7 @@ function generateGroupSidebar(currentGroup, isGallery, {
 }) {
     const { groupCategoryData, wikiInfo } = wikiData;
 
-    if (!wikiInfo.features.groupUI) {
+    if (!wikiInfo.enableGroupUI) {
         return null;
     }
 
@@ -222,7 +222,7 @@ function generateGroupNav(currentGroup, isGallery, {
 }) {
     const { groupData, wikiInfo } = wikiData;
 
-    if (!wikiInfo.features.groupUI) {
+    if (!wikiInfo.enableGroupUI) {
         return {simple: true};
     }
 
@@ -242,7 +242,7 @@ function generateGroupNav(currentGroup, isGallery, {
     return {
         links: [
             {toHome: true},
-            wikiInfo.features.listings &&
+            wikiInfo.enableListings &&
             {
                 path: ['localized.listingIndex'],
                 title: strings('listingIndex.title')
diff --git a/src/page/homepage.js b/src/page/homepage.js
index e60256dc..e40392a1 100644
--- a/src/page/homepage.js
+++ b/src/page/homepage.js
@@ -87,7 +87,7 @@ export function writeTargetless({wikiData}) {
                 // And no, I will not make [[news]] into part of transformMultiline
                 // (even though that would 8e hilarious).
                 content: (transformMultiline(homepageInfo.sidebar.replace('[[news]]', '__GENERATE_NEWS__'))
-                    .replace('<p>__GENERATE_NEWS__</p>', wikiInfo.features.news ? fixWS`
+                    .replace('<p>__GENERATE_NEWS__</p>', wikiInfo.enableNews ? fixWS`
                         <h1>${strings('homepage.news.title')}</h1>
                         ${newsData.slice(0, 3).map((entry, i) => html.tag('article',
                             {class: ['news-entry', i === 0 && 'first-news-entry']},
@@ -106,11 +106,11 @@ export function writeTargetless({wikiData}) {
                     <h2 class="dot-between-spans">
                         ${[
                             link.home('', {text: wikiInfo.shortName, class: 'current', to}),
-                            wikiInfo.features.listings &&
+                            wikiInfo.enableListings &&
                             link.listingIndex('', {text: strings('listingIndex.title'), to}),
-                            wikiInfo.features.news &&
+                            wikiInfo.enableNews &&
                             link.newsIndex('', {text: strings('newsIndex.title'), to}),
-                            wikiInfo.features.flashesAndGames &&
+                            wikiInfo.enableFlashesAndGames &&
                             link.flashIndex('', {text: strings('flashIndex.title'), to}),
                             ...staticPageData.filter(page => page.listed).map(page =>
                                 link.staticPage(page, {text: page.shortName}))
diff --git a/src/page/listing.js b/src/page/listing.js
index d3ab79e0..3083a599 100644
--- a/src/page/listing.js
+++ b/src/page/listing.js
@@ -25,7 +25,7 @@ import {
 // Page exports
 
 export function condition({wikiData}) {
-    return wikiData.wikiInfo.features.listings;
+    return wikiData.wikiInfo.enableListings;
 }
 
 export function targets({wikiData}) {
diff --git a/src/page/news.js b/src/page/news.js
index 99cbe8d5..75ae9e48 100644
--- a/src/page/news.js
+++ b/src/page/news.js
@@ -7,7 +7,7 @@ import fixWS from 'fix-whitespace';
 // Page exports
 
 export function condition({wikiData}) {
-    return wikiData.wikiInfo.features.news;
+    return wikiData.wikiInfo.enableNews;
 }
 
 export function targets({wikiData}) {
diff --git a/src/page/tag.js b/src/page/tag.js
index 791c713d..60b8d217 100644
--- a/src/page/tag.js
+++ b/src/page/tag.js
@@ -7,7 +7,7 @@ import fixWS from 'fix-whitespace';
 // Page exports
 
 export function condition({wikiData}) {
-    return wikiData.wikiInfo.features.artTagUI;
+    return wikiData.wikiInfo.enableArtTagUI;
 }
 
 export function targets({wikiData}) {
@@ -89,7 +89,7 @@ function generateTagNav(tag, {
     return {
         links: [
             {toHome: true},
-            wikiData.wikiInfo.features.listings &&
+            wikiData.wikiInfo.enableListings &&
             {
                 path: ['localized.listingIndex'],
                 title: strings('listingIndex.title')
diff --git a/src/page/track.js b/src/page/track.js
index c2f2c592..b3cec414 100644
--- a/src/page/track.js
+++ b/src/page/track.js
@@ -49,7 +49,7 @@ export function write(track, {wikiData}) {
     const listTag = getAlbumListTag(album);
 
     let flashesThatFeature;
-    if (wikiInfo.features.flashesAndGames) {
+    if (wikiInfo.enableFlashesAndGames) {
         flashesThatFeature = sortByDate([track, ...otherReleases]
             .flatMap(track => track.flashes.map(flash => ({flash, as: track}))));
     }
@@ -250,7 +250,7 @@ export function write(track, {wikiData}) {
                             `}
                             ${!useDividedReferences && generateTrackList(tracksThatReference)}
                         `}
-                        ${wikiInfo.features.flashesAndGames && flashesThatFeature.length && fixWS`
+                        ${wikiInfo.enableFlashesAndGames && flashesThatFeature.length && fixWS`
                             <p>${strings('releaseInfo.flashesThatFeature', {track: `<i>${track.name}</i>`})}</p>
                             <ul>
                                 ${flashesThatFeature.map(({ flash, as }) => html.tag('li',
diff --git a/src/upd8.js b/src/upd8.js
index ff32590e..8a15ab23 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -1992,13 +1992,13 @@ function writeSharedFilesAndPages({strings, wikiData}) {
         groupData?.some(group => group.directory === 'official') &&
         redirect('Official - Gallery', 'albums/official', 'localized.groupGallery', 'official'),
 
-        wikiInfo.features.listings &&
+        wikiInfo.enableListings &&
         redirect('Album Commentary', 'list/all-commentary', 'localized.commentaryIndex', ''),
 
         writeFile(path.join(outputPath, 'data.json'), fixWS`
             {
                 "albumData": ${stringifyAlbumData({wikiData})},
-                ${wikiInfo.features.flashesAndGames && `"flashData": ${stringifyFlashData({wikiData})},`}
+                ${wikiInfo.enableFlashesAndGames && `"flashData": ${stringifyFlashData({wikiData})},`}
                 "artistData": ${stringifyArtistData({wikiData})}
             }
         `)
@@ -2423,7 +2423,7 @@ async function main() {
             }
         },
 
-        // TODO: WD.wikiInfo.features.flashesAndGames &&
+        // TODO: WD.wikiInfo.enableFlashesAndGames &&
         {
             title: `Process flashes file`,
             files: [path.join(dataPath, FLASH_DATA_FILE)],
@@ -2525,7 +2525,7 @@ async function main() {
             }
         },
 
-        // TODO: WD.wikiInfo.features.news &&
+        // TODO: WD.wikiInfo.enableNews &&
         {
             title: `Process news data file`,
             files: [path.join(dataPath, NEWS_DATA_FILE)],
@@ -2993,7 +2993,7 @@ async function main() {
         tag.things = albumAndTrackDataSortedByArtDateMan.filter(thing => thing.artTags.includes(tag));
     }
 
-    if (WD.wikiInfo.features.flashesAndGames) {
+    if (WD.wikiInfo.enableFlashesAndGames) {
         for (const flash of WD.flashData) {
             flash.act = WD.flashActData.find(act => act.name === flash.act);
             mapAndFilter(flash, 'tracks', {map: bound.findTrack});
@@ -3027,7 +3027,7 @@ async function main() {
             asWallpaperArtist: filterProp(WD.albumData, 'wallpaperArtists'),
             asBannerArtist: filterProp(WD.albumData, 'bannerArtists')
         };
-        if (WD.wikiInfo.features.flashesAndGames) {
+        if (WD.wikiInfo.enableFlashesAndGames) {
             artist.flashes = {
                 asContributor: filterProp(WD.flashData, 'contributors')
             };
@@ -3038,7 +3038,6 @@ async function main() {
     WD.officialAlbumData = WD.albumData.filter(album => album.groups.some(group => group.directory === OFFICIAL_GROUP_DIRECTORY));
     WD.fandomAlbumData = WD.albumData.filter(album => album.groups.every(group => group.directory !== OFFICIAL_GROUP_DIRECTORY));
 
-    console.log(WD.officialAlbumData.length, WD.fandomAlbumData.length);
     return;
 
     // Makes writing a little nicer on CPU theoretically, 8ut also costs in