5etools-utils 0.10.6 → 0.10.8

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.
@@ -2,10 +2,10 @@ import {execFile} from "node:child_process";
2
2
  import * as Uf from "./UtilFs.js";
3
3
  import Um from "./UtilMisc.js";
4
4
  import fs from "fs";
5
- import hasha from "hasha";
5
+ import {hash} from "hasha";
6
6
  import {getCleanJson} from "./UtilClean.js";
7
7
 
8
- class BrewTimestamper {
8
+ export class BrewTimestamper {
9
9
  static _LOG_TAG = `TIMESTAMPS`;
10
10
 
11
11
  static _UPDATE_TYPES = {
@@ -29,7 +29,7 @@ class BrewTimestamper {
29
29
  // is stable when changing date values.
30
30
  const toHashObj = {...fileData.json};
31
31
  toHashObj._meta = {...toHashObj._meta, dateAdded: undefined, dateLastModified: undefined, _dateLastModifiedHash: undefined};
32
- const expectedHash = (await hasha.async(JSON.stringify(toHashObj))).slice(0, 10);
32
+ const expectedHash = await this._pGetHash(toHashObj);
33
33
 
34
34
  if (!fileData.json._meta._dateLastModifiedHash) {
35
35
  updateType = this._UPDATE_TYPES.HASH;
@@ -85,6 +85,10 @@ class BrewTimestamper {
85
85
  await Promise.all(promises);
86
86
  }
87
87
 
88
+ static async _pGetHash (obj) {
89
+ return (await hash(JSON.stringify(obj))).slice(0, 10);
90
+ }
91
+
88
92
  static async pRun () {
89
93
  await Uf.pRunOnDirs(
90
94
  async (dir) => {
@@ -98,5 +102,3 @@ class BrewTimestamper {
98
102
  Um.info(this._LOG_TAG, "Done!");
99
103
  }
100
104
  }
101
-
102
- export {BrewTimestamper};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "5etools-utils",
3
- "version": "0.10.6",
3
+ "version": "0.10.8",
4
4
  "description": "Shared utilities for the 5etools ecosystem.",
5
5
  "type": "module",
6
6
  "main": "lib/Api.js",
@@ -38,13 +38,13 @@
38
38
  "dependencies": {
39
39
  "ajv": "^8.12.0",
40
40
  "ajv-formats": "^2.1.1",
41
- "commander": "^9.4.1",
42
- "hasha": "^5.2.2",
41
+ "commander": "^12.0.0",
42
+ "hasha": "^6.0.0",
43
43
  "json-source-map": "^0.6.1",
44
44
  "number-precision": "^1.6.0"
45
45
  },
46
46
  "devDependencies": {
47
- "eslint": "^8.11.0",
48
- "jest": "^29.3.1"
47
+ "eslint": "^8.56.0",
48
+ "jest": "^29.7.0"
49
49
  }
50
50
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "version": "1.21.25",
3
+ "version": "1.21.26",
4
4
  "title": "Bestiary Schema",
5
5
  "$id": "bestiary.json",
6
6
  "type": "object",
@@ -210,7 +210,7 @@
210
210
  },
211
211
  "sidekickType": {
212
212
  "type": "string",
213
- "enum": [
213
+ "examples": [
214
214
  "expert",
215
215
  "spellcaster",
216
216
  "warrior"
@@ -1377,7 +1377,7 @@
1377
1377
  },
1378
1378
  "sidekickType": {
1379
1379
  "type": "string",
1380
- "enum": [
1380
+ "examples": [
1381
1381
  "expert",
1382
1382
  "spellcaster",
1383
1383
  "warrior"
@@ -2549,7 +2549,7 @@
2549
2549
  },
2550
2550
  "sidekickType": {
2551
2551
  "type": "string",
2552
- "enum": [
2552
+ "examples": [
2553
2553
  "expert",
2554
2554
  "spellcaster",
2555
2555
  "warrior"
@@ -109,6 +109,11 @@
109
109
  "ToFW",
110
110
  "MPP",
111
111
  "BMT",
112
+ "DMTCRG",
113
+ "GHLoE",
114
+ "DoDk",
115
+ "HWCS",
116
+ "HWAitW",
112
117
  "Screen",
113
118
  "ScreenWildernessKit",
114
119
  "ScreenDungeonKit",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "version": "1.21.25",
3
+ "version": "1.21.26",
4
4
  "title": "Bestiary Schema",
5
5
  "$id": "bestiary.json",
6
6
  "type": "object",
@@ -210,7 +210,7 @@
210
210
  },
211
211
  "sidekickType": {
212
212
  "type": "string",
213
- "enum": [
213
+ "examples": [
214
214
  "expert",
215
215
  "spellcaster",
216
216
  "warrior"
@@ -1377,7 +1377,7 @@
1377
1377
  },
1378
1378
  "sidekickType": {
1379
1379
  "type": "string",
1380
- "enum": [
1380
+ "examples": [
1381
1381
  "expert",
1382
1382
  "spellcaster",
1383
1383
  "warrior"
@@ -2549,7 +2549,7 @@
2549
2549
  },
2550
2550
  "sidekickType": {
2551
2551
  "type": "string",
2552
- "enum": [
2552
+ "examples": [
2553
2553
  "expert",
2554
2554
  "spellcaster",
2555
2555
  "warrior"
@@ -109,6 +109,11 @@
109
109
  "ToFW",
110
110
  "MPP",
111
111
  "BMT",
112
+ "DMTCRG",
113
+ "GHLoE",
114
+ "DoDk",
115
+ "HWCS",
116
+ "HWAitW",
112
117
  "Screen",
113
118
  "ScreenWildernessKit",
114
119
  "ScreenDungeonKit",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "version": "1.21.25",
3
+ "version": "1.21.26",
4
4
  "title": "Bestiary Schema",
5
5
  "$id": "bestiary.json",
6
6
  "type": "object",
@@ -109,6 +109,11 @@
109
109
  "ToFW",
110
110
  "MPP",
111
111
  "BMT",
112
+ "DMTCRG",
113
+ "GHLoE",
114
+ "DoDk",
115
+ "HWCS",
116
+ "HWAitW",
112
117
  "Screen",
113
118
  "ScreenWildernessKit",
114
119
  "ScreenDungeonKit",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "version": "1.21.25",
3
+ "version": "1.21.26",
4
4
  "title": "Bestiary Schema",
5
5
  "$id": "bestiary.json",
6
6
  "type": "object",
@@ -109,6 +109,11 @@
109
109
  "ToFW",
110
110
  "MPP",
111
111
  "BMT",
112
+ "DMTCRG",
113
+ "GHLoE",
114
+ "DoDk",
115
+ "HWCS",
116
+ "HWAitW",
112
117
  "Screen",
113
118
  "ScreenWildernessKit",
114
119
  "ScreenDungeonKit",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "version": "1.21.25",
3
+ "version": "1.21.26",
4
4
  "title": "Bestiary Schema",
5
5
  "$id": "bestiary.json",
6
6
  "type": "object",
@@ -109,6 +109,11 @@
109
109
  "ToFW",
110
110
  "MPP",
111
111
  "BMT",
112
+ "DMTCRG",
113
+ "GHLoE",
114
+ "DoDk",
115
+ "HWCS",
116
+ "HWAitW",
112
117
  "Screen",
113
118
  "ScreenWildernessKit",
114
119
  "ScreenDungeonKit",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "version": "1.21.25",
3
+ "version": "1.21.26",
4
4
  "title": "Bestiary Schema",
5
5
  "$id": "bestiary.json",
6
6
  "type": "object",
@@ -109,6 +109,11 @@
109
109
  "ToFW",
110
110
  "MPP",
111
111
  "BMT",
112
+ "DMTCRG",
113
+ "GHLoE",
114
+ "DoDk",
115
+ "HWCS",
116
+ "HWAitW",
112
117
  "Screen",
113
118
  "ScreenWildernessKit",
114
119
  "ScreenDungeonKit",