5etools-utils 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/lib/Api.js +11 -1
  2. package/lib/BrewCleaner.js +126 -0
  3. package/lib/BrewIndexGenerator.js +173 -0
  4. package/lib/BrewTimestamper.js +102 -0
  5. package/lib/TestJson.js +43 -19
  6. package/lib/UtilClean.js +35 -0
  7. package/lib/UtilMisc.js +36 -17
  8. package/lib/UtilSources.js +200 -0
  9. package/package.json +5 -2
  10. package/schema/brew/bestiary/fluff-index.json +11 -0
  11. package/schema/brew/bestiary/index.json +11 -0
  12. package/schema/brew/changelog.json +35 -0
  13. package/schema/brew/class/index.json +11 -0
  14. package/schema/brew/homebrew.json +2 -2
  15. package/schema/brew/life.json +17 -0
  16. package/schema/brew/spells/fluff-index.json +11 -0
  17. package/schema/brew/spells/index.json +11 -0
  18. package/schema/brew-fast/bestiary/fluff-index.json +11 -0
  19. package/schema/brew-fast/bestiary/index.json +11 -0
  20. package/schema/brew-fast/changelog.json +35 -0
  21. package/schema/brew-fast/class/index.json +11 -0
  22. package/schema/brew-fast/homebrew.json +2 -2
  23. package/schema/brew-fast/life.json +17 -0
  24. package/schema/brew-fast/spells/fluff-index.json +11 -0
  25. package/schema/brew-fast/spells/index.json +11 -0
  26. package/schema/site/bestiary/fluff-index.json +11 -0
  27. package/schema/site/bestiary/index.json +11 -0
  28. package/schema/site/changelog.json +35 -0
  29. package/schema/site/class/index.json +11 -0
  30. package/schema/site/homebrew.json +2 -2
  31. package/schema/site/life.json +17 -0
  32. package/schema/site/spells/fluff-index.json +11 -0
  33. package/schema/site/spells/index.json +11 -0
  34. package/schema/site-fast/bestiary/fluff-index.json +11 -0
  35. package/schema/site-fast/bestiary/index.json +11 -0
  36. package/schema/site-fast/changelog.json +35 -0
  37. package/schema/site-fast/class/index.json +11 -0
  38. package/schema/site-fast/homebrew.json +2 -2
  39. package/schema/site-fast/life.json +17 -0
  40. package/schema/site-fast/spells/fluff-index.json +11 -0
  41. package/schema/site-fast/spells/index.json +11 -0
