diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/upd8.js | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/upd8.js b/src/upd8.js index e903d6af..eb2da684 100755 --- a/src/upd8.js +++ b/src/upd8.js @@ -2879,7 +2879,14 @@ async function main() { if (!thing[property]) continue; if (findFnKey === '_contrib') { thing[property] = filter(thing[property], - decorateErrorWithIndex(({ who }) => boundFind.artist(who)), + decorateErrorWithIndex(({ who }) => { + const alias = find.artist(who, wikiData.artistAliasData, {mode: 'quiet'}); + if (alias) { + const original = find.artist(alias.aliasedArtistRef, wikiData.artistData, {mode: 'quiet'}); + throw new Error(`Reference ${color.red(who)} is to an alias, should be ${color.green(original.name)}`); + } + return boundFind.artist(who); + }), {message: `Reference errors in contributions ${color.green(property)}`}); continue; } @@ -2928,6 +2935,18 @@ async function main() { // appropriate. linkDataArrays(); + WD.artistAliasData = wikiData.artistData.flatMap(artist => { + const origRef = Thing.getReference(artist); + return (artist.aliasNames?.map(name => { + const alias = new Artist(); + alias.name = name; + alias.isAlias = true; + alias.aliasedArtistRef = origRef; + alias.artistData = WD.artistData; + return alias; + }) ?? []); + }); + // Filter out any reference errors throughout the data, warning about them // too. filterAndShowReferenceErrors(); @@ -2984,18 +3003,6 @@ async function main() { WD.justEverythingSortedByArtDateMan = sortByArtDate(WD.justEverythingMan.slice()); // console.log(JSON.stringify(justEverythingSortedByArtDateMan.map(toAnythingMan), null, 2)); - WD.artistAliasData = wikiData.artistData.flatMap(artist => { - const origRef = Thing.getReference(artist); - return (artist.aliasNames?.map(name => { - const alias = new Artist(); - alias.name = name; - alias.isAlias = true; - alias.aliasedArtistRef = origRef; - alias.artistData = WD.artistData; - return alias; - }) ?? []); - }); - { const directories = []; for (const { directory, name } of WD.albumData) { |