5etools-utils 0.7.6 → 0.8.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/lib/BrewTester.js
CHANGED
|
@@ -4,6 +4,7 @@ import Um from "./UtilMisc.js";
|
|
|
4
4
|
import {JsonTester} from "./TestJson.js";
|
|
5
5
|
import {listJsonFiles} from "./UtilFs.js";
|
|
6
6
|
import * as pathlib from "path";
|
|
7
|
+
import * as Uf from "./UtilFs.js";
|
|
7
8
|
|
|
8
9
|
class _BrewTesterJson {
|
|
9
10
|
static _LOG_TAG = "JSON";
|
|
@@ -70,9 +71,33 @@ class _BrewTesterFileLocations {
|
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
class _BrewTesterFileExtensions {
|
|
75
|
+
static _LOG_TAG = `FILE_EXTS`;
|
|
76
|
+
|
|
77
|
+
static run () {
|
|
78
|
+
Um.info(this._LOG_TAG, `Testing for incorrect file extensions...`);
|
|
79
|
+
|
|
80
|
+
const errors = [];
|
|
81
|
+
|
|
82
|
+
Uf.runOnDirs((dir) => {
|
|
83
|
+
errors.push(
|
|
84
|
+
...fs.readdirSync(dir)
|
|
85
|
+
.filter(it => !it.endsWith(".json"))
|
|
86
|
+
.map(it => `File did not have ".json" extension: ${it}`),
|
|
87
|
+
);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
if (!errors.length) return Um.info(this._LOG_TAG, `Files had expected extensions.`);
|
|
91
|
+
|
|
92
|
+
errors.forEach(it => console.error(it));
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
73
97
|
class BrewTester {
|
|
74
98
|
static async pTestJson (args) { return _BrewTesterJson.pRun(args); }
|
|
75
99
|
static testFileLocations () { return _BrewTesterFileLocations.run(); }
|
|
100
|
+
static testFileExtensions () { return _BrewTesterFileExtensions.run(); }
|
|
76
101
|
}
|
|
77
102
|
|
|
78
103
|
export {BrewTester};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "5etools-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Shared utilities for the 5etools ecosystem.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/Api.js",
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
"lib": "./lib"
|
|
13
13
|
},
|
|
14
14
|
"bin": {
|
|
15
|
-
"test-json-brew": "bin/test-json-brew.js"
|
|
15
|
+
"test-json-brew": "bin/test-json-brew.js",
|
|
16
|
+
"test-file-extensions": "bin/test-file-extensions.js",
|
|
17
|
+
"test-file-locations": "bin/test-file-locations.js"
|
|
16
18
|
},
|
|
17
19
|
"scripts": {
|
|
18
20
|
"build": "node node/compile-schemas.js",
|