@@ -0,0 +1,200 @@
1
+ // Dumped from `Object.keys(Parser.SOURCE_JSON_TO_FULL)`
2
+ // TODO(Future) sensibly factor this out
3
+ const SITE_SOURCES = [
4
+ "CoS",
5
+ "DMG",
6
+ "EEPC",
7
+ "EET",
8
+ "HotDQ",
9
+ "LMoP",
10
+ "MM",
11
+ "OotA",
12
+ "PHB",
13
+ "PotA",
14
+ "RoT",
15
+ "RoTOS",
16
+ "SCAG",
17
+ "SKT",
18
+ "ToA",
19
+ "TLK",
20
+ "ToD",
21
+ "TTP",
22
+ "TftYP",
23
+ "TftYP-AtG",
24
+ "TftYP-DiT",
25
+ "TftYP-TFoF",
26
+ "TftYP-THSoT",
27
+ "TftYP-TSC",
28
+ "TftYP-ToH",
29
+ "TftYP-WPM",
30
+ "VGM",
31
+ "XGE",
32
+ "OGA",
33
+ "MTF",
34
+ "WDH",
35
+ "WDMM",
36
+ "GGR",
37
+ "KKW",
38
+ "LLK",
39
+ "AZfyT",
40
+ "GoS",
41
+ "AI",
42
+ "OoW",
43
+ "ESK",
44
+ "DIP",
45
+ "HftT",
46
+ "DC",
47
+ "SLW",
48
+ "SDW",
49
+ "BGDIA",
50
+ "LR",
51
+ "AL",
52
+ "SAC",
53
+ "ERLW",
54
+ "EFR",
55
+ "RMBRE",
56
+ "RMR",
57
+ "MFF",
58
+ "AWM",
59
+ "IMR",
60
+ "SADS",
61
+ "EGW",
62
+ "ToR",
63
+ "DD",
64
+ "FS",
65
+ "US",
66
+ "MOT",
67
+ "IDRotF",
68
+ "TCE",
69
+ "VRGR",
70
+ "HoL",
71
+ "RtG",
72
+ "AitFR",
73
+ "AitFR-ISF",
74
+ "AitFR-THP",
75
+ "AitFR-AVT",
76
+ "AitFR-DN",
77
+ "AitFR-FCD",
78
+ "WBtW",
79
+ "DoD",
80
+ "MaBJoV",
81
+ "FTD",
82
+ "SCC",
83
+ "SCC-CK",
84
+ "SCC-HfMT",
85
+ "SCC-TMM",
86
+ "SCC-ARiR",
87
+ "MPMM",
88
+ "CRCotN",
89
+ "JttRC",
90
+ "SAiS",
91
+ "AAG",
92
+ "BAM",
93
+ "LoX",
94
+ "DoSI",
95
+ "DSotDQ",
96
+ "Screen",
97
+ "ScreenWildernessKit",
98
+ "ScreenDungeonKit",
99
+ "HF",
100
+ "CM",
101
+ "NRH",
102
+ "NRH-TCMC",
103
+ "NRH-AVitW",
104
+ "NRH-ASS",
105
+ "NRH-CoI",
106
+ "NRH-TLT",
107
+ "NRH-AWoL",
108
+ "NRH-AT",
109
+ "MGELFT",
110
+ "VD",
111
+ "SjA",
112
+ "ALCurseOfStrahd",
113
+ "ALElementalEvil",
114
+ "ALRageOfDemons",
115
+ "PSA",
116
+ "PSI",
117
+ "PSK",
118
+ "PSZ",
119
+ "PSX",
120
+ "PSD",
121
+ "XMtS",
122
+ "UAArtificer",
123
+ "UAEladrinAndGith",
124
+ "UAEberron",
125
+ "UAFeatsForRaces",
126
+ "UAFeatsForSkills",
127
+ "UAFiendishOptions",
128
+ "UAFeats",
129
+ "UAGothicHeroes",
130
+ "UAModernMagic",
131
+ "UAStarterSpells",
132
+ "UATheMysticClass",
133
+ "UAThatOldBlackMagic",
134
+ "UATheRangerRevised",
135
+ "UAWaterborneAdventures",
136
+ "UAVariantRules",
137
+ "UALightDarkUnderdark",
138
+ "UARangerAndRogue",
139
+ "UAATrioOfSubclasses",
140
+ "UABarbarianPrimalPaths",
141
+ "UARevisedSubclasses",
142
+ "UAKitsOfOld",
143
+ "UABardBardColleges",
144
+ "UAClericDivineDomains",
145
+ "UADruid",
146
+ "UARevisedClassOptions",
147
+ "UAFighter",
148
+ "UAMonk",
149
+ "UAPaladin",
150
+ "UAModifyingClasses",
151
+ "UASorcerer",
152
+ "UAWarlockAndWizard",
153
+ "UATheFaithful",
154
+ "UAWizardRevisited",
155
+ "UAElfSubraces",
156
+ "UAMassCombat",
157
+ "UAThreePillarExperience",
158
+ "UAGreyhawkInitiative",
159
+ "UAThreeSubclasses",
160
+ "UAOrderDomain",
161
+ "UACentaursMinotaurs",
162
+ "UAGiantSoulSorcerer",
163
+ "UARacesOfEberron",
164
+ "UARacesOfRavnica",
165
+ "UAWGE",
166
+ "UAOfShipsAndSea",
167
+ "UASidekicks",
168
+ "UAArtificerRevisited",
169
+ "UABarbarianAndMonk",
170
+ "UASorcererAndWarlock",
171
+ "UABardAndPaladin",
172
+ "UAClericDruidWizard",
173
+ "UAFighterRangerRogue",
174
+ "UAClassFeatureVariants",
175
+ "UAFighterRogueWizard",
176
+ "UAPrestigeClassesRunMagic",
177
+ "UARanger",
178
+ "UA2020SubclassesPt1",
179
+ "UA2020SubclassesPt2",
180
+ "UA2020SubclassesPt3",
181
+ "UA2020SubclassesPt4",
182
+ "UA2020SubclassesPt5",
183
+ "UA2020SpellsAndMagicTattoos",
184
+ "UA2020PsionicOptionsRevisited",
185
+ "UA2020SubclassesRevisited",
186
+ "UA2020Feats",
187
+ "UA2021GothicLineages",
188
+ "UA2021FolkOfTheFeywild",
189
+ "UA2021DraconicOptions",
190
+ "UA2021MagesOfStrixhaven",
191
+ "UA2021TravelersOfTheMultiverse",
192
+ "UA2022HeroesOfKrynn",
193
+ "UA2022HeroesOfKrynnRevisited",
194
+ "UA2022GiantOptions",
195
+ "UA2022WondersOfTheMultiverse",
196
+ "MCV1SC",
197
+ "MCV2DC",
198
+ ];
199
+
200
+ export {SITE_SOURCES};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "5etools-utils",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Shared utilities for the 5etools ecosystem.",
5
5
  "type": "module",
