Skip to content

Commit

Permalink
fix: ensure subclass sources present; fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGiddyLimit committed Jun 11, 2021
1 parent 7febdab commit c0ecb23
Show file tree
Hide file tree
Showing 8 changed files with 181 additions and 7 deletions.
2 changes: 1 addition & 1 deletion _generated/index-props.json

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions _node/clean-and-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const fs = require("fs");
const uf = require("./util-fs");
const um = require("./util-misc");
const ub = require("./util-brew");
const {VANILLA_SOURCES} = require("./util-sources.js");

const REPLACEMENTS = {
"—": "\\u2014",
Expand All @@ -32,11 +33,7 @@ const REPLACEMENTS = {
"ſt": "ft",
};

const VANILLA_SOURCES = new Set([
"PHB",
"XGE",
"TCE",
]);
const _VANILLA_SOURCES = new Set(VANILLA_SOURCES);

const replacementRegex = new RegExp(Object.keys(REPLACEMENTS).join("|"), 'g');

Expand Down Expand Up @@ -105,7 +102,7 @@ function cleanFolder (folder) {
data.forEach(it => {
const source = it.source || (it.inherits ? it.inherits.source : null);
if (!source) return ALL_ERRORS.push(`${file.name} :: ${k} :: "${it.name || it.id}" had no source!`);
if (!validSources.has(source) && !VANILLA_SOURCES.has(source)) return ALL_ERRORS.push(`${file.name} :: ${k} :: "${it.name || it.id}" source "${source}" was not in _meta`);
if (!validSources.has(source) && !_VANILLA_SOURCES.has(source)) return ALL_ERRORS.push(`${file.name} :: ${k} :: "${it.name || it.id}" source "${source}" was not in _meta`);
});
});
// endregion
Expand Down
158 changes: 158 additions & 0 deletions _node/util-sources.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
"use strict";

// Dumped from `Object.keys(Parser.SOURCE_JSON_TO_FULL)`
// TODO(Future) sensibly factor this out
const VANILLA_SOURCES = [
"CoS",
"DMG",
"EEPC",
"EET",
"HotDQ",
"LMoP",
"Mag",
"MM",
"OotA",
"PHB",
"PotA",
"RoT",
"RoTOS",
"SCAG",
"SKT",
"ToA",
"ToD",
"TTP",
"TftYP",
"TftYP-AtG",
"TftYP-DiT",
"TftYP-TFoF",
"TftYP-THSoT",
"TftYP-TSC",
"TftYP-ToH",
"TftYP-WPM",
"VGM",
"XGE",
"OGA",
"MTF",
"WDH",
"WDMM",
"GGR",
"KKW",
"LLK",
"GoS",
"AI",
"OoW",
"ESK",
"DIP",
"HftT",
"DC",
"SLW",
"SDW",
"BGDIA",
"LR",
"AL",
"SAC",
"ERLW",
"EFR",
"RMBRE",
"RMR",
"MFF",
"AWM",
"IMR",
"SADS",
"EGW",
"ToR",
"DD",
"FS",
"US",
"MOT",
"IDRotF",
"TCE",
"VRGR",
"HoL",
"Screen",
"ScreenWildernessKit",
"HF",
"CM",
"ALCurseOfStrahd",
"ALElementalEvil",
"ALRageOfDemons",
"PSA",
"PSI",
"PSK",
"PSZ",
"PSX",
"PSD",
"UAArtificer",
"UAEladrinAndGith",
"UAEberron",
"UAFeatsForRaces",
"UAFeatsForSkills",
"UAFiendishOptions",
"UAFeats",
"UAGothicHeroes",
"UAModernMagic",
"UAStarterSpells",
"UATheMysticClass",
"UAThatOldBlackMagic",
"UATheRangerRevised",
"UAWaterborneAdventures",
"UAVariantRules",
"UALightDarkUnderdark",
"UARangerAndRogue",
"UAATrioOfSubclasses",
"UABarbarianPrimalPaths",
"UARevisedSubclasses",
"UAKitsOfOld",
"UABardBardColleges",
"UAClericDivineDomains",
"UADruid",
"UARevisedClassOptions",
"UAFighter",
"UAMonk",
"UAPaladin",
"UAModifyingClasses",
"UASorcerer",
"UAWarlockAndWizard",
"UATheFaithful",
"UAWizardRevisited",
"UAElfSubraces",
"UAMassCombat",
"UAThreePillarExperience",
"UAGreyhawkInitiative",
"UAThreeSubclasses",
"UAOrderDomain",
"UACentaursMinotaurs",
"UAGiantSoulSorcerer",
"UARacesOfEberron",
"UARacesOfRavnica",
"UAWGE",
"UAOfShipsAndSea",
"UASidekicks",
"UAArtificerRevisited",
"UABarbarianAndMonk",
"UASorcererAndWarlock",
"UABardAndPaladin",
"UAClericDruidWizard",
"UAFighterRangerRogue",
"UAClassFeatureVariants",
"UAFighterRogueWizard",
"UAPrestigeClassesRunMagic",
"UARanger",
"UA2020SubclassesPt1",
"UA2020SubclassesPt2",
"UA2020SubclassesPt3",
"UA2020SubclassesPt4",
"UA2020SubclassesPt5",
"UA2020SpellsAndMagicTattoos",
"UA2020PsionicOptionsRevisited",
"UA2020SubclassesRevisited",
"UA2020Feats",
"UA2021GothicLineages",
"UA2021FolkOfTheFeywild",
"UA2021DraconicOptions",
"UA2021MagesOfStrixhaven"
];

