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 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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -158,7 +158,7 @@ export class BrewCleaner {
158
158
  jsonOut = getCleanJson(jsonOut);
159
159
 
160
160
  if (isDry) {
161
- if (jsonOut !== raw) ALL_ERRORS.push(`${file} would be reformatted!`);
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 {cntFiles: files.length, cntErrors: ALL_ERRORS.length};
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
- const {cntFiles, cntErrors} = this._cleanFolder({dir, isDry});
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
  "name": "5etools-utils",
3
- "version": "0.15.5",
3
+ "version": "0.15.7",
4
4
  "description": "Shared utilities for the 5etools ecosystem.",
5
5
  "type": "module",
6
6
  "main": "lib/Api.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "version": "1.11.6",
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 &quot;dependencies&quot;. 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 &quot;soft&quot; alternative to &quot;dependencies&quot;, used only for data validation (and may therefore be omitted).\n\nAn array of [&quot;&lt;NonSiteJsonSource1&gt;&quot;, ..., &quot;&lt;NonSiteJsonSourceN&gt;&quot;]. Entities from these sources will be made available when running e.g. 5etools&apos; 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.6",
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 &quot;dependencies&quot;. 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 &quot;soft&quot; alternative to &quot;dependencies&quot;, used only for data validation (and may therefore be omitted).\n\nAn array of [&quot;&lt;NonSiteJsonSource1&gt;&quot;, ..., &quot;&lt;NonSiteJsonSourceN&gt;&quot;]. Entities from these sources will be made available when running e.g. 5etools&apos; 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.6",
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 &quot;dependencies&quot;. 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 &quot;soft&quot; alternative to &quot;dependencies&quot;, used only for data validation (and may therefore be omitted).\n\nAn array of [&quot;&lt;NonSiteJsonSource1&gt;&quot;, ..., &quot;&lt;NonSiteJsonSourceN&gt;&quot;]. Entities from these sources will be made available when running e.g. 5etools&apos; 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.6",
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 &quot;dependencies&quot;. 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 &quot;soft&quot; alternative to &quot;dependencies&quot;, used only for data validation (and may therefore be omitted).\n\nAn array of [&quot;&lt;NonSiteJsonSource1&gt;&quot;, ..., &quot;&lt;NonSiteJsonSourceN&gt;&quot;]. Entities from these sources will be made available when running e.g. 5etools&apos; 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.6",
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 &quot;dependencies&quot;. 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 &quot;soft&quot; alternative to &quot;dependencies&quot;, used only for data validation (and may therefore be omitted).\n\nAn array of [&quot;&lt;NonSiteJsonSource1&gt;&quot;, ..., &quot;&lt;NonSiteJsonSourceN&gt;&quot;]. Entities from these sources will be made available when running e.g. 5etools&apos; 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.6",
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 &quot;dependencies&quot;. 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 &quot;soft&quot; alternative to &quot;dependencies&quot;, used only for data validation (and may therefore be omitted).\n\nAn array of [&quot;&lt;NonSiteJsonSource1&gt;&quot;, ..., &quot;&lt;NonSiteJsonSourceN&gt;&quot;]. Entities from these sources will be made available when running e.g. 5etools&apos; 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",