6
6
  "main": "lib/Api.js",
@@ -12,9 +12,10 @@
12
12
  "lib": "./lib"
13
13
  },
14
14
  "scripts": {
15
+ "build": "node node/compile-schemas.js",
15
16
  "test": "npm run lint:js && npm run test:js",
16
17
  "test:js": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
17
- "lint:js": "eslint lib test --fix"
18
+ "lint:js": "eslint lib node test --fix"
18
19
  },
19
20
  "repository": {
20
21
  "type": "git",
@@ -29,9 +30,11 @@
29
30
  "dependencies": {
30
31
  "ajv": "^8.11.2",
31
32
  "ajv-formats": "^2.1.1",
33
+ "hasha": "^5.2.2",
32
34
  "json-source-map": "^0.6.1"
33
35
  },
34
36
  "devDependencies": {
37
+ "commander": "^9.4.1",
35
38
  "eslint": "^8.11.0",
36
39
  "jest": "^29.3.1"
37
40
  }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "version": "1.0.0",
4
+ "type": "object",
5
+ "patternProperties": {
6
+ "^[-a-zA-Z0-9]+$": {
7
+ "type": "string"
8
+ }
9
+ },
10
+ "additionalProperties": false
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "version": "1.0.0",
4
+ "type": "object",
5
+ "patternProperties": {
6
+ "^[-a-zA-Z0-9]+$": {
7
+ "type": "string"
8
+ }
9
+ },
10
+ "additionalProperties": false
11
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "changelog.json",
4
+ "version": "1.0.0",
5
+ "type": "array",
6
+ "minItems": 1,
7
+ "uniqueItems": true,
8
+ "items": {
9
+ "type": "object",
10
+ "properties": {
11
+ "ver": {
12
+ "type": "string"
13
+ },
14
+ "date": {
15
+ "type": "string",
16
+ "format": "date"
17
+ },
18
+ "title": {
19
+ "type": "string"
20
+ },
21
+ "titleAlt": {
22
+ "type": "string"
23
+ },
24
+ "txt": {
25
+ "type": "string"
26
+ }
27
+ },
28
+ "required": [
29
+ "ver",
30
+ "date",
31
+ "txt"
32
+ ],
33
+ "additionalProperties": false
34
+ }
35
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "version": "1.0.0",
4
+ "type": "object",
5
+ "patternProperties": {
6
+ "^[-a-zA-Z0-9]+$": {
7
+ "type": "string"
8
+ }
9
+ },
10
+ "additionalProperties": false
11
+ }
@@ -297,8 +297,8 @@
297
297
  "examples": [
298
298
  "../_schema-fast/homebrew.json",
299
299
  "../_schema/homebrew.json",
300
- "https://raw.githubusercontent.com/TheGiddyLimit/homebrew/master/_schema-fast/homebrew.json",
301
- "https://raw.githubusercontent.com/TheGiddyLimit/homebrew/master/_schema/homebrew.json"
300
+ "https://raw.githubusercontent.com/TheGiddyLimit/5etools-utils/master/schema/brew-fast/homebrew.json",
301
+ "https://raw.githubusercontent.com/TheGiddyLimit/5etools-utils/master/schema/brew/homebrew.json"
302
302
  ]
303
303
  },
