5etools-utils 0.6.4 → 0.7.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.
- package/README.md +7 -0
- package/bin/test-json-brew.js +5 -0
- package/lib/BrewTester.js +12 -1
- package/package.json +4 -1
- package/schema/brew/bestiary/bestiary.json +4 -1
- package/schema/brew-fast/bestiary/bestiary.json +4 -1
- package/schema/site/bestiary/bestiary.json +4 -1
- package/schema/site-fast/bestiary/bestiary.json +4 -1
package/README.md
ADDED
package/lib/BrewTester.js
CHANGED
|
@@ -2,6 +2,7 @@ import * as fs from "fs";
|
|
|
2
2
|
import {Command} from "commander";
|
|
3
3
|
import Um from "./UtilMisc.js";
|
|
4
4
|
import {JsonTester} from "./TestJson.js";
|
|
5
|
+
import {listJsonFiles} from "./UtilFs.js";
|
|
5
6
|
|
|
6
7
|
class _BrewTesterJson {
|
|
7
8
|
static _LOG_TAG = "JSON";
|
|
@@ -10,15 +11,20 @@ class _BrewTesterJson {
|
|
|
10
11
|
static async pRun (args) {
|
|
11
12
|
const program = new Command()
|
|
12
13
|
.argument("[file]", "File to test")
|
|
14
|
+
.option("--dir <dir>", "Directory to test")
|
|
13
15
|
;
|
|
14
16
|
|
|
15
17
|
program.parse(args);
|
|
18
|
+
const opts = program.opts();
|
|
16
19
|
|
|
17
20
|
const jsonTester = new JsonTester({isBrew: true, tagLog: this._LOG_TAG, fnGetSchemaId: () => "homebrew.json"});
|
|
18
21
|
|
|
19
22
|
let results;
|
|
20
23
|
if (program.args[0]) {
|
|
21
24
|
results = jsonTester.getFileErrors({filePath: program.args[0]});
|
|
25
|
+
} else if (opts.dir) {
|
|
26
|
+
const fileList = listJsonFiles(opts.dir);
|
|
27
|
+
results = await jsonTester.pGetErrorsOnDirsWorkers({isFailFast: !this._IS_FAIL_SLOW, fileList: fileList});
|
|
22
28
|
} else {
|
|
23
29
|
results = await jsonTester.pGetErrorsOnDirsWorkers({isFailFast: !this._IS_FAIL_SLOW});
|
|
24
30
|
}
|
|
@@ -26,7 +32,12 @@ class _BrewTesterJson {
|
|
|
26
32
|
const {errors, errorsFull} = results;
|
|
27
33
|
|
|
28
34
|
if (errors.length) {
|
|
29
|
-
if (!process.env.CI)
|
|
35
|
+
if (!process.env.CI) {
|
|
36
|
+
const outDir = fs.existsSync("_test") && fs.lstatSync("_test").isDirectory()
|
|
37
|
+
? "_test"
|
|
38
|
+
: ".";
|
|
39
|
+
fs.writeFileSync(`${outDir}/test-json.error.log`, errorsFull.join("\n\n=====\n\n"));
|
|
40
|
+
}
|
|
30
41
|
console.error(`Schema test failed (${errors.length} failure${errors.length === 1 ? "" : "s"}).`);
|
|
31
42
|
process.exit(1);
|
|
32
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "5etools-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Shared utilities for the 5etools ecosystem.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/Api.js",
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
"directories": {
|
|
12
12
|
"lib": "./lib"
|
|
13
13
|
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"test-json-brew": "bin/test-json-brew.js"
|
|
16
|
+
},
|
|
14
17
|
"scripts": {
|
|
15
18
|
"build": "node node/compile-schemas.js",
|
|
16
19
|
"test": "npm run lint:js && npm run test:js",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.14",
|
|
4
4
|
"title": "Bestiary Schema",
|
|
5
5
|
"$id": "bestiary.json",
|
|
6
6
|
"type": "object",
|
|
@@ -993,6 +993,7 @@
|
|
|
993
993
|
"Spider Climb",
|
|
994
994
|
"Sunlight Sensitivity",
|
|
995
995
|
"Tree Stride",
|
|
996
|
+
"Tunneler",
|
|
996
997
|
"Turn Immunity",
|
|
997
998
|
"Turn Resistance",
|
|
998
999
|
"Undead Fortitude",
|
|
@@ -2165,6 +2166,7 @@
|
|
|
2165
2166
|
"Spider Climb",
|
|
2166
2167
|
"Sunlight Sensitivity",
|
|
2167
2168
|
"Tree Stride",
|
|
2169
|
+
"Tunneler",
|
|
2168
2170
|
"Turn Immunity",
|
|
2169
2171
|
"Turn Resistance",
|
|
2170
2172
|
"Undead Fortitude",
|
|
@@ -3352,6 +3354,7 @@
|
|
|
3352
3354
|
"Spider Climb",
|
|
3353
3355
|
"Sunlight Sensitivity",
|
|
3354
3356
|
"Tree Stride",
|
|
3357
|
+
"Tunneler",
|
|
3355
3358
|
"Turn Immunity",
|
|
3356
3359
|
"Turn Resistance",
|
|
3357
3360
|
"Undead Fortitude",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.14",
|
|
4
4
|
"title": "Bestiary Schema",
|
|
5
5
|
"$id": "bestiary.json",
|
|
6
6
|
"type": "object",
|
|
@@ -993,6 +993,7 @@
|
|
|
993
993
|
"Spider Climb",
|
|
994
994
|
"Sunlight Sensitivity",
|
|
995
995
|
"Tree Stride",
|
|
996
|
+
"Tunneler",
|
|
996
997
|
"Turn Immunity",
|
|
997
998
|
"Turn Resistance",
|
|
998
999
|
"Undead Fortitude",
|
|
@@ -2165,6 +2166,7 @@
|
|
|
2165
2166
|
"Spider Climb",
|
|
2166
2167
|
"Sunlight Sensitivity",
|
|
2167
2168
|
"Tree Stride",
|
|
2169
|
+
"Tunneler",
|
|
2168
2170
|
"Turn Immunity",
|
|
2169
2171
|
"Turn Resistance",
|
|
2170
2172
|
"Undead Fortitude",
|
|
@@ -3352,6 +3354,7 @@
|
|
|
3352
3354
|
"Spider Climb",
|
|
3353
3355
|
"Sunlight Sensitivity",
|
|
3354
3356
|
"Tree Stride",
|
|
3357
|
+
"Tunneler",
|
|
3355
3358
|
"Turn Immunity",
|
|
3356
3359
|
"Turn Resistance",
|
|
3357
3360
|
"Undead Fortitude",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.14",
|
|
4
4
|
"title": "Bestiary Schema",
|
|
5
5
|
"$id": "bestiary.json",
|
|
6
6
|
"type": "object",
|
|
@@ -972,6 +972,7 @@
|
|
|
972
972
|
"Spider Climb",
|
|
973
973
|
"Sunlight Sensitivity",
|
|
974
974
|
"Tree Stride",
|
|
975
|
+
"Tunneler",
|
|
975
976
|
"Turn Immunity",
|
|
976
977
|
"Turn Resistance",
|
|
977
978
|
"Undead Fortitude",
|
|
@@ -2048,6 +2049,7 @@
|
|
|
2048
2049
|
"Spider Climb",
|
|
2049
2050
|
"Sunlight Sensitivity",
|
|
2050
2051
|
"Tree Stride",
|
|
2052
|
+
"Tunneler",
|
|
2051
2053
|
"Turn Immunity",
|
|
2052
2054
|
"Turn Resistance",
|
|
2053
2055
|
"Undead Fortitude",
|
|
@@ -3139,6 +3141,7 @@
|
|
|
3139
3141
|
"Spider Climb",
|
|
3140
3142
|
"Sunlight Sensitivity",
|
|
3141
3143
|
"Tree Stride",
|
|
3144
|
+
"Tunneler",
|
|
3142
3145
|
"Turn Immunity",
|
|
3143
3146
|
"Turn Resistance",
|
|
3144
3147
|
"Undead Fortitude",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.14",
|
|
4
4
|
"title": "Bestiary Schema",
|
|
5
5
|
"$id": "bestiary.json",
|
|
6
6
|
"type": "object",
|
|
@@ -972,6 +972,7 @@
|
|
|
972
972
|
"Spider Climb",
|
|
973
973
|
"Sunlight Sensitivity",
|
|
974
974
|
"Tree Stride",
|
|
975
|
+
"Tunneler",
|
|
975
976
|
"Turn Immunity",
|
|
976
977
|
"Turn Resistance",
|
|
977
978
|
"Undead Fortitude",
|
|
@@ -2048,6 +2049,7 @@
|
|
|
2048
2049
|
"Spider Climb",
|
|
2049
2050
|
"Sunlight Sensitivity",
|
|
2050
2051
|
"Tree Stride",
|
|
2052
|
+
"Tunneler",
|
|
2051
2053
|
"Turn Immunity",
|
|
2052
2054
|
"Turn Resistance",
|
|
2053
2055
|
"Undead Fortitude",
|
|
@@ -3139,6 +3141,7 @@
|
|
|
3139
3141
|
"Spider Climb",
|
|
3140
3142
|
"Sunlight Sensitivity",
|
|
3141
3143
|
"Tree Stride",
|
|
3144
|
+
"Tunneler",
|
|
3142
3145
|
"Turn Immunity",
|
|
3143
3146
|
"Turn Resistance",
|
|
3144
3147
|
"Undead Fortitude",
|