module.exports = {
VANILLA_SOURCES
};
3 changes: 3 additions & 0 deletions class/CJ Leung; The Channeler.json
Original file line number Diff line number Diff line change
Expand Up @@ -1809,6 +1809,7 @@
"Window to the Past (Lv 17)|Channeler|CHNLR|Chronos Avenger|CHNLR|17",
"Split Time (Lv 20)|Channeler|CHNLR|Chronos Avenger|CHNLR|20"
],
"source": "CHNLR",
"className": "Channeler",
"classSource": "CHNLR"
},
Expand All @@ -1826,6 +1827,7 @@
"Chrome Block|Channeler|CHNLR|Iron Myrmidon|CHNLR|17",
"Storm of Steel|Channeler|CHNLR|Iron Myrmidon|CHNLR|20"
],
"source": "CHNLR",
"className": "Channeler",
"classSource": "CHNLR"
},
Expand Down Expand Up @@ -2142,6 +2144,7 @@
15,
15
],
"source": "CHNLR",
"className": "Channeler",
"classSource": "CHNLR"
}
Expand Down
3 changes: 3 additions & 0 deletions class/Deakin Bennett; The Noble.json
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,7 @@
"Shatter Persona|Noble|Noble|Diplomacy|Noble|14",
"Supernal Majesty|Noble|Noble|Diplomacy|Noble|18"
],
"source": "Noble",
"className": "Noble",
"classSource": "Noble"
},
Expand All @@ -1321,6 +1322,7 @@
"Mythic Mark (4)|Noble|Noble|Myth|Noble|7",
"Mythic Mark (5)|Noble|Noble|Myth|Noble|14"
],
"source": "Noble",
"className": "Noble",
"classSource": "Noble"
},
Expand All @@ -1336,6 +1338,7 @@
"Legendary Acrobatics|Noble|Noble|War|Noble|14",
"Unrelenting|Noble|Noble|War|Noble|18"
],
"source": "Noble",
"className": "Noble",
"classSource": "Noble"
}
Expand Down
5 changes: 5 additions & 0 deletions class/Kyle Grant; The Scholar.json
Original file line number Diff line number Diff line change
Expand Up @@ -3074,6 +3074,7 @@
"Gambit: Fool Me Once|Scholar|Scholar|Explorer|Scholar|13",
"Rapid Adjustment|Scholar|Scholar|Explorer|Scholar|18"
],
"source": "Scholar",
"className": "Scholar",
"classSource": "Scholar"
},
Expand All @@ -3090,6 +3091,7 @@
"Fourth Invention|Scholar|Scholar|Inventor|Scholar|18",
"Masterpiece|Scholar|Scholar|Inventor|Scholar|18"
],
"source": "Scholar",
"className": "Scholar",
"classSource": "Scholar"
},
Expand All @@ -3103,6 +3105,7 @@
"Logic|Scholar|Scholar|Philosopher|Scholar|13",
"Unmatched Authority|Scholar|Scholar|Philosopher|Scholar|18"
],
"source": "Scholar",
"className": "Scholar",
"classSource": "Scholar"
},
Expand All @@ -3116,6 +3119,7 @@
"Infecting Solution|Scholar|Scholar|Physician|Scholar|13",
"Double Shift|Scholar|Scholar|Physician|Scholar|18"
],
"source": "Scholar",
"className": "Scholar",
"classSource": "Scholar"
},
Expand Down Expand Up @@ -3530,6 +3534,7 @@
"Force Multiplier|Scholar|Scholar|Tactician|Scholar|13",
"Tenacious Intellect|Scholar|Scholar|Tactician|Scholar|18"
],
"source": "Scholar",
"className": "Scholar",
"classSource": "Scholar"
}
Expand Down
2 changes: 2 additions & 0 deletions class/ZetFalcon; Card Dealer.json
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,7 @@
"subclassFeatures": [
"Arcane Ace|Card Dealer|CardDealer|Arcane Ace|CardDealer|3"
],
"source": "CardDealer",
"className": "Card Dealer",
"classSource": "CardDealer"
},
Expand All @@ -938,6 +939,7 @@
"Deck Turnover|Card Dealer|CardDealer|Master of Cards|CardDealer|14",
"Backraise|Card Dealer|CardDealer|Master of Cards|CardDealer|18"
],
"source": "CardDealer",
"className": "Card Dealer",
"classSource": "CardDealer"
}
Expand Down
6 changes: 6 additions & 0 deletions class/laserllama; The Savant.json
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,7 @@
"Use Magical Device|The Savant|savant|Archaeologist|savant|13|savant",
"Master Archaeologist|The Savant|savant|Archaeologist|savant|17|savant"
],
"source": "savant",
"className": "The Savant",
"classSource": "savant"
},
Expand All @@ -1043,6 +1044,7 @@
"Wild Insights|The Savant|savant|Naturalist|savant|13|savant",
"Master Naturalist|The Savant|savant|Naturalist|savant|17|savant"
],
"source": "savant",
"className": "The Savant",
"classSource": "savant"
},
Expand All @@ -1057,6 +1059,7 @@
"Supreme Understanding|The Savant|savant|Philosophy|savant|13|savant",
"Master Philosopher|The Savant|savant|Philosophy|savant|17|savant"
],
"source": "savant",
"className": "The Savant",
"classSource": "savant"
},
Expand All @@ -1071,6 +1074,7 @@
"Field Surgeon|The Savant|savant|Physician|savant|13|savant",
"Master Physician|The Savant|savant|Physician|savant|17|savant"
],
"source": "savant",
"className": "The Savant",
"classSource": "savant"
},
Expand All @@ -1085,6 +1089,7 @@
"Peerless Insight|The Savant|savant|Seeker|savant|13|savant",
"Master Seeker|The Savant|savant|Seeker|savant|17|savant"
],
"source": "savant",
"className": "The Savant",
"classSource": "savant"
},
Expand All @@ -1099,6 +1104,7 @@
"Strategic Genius|The Savant|savant|Tactician|savant|13|savant",
"Master Tactician|The Savant|savant|Tactician|savant|17|savant"
],
"source": "savant",
"className": "The Savant",
"classSource": "savant"
}
Expand Down

0 comments on commit c0ecb23

Please sign in to comment.