304
304
  "blocklist": {
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "life.json",
4
+ "version": "1.0.0",
5
+ "type": "object",
6
+ "properties": {
7
+ "lifeClass": true,
8
+ "lifeBackground": true,
9
+ "lifeTrinket": true
10
+ },
11
+ "required": [
12
+ "lifeClass",
13
+ "lifeBackground",
14
+ "lifeTrinket"
15
+ ],
16
+ "additionalProperties": false
17
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "version": "1.0.0",
4
+ "type": "object",
5
+ "patternProperties": {
6
+ "^[-a-zA-Z0-9]+$": {
7
+ "type": "string"
8
+ }
9
+ },
10
+ "additionalProperties": false
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "version": "1.0.0",
4
+ "type": "object",
5
+ "patternProperties": {
6
+ "^[-a-zA-Z0-9]+$": {
7
+ "type": "string"
8
+ }
9
+ },
10
+ "additionalProperties": false
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "version": "1.0.0",
4
+ "type": "object",
5
+ "patternProperties": {
6
+ "^[-a-zA-Z0-9]+$": {
7
+ "type": "string"
8
+ }
9
+ },
10
+ "additionalProperties": false
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "version": "1.0.0",
4
+ "type": "object",
5
+ "patternProperties": {
6
+ "^[-a-zA-Z0-9]+$": {
7
+ "type": "string"
8
+ }
9
+ },
10
+ "additionalProperties": false
11
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "changelog.json",
4
+ "version": "1.0.0",
5
+ "type": "array",
6
+ "minItems": 1,
7
+ "uniqueItems": true,
8
+ "items": {
9
+ "type": "object",
10
+ "properties": {
11
+ "ver": {
12
+ "type": "string"
13
+ },
14
+ "date": {
15
+ "type": "string",
16
+ "format": "date"
17
+ },
18
+ "title": {
19
+ "type": "string"
20
+ },
21
+ "titleAlt": {
22
+ "type": "string"
23
+ },
24
+ "txt": {
25
+ "type": "string"
26
+ }
27
+ },
28
+ "required": [
29
+ "ver",
30
+ "date",
31
+ "txt"
32
+ ],
33
+ "additionalProperties": false
34
+ }
35
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "version": "1.0.0",
4
+ "type": "object",
5
+ "patternProperties": {
6
+ "^[-a-zA-Z0-9]+$": {
7
+ "type": "string"
8
+ }
9
+ },
10
+ "additionalProperties": false
11
+ }
@@ -295,8 +295,8 @@
295
295
  "examples": [
296
296
  "../_schema-fast/homebrew.json",
297
297
  "../_schema/homebrew.json",
298
- "https://raw.githubusercontent.com/TheGiddyLimit/homebrew/master/_schema-fast/homebrew.json",
299
- "https://raw.githubusercontent.com/TheGiddyLimit/homebrew/master/_schema/homebrew.json"
298
+ "https://raw.githubusercontent.com/TheGiddyLimit/5etools-utils/master/schema/brew-fast/homebrew.json",
299
+ "https://raw.githubusercontent.com/TheGiddyLimit/5etools-utils/master/schema/brew/homebrew.json"
300
300
  ]
301
301
  },
