5etools-utils 0.15.5 → 0.15.7
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.
- package/README.md +13 -13
- package/bin/clean-html.js +0 -0
- package/bin/test-edition-sources.js +0 -0
- package/bin/test-file-contents.js +0 -0
- package/bin/test-file-locations.js +0 -0
- package/bin/test-file-names.js +0 -0
- package/bin/test-file-props.js +0 -0
- package/bin/test-img-file-extensions.js +0 -0
- package/bin/test-img-file-sizes.js +0 -0
- package/bin/test-img-source-names-brew.js +0 -0
- package/bin/test-img-source-names-ua.js +0 -0
- package/bin/test-json-brew.js +0 -0
- package/bin/test-json-ua.js +0 -0
- package/lib/BrewCleaner.js +3 -11
- package/package.json +1 -1
- package/schema/brew/homebrew.json +11 -1
- package/schema/brew-fast/homebrew.json +11 -1
- package/schema/site/homebrew.json +11 -1
- package/schema/site-fast/homebrew.json +11 -1
- package/schema/ua/homebrew.json +11 -1
- package/schema/ua-fast/homebrew.json +11 -1
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# 5etools Utils
|
|
2
|
-
|
|
3
|
-
Available commands:
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
npx clean-html
|
|
7
|
-
npx test-file-names [--name-regex <regex>]
|
|
8
|
-
npx test-file-contents --img-repo-name <repo> --url-prefix-expected <prefix>
|
|
9
|
-
npx test-json-brew [file] [--dir <dir>]
|
|
10
|
-
npx test-json-ua [file] [--dir <dir>]
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
And more; see `bin/`.
|
|
1
|
+
# 5etools Utils
|
|
2
|
+
|
|
3
|
+
Available commands:
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npx clean-html
|
|
7
|
+
npx test-file-names [--name-regex <regex>]
|
|
8
|
+
npx test-file-contents --img-repo-name <repo> --url-prefix-expected <prefix>
|
|
9
|
+
npx test-json-brew [file] [--dir <dir>]
|
|
10
|
+
npx test-json-ua [file] [--dir <dir>]
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And more; see `bin/`.
|
package/bin/clean-html.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/bin/test-file-names.js
CHANGED
|
File without changes
|
package/bin/test-file-props.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/bin/test-json-brew.js
CHANGED
|
File without changes
|
package/bin/test-json-ua.js
CHANGED
|
File without changes
|
package/lib/BrewCleaner.js
CHANGED
|
@@ -158,7 +158,7 @@ export class BrewCleaner {
|
|
|
158
158
|
jsonOut = getCleanJson(jsonOut);
|
|
159
159
|
|
|
160
160
|
if (isDry) {
|
|
161
|
-
if (jsonOut !== raw)
|
|
161
|
+
if (jsonOut !== raw) Um.warn(`CLEANER`, `"${file}" would be reformatted!`);
|
|
162
162
|
continue;
|
|
163
163
|
}
|
|
164
164
|
|
|
@@ -170,27 +170,19 @@ export class BrewCleaner {
|
|
|
170
170
|
throw new Error(`Errors were found. See above.`);
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
return
|
|
173
|
+
return files.length;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
static run ({isDry = false} = {}) {
|
|
177
177
|
const tStart = Date.now();
|
|
178
178
|
|
|
179
179
|
let ttlFiles = 0;
|
|
180
|
-
let ttlErrors = 0;
|
|
181
180
|
|
|
182
181
|
Uf.runOnDirs((dir) => {
|
|
183
182
|
Um.info(`CLEANER`, `${isDry ? "Checking" : "Cleaning"} dir "${dir}"...`);
|
|
184
|
-
|
|
185
|
-
ttlFiles += cntFiles;
|
|
186
|
-
ttlErrors += cntErrors;
|
|
183
|
+
ttlFiles += this._cleanFolder({dir, isDry});
|
|
187
184
|
});
|
|
188
185
|
|
|
189
186
|
Um.info(`CLEANER`, `${isDry ? "Check" : "Cleaning"} complete. ${isDry ? "Checked" : "Cleaned"} ${ttlFiles} file${ttlFiles === 1 ? "" : "s"}. Ran in ${((Date.now() - tStart) / 1000).toFixed(2)}s.`);
|
|
190
|
-
|
|
191
|
-
if (ttlErrors && isDry) {
|
|
192
|
-
Um.info(`CLEANER`, `Found ${ttlErrors} error${ttlErrors === 1 ? "" : "s"}!`);
|
|
193
|
-
process.exit(1);
|
|
194
|
-
}
|
|
195
187
|
}
|
|
196
188
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.7",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"description": "Homebrew for 5etools. Should include arrays titled similarly to the main site data, e.g. `spell` or `class`",
|
|
6
6
|
"$defs": {
|
|
@@ -315,6 +315,16 @@
|
|
|
315
315
|
},
|
|
316
316
|
"markdownDescription": "Structure as per "dependencies". Additional sources to be included when loading the file."
|
|
317
317
|
},
|
|
318
|
+
"references": {
|
|
319
|
+
"description": "A \"soft\" alternative to `\"dependencies\"`, used only for data validation (and may therefore be omitted).\n\nAn array of `[\"<NonSiteJsonSource1>\", ..., \"<NonSiteJsonSourceN>\"]`. Entities from these sources will be made available when running e.g. 5etools' `test-tags.js`.",
|
|
320
|
+
"type": "array",
|
|
321
|
+
"items": {
|
|
322
|
+
"type": "string"
|
|
323
|
+
},
|
|
324
|
+
"minItems": 1,
|
|
325
|
+
"uniqueItems": true,
|
|
326
|
+
"markdownDescription": "A "soft" alternative to "dependencies", used only for data validation (and may therefore be omitted).\n\nAn array of ["<NonSiteJsonSource1>", ..., "<NonSiteJsonSourceN>"]. Entities from these sources will be made available when running e.g. 5etools' test-tags.js."
|
|
327
|
+
},
|
|
318
328
|
"internalCopies": {
|
|
319
329
|
"description": "An array of keys that are copied from within the current document. e.g. \"item\", \"monsterFluff\", \"background\" etc.",
|
|
320
330
|
"type": "array",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.7",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"description": "Homebrew for 5etools. Should include arrays titled similarly to the main site data, e.g. `spell` or `class`",
|
|
6
6
|
"$defs": {
|
|
@@ -313,6 +313,16 @@
|
|
|
313
313
|
},
|
|
314
314
|
"markdownDescription": "Structure as per "dependencies". Additional sources to be included when loading the file."
|
|
315
315
|
},
|
|
316
|
+
"references": {
|
|
317
|
+
"description": "A \"soft\" alternative to `\"dependencies\"`, used only for data validation (and may therefore be omitted).\n\nAn array of `[\"<NonSiteJsonSource1>\", ..., \"<NonSiteJsonSourceN>\"]`. Entities from these sources will be made available when running e.g. 5etools' `test-tags.js`.",
|
|
318
|
+
"type": "array",
|
|
319
|
+
"items": {
|
|
320
|
+
"type": "string"
|
|
321
|
+
},
|
|
322
|
+
"minItems": 1,
|
|
323
|
+
"uniqueItems": true,
|
|
324
|
+
"markdownDescription": "A "soft" alternative to "dependencies", used only for data validation (and may therefore be omitted).\n\nAn array of ["<NonSiteJsonSource1>", ..., "<NonSiteJsonSourceN>"]. Entities from these sources will be made available when running e.g. 5etools' test-tags.js."
|
|
325
|
+
},
|
|
316
326
|
"internalCopies": {
|
|
317
327
|
"description": "An array of keys that are copied from within the current document. e.g. \"item\", \"monsterFluff\", \"background\" etc.",
|
|
318
328
|
"type": "array",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.7",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"description": "Homebrew for 5etools. Should include arrays titled similarly to the main site data, e.g. `spell` or `class`",
|
|
6
6
|
"$defs": {
|
|
@@ -315,6 +315,16 @@
|
|
|
315
315
|
},
|
|
316
316
|
"markdownDescription": "Structure as per "dependencies". Additional sources to be included when loading the file."
|
|
317
317
|
},
|
|
318
|
+
"references": {
|
|
319
|
+
"description": "A \"soft\" alternative to `\"dependencies\"`, used only for data validation (and may therefore be omitted).\n\nAn array of `[\"<NonSiteJsonSource1>\", ..., \"<NonSiteJsonSourceN>\"]`. Entities from these sources will be made available when running e.g. 5etools' `test-tags.js`.",
|
|
320
|
+
"type": "array",
|
|
321
|
+
"items": {
|
|
322
|
+
"type": "string"
|
|
323
|
+
},
|
|
324
|
+
"minItems": 1,
|
|
325
|
+
"uniqueItems": true,
|
|
326
|
+
"markdownDescription": "A "soft" alternative to "dependencies", used only for data validation (and may therefore be omitted).\n\nAn array of ["<NonSiteJsonSource1>", ..., "<NonSiteJsonSourceN>"]. Entities from these sources will be made available when running e.g. 5etools' test-tags.js."
|
|
327
|
+
},
|
|
318
328
|
"internalCopies": {
|
|
319
329
|
"description": "An array of keys that are copied from within the current document. e.g. \"item\", \"monsterFluff\", \"background\" etc.",
|
|
320
330
|
"type": "array",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.7",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"description": "Homebrew for 5etools. Should include arrays titled similarly to the main site data, e.g. `spell` or `class`",
|
|
6
6
|
"$defs": {
|
|
@@ -313,6 +313,16 @@
|
|
|
313
313
|
},
|
|
314
314
|
"markdownDescription": "Structure as per "dependencies". Additional sources to be included when loading the file."
|
|
315
315
|
},
|
|
316
|
+
"references": {
|
|
317
|
+
"description": "A \"soft\" alternative to `\"dependencies\"`, used only for data validation (and may therefore be omitted).\n\nAn array of `[\"<NonSiteJsonSource1>\", ..., \"<NonSiteJsonSourceN>\"]`. Entities from these sources will be made available when running e.g. 5etools' `test-tags.js`.",
|
|
318
|
+
"type": "array",
|
|
319
|
+
"items": {
|
|
320
|
+
"type": "string"
|
|
321
|
+
},
|
|
322
|
+
"minItems": 1,
|
|
323
|
+
"uniqueItems": true,
|
|
324
|
+
"markdownDescription": "A "soft" alternative to "dependencies", used only for data validation (and may therefore be omitted).\n\nAn array of ["<NonSiteJsonSource1>", ..., "<NonSiteJsonSourceN>"]. Entities from these sources will be made available when running e.g. 5etools' test-tags.js."
|
|
325
|
+
},
|
|
316
326
|
"internalCopies": {
|
|
317
327
|
"description": "An array of keys that are copied from within the current document. e.g. \"item\", \"monsterFluff\", \"background\" etc.",
|
|
318
328
|
"type": "array",
|
package/schema/ua/homebrew.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.7",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"description": "Homebrew for 5etools. Should include arrays titled similarly to the main site data, e.g. `spell` or `class`",
|
|
6
6
|
"$defs": {
|
|
@@ -315,6 +315,16 @@
|
|
|
315
315
|
},
|
|
316
316
|
"markdownDescription": "Structure as per "dependencies". Additional sources to be included when loading the file."
|
|
317
317
|
},
|
|
318
|
+
"references": {
|
|
319
|
+
"description": "A \"soft\" alternative to `\"dependencies\"`, used only for data validation (and may therefore be omitted).\n\nAn array of `[\"<NonSiteJsonSource1>\", ..., \"<NonSiteJsonSourceN>\"]`. Entities from these sources will be made available when running e.g. 5etools' `test-tags.js`.",
|
|
320
|
+
"type": "array",
|
|
321
|
+
"items": {
|
|
322
|
+
"type": "string"
|
|
323
|
+
},
|
|
324
|
+
"minItems": 1,
|
|
325
|
+
"uniqueItems": true,
|
|
326
|
+
"markdownDescription": "A "soft" alternative to "dependencies", used only for data validation (and may therefore be omitted).\n\nAn array of ["<NonSiteJsonSource1>", ..., "<NonSiteJsonSourceN>"]. Entities from these sources will be made available when running e.g. 5etools' test-tags.js."
|
|
327
|
+
},
|
|
318
328
|
"internalCopies": {
|
|
319
329
|
"description": "An array of keys that are copied from within the current document. e.g. \"item\", \"monsterFluff\", \"background\" etc.",
|
|
320
330
|
"type": "array",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.7",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"description": "Homebrew for 5etools. Should include arrays titled similarly to the main site data, e.g. `spell` or `class`",
|
|
6
6
|
"$defs": {
|
|
@@ -313,6 +313,16 @@
|
|
|
313
313
|
},
|
|
314
314
|
"markdownDescription": "Structure as per "dependencies". Additional sources to be included when loading the file."
|
|
315
315
|
},
|
|
316
|
+
"references": {
|
|
317
|
+
"description": "A \"soft\" alternative to `\"dependencies\"`, used only for data validation (and may therefore be omitted).\n\nAn array of `[\"<NonSiteJsonSource1>\", ..., \"<NonSiteJsonSourceN>\"]`. Entities from these sources will be made available when running e.g. 5etools' `test-tags.js`.",
|
|
318
|
+
"type": "array",
|
|
319
|
+
"items": {
|
|
320
|
+
"type": "string"
|
|
321
|
+
},
|
|
322
|
+
"minItems": 1,
|
|
323
|
+
"uniqueItems": true,
|
|
324
|
+
"markdownDescription": "A "soft" alternative to "dependencies", used only for data validation (and may therefore be omitted).\n\nAn array of ["<NonSiteJsonSource1>", ..., "<NonSiteJsonSourceN>"]. Entities from these sources will be made available when running e.g. 5etools' test-tags.js."
|
|
325
|
+
},
|
|
316
326
|
"internalCopies": {
|
|
317
327
|
"description": "An array of keys that are copied from within the current document. e.g. \"item\", \"monsterFluff\", \"background\" etc.",
|
|
318
328
|
"type": "array",
|