5etools-utils 0.10.6 → 0.10.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.
@@ -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.7",
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
  }