5etools-utils 0.11.3 → 0.12.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 +16 -6
- package/package.json +1 -1
- package/bin/test-file-extensions.js +0 -5
package/lib/BrewTester.js
CHANGED
|
@@ -77,23 +77,33 @@ class _BrewTesterFileLocations {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
class
|
|
81
|
-
static _LOG_TAG = `
|
|
80
|
+
class _BrewTesterFileNames {
|
|
81
|
+
static _LOG_TAG = `FILE_NAME`;
|
|
82
|
+
|
|
83
|
+
static _RE_NAME_FORMAT = /^[^;]+; .+\.json$/;
|
|
82
84
|
|
|
83
85
|
static run () {
|
|
84
|
-
Um.info(this._LOG_TAG, `Testing for incorrect file
|
|
86
|
+
Um.info(this._LOG_TAG, `Testing for incorrect file names...`);
|
|
85
87
|
|
|
86
88
|
const errors = [];
|
|
87
89
|
|
|
88
90
|
Uf.runOnDirs((dir) => {
|
|
91
|
+
const filenames = fs.readdirSync(dir);
|
|
92
|
+
|
|
89
93
|
errors.push(
|
|
90
|
-
...
|
|
94
|
+
...filenames
|
|
91
95
|
.filter(it => !it.endsWith(".json"))
|
|
92
96
|
.map(it => `File did not have ".json" extension: ${it}`),
|
|
93
97
|
);
|
|
98
|
+
|
|
99
|
+
errors.push(
|
|
100
|
+
...filenames
|
|
101
|
+
.filter(it => !this._RE_NAME_FORMAT.test(it))
|
|
102
|
+
.map(it => `Filename did not match expected pattern "${this._RE_NAME_FORMAT.toString()}" extension: ${it}`),
|
|
103
|
+
);
|
|
94
104
|
});
|
|
95
105
|
|
|
96
|
-
if (!errors.length) return Um.info(this._LOG_TAG, `Files had expected
|
|
106
|
+
if (!errors.length) return Um.info(this._LOG_TAG, `Files had expected names.`);
|
|
97
107
|
|
|
98
108
|
errors.forEach(it => console.error(it));
|
|
99
109
|
process.exit(1);
|
|
@@ -103,7 +113,7 @@ class _BrewTesterFileExtensions {
|
|
|
103
113
|
class BrewTester {
|
|
104
114
|
static async pTestJson (args, opts) { return _BrewTesterJson.pRun(args, opts); }
|
|
105
115
|
static testFileLocations () { return _BrewTesterFileLocations.run(); }
|
|
106
|
-
static
|
|
116
|
+
static testFileNames () { return _BrewTesterFileNames.run(); }
|
|
107
117
|
}
|
|
108
118
|
|
|
109
119
|
export {BrewTester};
|
package/package.json
CHANGED