302
302
  "blocklist": {
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "life.json",
4
+ "version": "1.0.0",
5
+ "type": "object",
6
+ "properties": {
7
+ "lifeClass": true,
8
+ "lifeBackground": true,
9
+ "lifeTrinket": true
10
+ },
11
+ "required": [
12
+ "lifeClass",
13
+ "lifeBackground",
14
+ "lifeTrinket"
15
+ ],
16
+ "additionalProperties": false
17
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "version": "1.0.0",
4
+ "type": "object",
5
+ "patternProperties": {
6
+ "^[-a-zA-Z0-9]+$": {
7
+ "type": "string"
8
+ }
9
+ },
10
+ "additionalProperties": false
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "version": "1.0.0",
4
+ "type": "object",
5
+ "patternProperties": {
6
+ "^[-a-zA-Z0-9]+$": {
7
+ "type": "string"
8
+ }
9
+ },
10
+ "additionalProperties": false
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "version": "1.0.0",
4
+ "type": "object",
5
+ "patternProperties": {
6
+ "^[-a-zA-Z0-9]+$": {
7
+ "type": "string"
8
+ }
9
+ },
10
+ "additionalProperties": false
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "version": "1.0.0",
4
+ "type": "object",
5
+ "patternProperties": {
6
+ "^[-a-zA-Z0-9]+$": {
7
+ "type": "string"
8
+ }
9
+ },
10
+ "additionalProperties": false
11
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "changelog.json",
4
+ "version": "1.0.0",
5
+ "type": "array",
6
+ "minItems": 1,
7
+ "uniqueItems": true,
8
+ "items": {
9
+ "type": "object",
10
+ "properties": {
11
+ "ver": {
12
+ "type": "string"
13
+ },
14
+ "date": {
15
+ "type": "string",
16
+ "format": "date"
17
+ },
18
+ "title": {
19
+ "type": "string"
20
+ },
21
+ "titleAlt": {
22
+ "type": "string"
23
+ },
24
+ "txt": {
25
+ "type": "string"
26
+ }
27
+ },
28
+ "required": [
29
+ "ver",
30
+ "date",
31
+ "txt"
32
+ ],
33
+ "additionalProperties": false
34
+ }
35
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "version": "1.0.0",
4
+ "type": "object",
5
+ "patternProperties": {
6
+ "^[-a-zA-Z0-9]+$": {
7
+ "type": "string"
8
+ }
9
+ },
10
+ "additionalProperties": false
11
+ }
@@ -297,8 +297,8 @@
297
297
  "examples": [
298
298
  "../_schema-fast/homebrew.json",
299
299
  "../_schema/homebrew.json",
300
- "https://raw.githubusercontent.com/TheGiddyLimit/homebrew/master/_schema-fast/homebrew.json",
301
- "https://raw.githubusercontent.com/TheGiddyLimit/homebrew/master/_schema/homebrew.json"
300
+ "https://raw.githubusercontent.com/TheGiddyLimit/5etools-utils/master/schema/brew-fast/homebrew.json",
301
+ "https://raw.githubusercontent.com/TheGiddyLimit/5etools-utils/master/schema/brew/homebrew.json"
302
302
  ]
303
303
  },
304
304
  "blocklist": {
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "life.json",
4
+ "version": "1.0.0",
5
+ "type": "object",
6
+ "properties": {
7
+ "lifeClass": true,
8
+ "lifeBackground": true,
9
+ "lifeTrinket": true
10
+ },
11
+ "required": [
12
+ "lifeClass",
13
+ "lifeBackground",
14
+ "lifeTrinket"
15
+ ],
16
+ "additionalProperties": false
17
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "version": "1.0.0",
4
+ "type": "object",
5
+ "patternProperties": {
6
+ "^[-a-zA-Z0-9]+$": {
7
+ "type": "string"
8
+ }
9
+ },
10
+ "additionalProperties": false
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "version": "1.0.0",
4
+ "type": "object",
5
+ "patternProperties": {
6
+ "^[-a-zA-Z0-9]+$": {
7
+ "type": "string"
8
+ }
9
+ },
10
+ "additionalProperties": false
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "version": "1.0.0",
4
+ "type": "object",
5
+ "patternProperties": {
6
+ "^[-a-zA-Z0-9]+$": {
7
+ "type": "string"
8
+ }
9
+ },
10
+ "additionalProperties": false
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "version": "1.0.0",
4
+ "type": "object",
5
+ "patternProperties": {
6
+ "^[-a-zA-Z0-9]+$": {
7
+ "type": "string"
8
+ }
9
+ },
10
+ "additionalProperties": false
11
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "changelog.json",
4
+ "version": "1.0.0",
5
+ "type": "array",
6
+ "minItems": 1,
7
+ "uniqueItems": true,
8
+ "items": {
9
+ "type": "object",
10
+ "properties": {
11
+ "ver": {
12
+ "type": "string"
13
+ },
14
+ "date": {
15
+ "type": "string",
16
+ "format": "date"
17
+ },
18
+ "title": {
19
+ "type": "string"
20
+ },
21
+ "titleAlt": {
22
+ "type": "string"
23
+ },
24
+ "txt": {
25
+ "type": "string"
26
+ }
27
+ },
28
+ "required": [
29
+ "ver",
30
+ "date",
31
+ "txt"
32
+ ],
33
+ "additionalProperties": false
34
+ }
35
+ }