5etools-utils 0.1.21 → 0.1.23

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/TestJson.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as path from "path";
2
2
 
3
3
  import Ajv from "ajv";
4
+ import addFormats from "ajv-formats"
4
5
  import * as jsonSourceMap from "json-source-map";
5
6
 
6
7
  import * as uf from "./UtilFs.js";
@@ -29,6 +30,7 @@ class JsonTester {
29
30
  this._ajv = new Ajv({
30
31
  allowUnionTypes: true,
31
32
  });
33
+ addFormats(this._ajv);
32
34
 
33
35
  this._ajv.addKeyword({
34
36
  keyword: "version",
@@ -127,7 +129,7 @@ class JsonTester {
127
129
  /**
128
130
  * @param dir
129
131
  * @param [opts]
130
- * @param [opts.dirBlacklist]
132
+ * @param [opts.dirBlocklist]
131
133
  */
132
134
  getErrors (dir, opts = {}) {
133
135
  um.info(this._tagLog, `Validating JSON against schema`);
package/lib/UtilFs.js CHANGED
@@ -32,20 +32,20 @@ function readJSON (path, {isIncludeRaw = false} = {}) {
32
32
  /**
33
33
  * @param dir
34
34
  * @param [opts]
35
- * @param [opts.dirBlacklist]
35
+ * @param [opts.dirBlocklist]
36
36
  * @param [state]
37
37
  */
38
38
  function listJsonFiles (dir, opts, state) {
39
- const {dirBlacklist = null} = opts || {};
39
+ const {dirBlocklist = null} = opts || {};
40
40
  state = state || {};
41
- state.dirBlacklist = state.dirBlacklist
42
- || (dirBlacklist ? new Set([...dirBlacklist].map(it => path.normalize(it))) : new Set());
41
+ state.dirBlocklist = state.dirBlocklist
42
+ || (dirBlocklist ? new Set([...dirBlocklist].map(it => path.normalize(it))) : new Set());
43
43
 
44
44
  const dirContent = fs.readdirSync(dir, "utf8")
45
45
  .map(file => dir === "." ? file : `${dir}/${file}`);
46
46
  return dirContent.reduce((acc, file) => {
47
47
  if (isDirectory(file)) {
48
- if (!state.dirBlacklist.has(path.normalize(file))) acc.push(...listJsonFiles(file, opts, state));
48
+ if (!state.dirBlocklist.has(path.normalize(file))) acc.push(...listJsonFiles(file, opts, state));
49
49
  } else {
50
50
  if (file.toLowerCase().endsWith(".json")) acc.push(file);
51
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "5etools-utils",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "description": "Shared utilities for the 5etools ecosystem.",
5
5
  "type": "module",
6
6
  "main": "lib/Api.js",
@@ -27,7 +27,8 @@
27
27
  "homepage": "https://github.com/TheGiddyLimit/5etools-utils#readme",
28
28
  "dependencies": {
29
29
  "ajv": "^8.11.0",
30
- "json-source-map": "^0.6.1"
30
+ "json-source-map": "^0.6.1",
31
+ "ajv-formats": "^2.1.1"
31
32
  },
32
33
  "devDependencies": {
33
34
  "eslint": "^8.11.0"