5etools-utils 0.16.3 → 0.16.5

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/UtilFs.js CHANGED
@@ -30,8 +30,8 @@ function readJsonSync (path, {isIncludeRaw = false} = {}) {
30
30
  }
31
31
  }
32
32
 
33
- function writeJsonSync (filePath, data, {isClean = false} = {}) {
34
- let str = `${JSON.stringify(data, null, "\t")}\n`;
33
+ function writeJsonSync (filePath, data, {isClean = false, isMinify = false} = {}) {
34
+ let str = `${isMinify ? JSON.stringify(data) : JSON.stringify(data, null, "\t")}\n`;
35
35
  if (isClean) str = getCleanString(str);
36
36
  return fs.writeFileSync(filePath, str, "utf-8");
37
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "5etools-utils",
3
- "version": "0.16.3",
3
+ "version": "0.16.5",
4
4
  "description": "Shared utilities for the 5etools ecosystem.",
5
5
  "type": "module",
6
6
  "main": "lib/Api.js",
@@ -42,6 +42,7 @@
42
42
  "test:js": "node --localstorage-file test/localstorage.tmp --experimental-vm-modules node_modules/jest/bin/jest.js",
43
43
  "lint": "npm run lint:js",
44
44
  "lint:js": "eslint lib node test --fix",
45
+ "lint:js:fast": "node bin/lint-js-changed.js",
45
46
  "preversion": "npm t"
46
47
  },
47
48
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "legendarygroups.json",
4
- "version": "1.2.3",
4
+ "version": "1.2.4",
5
5
  "type": "object",
6
6
  "$defs": {
7
7
  "legendaryGroupData": {
@@ -36,6 +36,9 @@
36
36
  "items": {
37
37
  "$ref": "../entry.json"
38
38
  }
39
+ },
40
+ "_versions": {
41
+ "$ref": "../util-copy.json#/$defs/versionsArray"
39
42
  }
40
43
  },
41
44
  "additionalProperties": false
@@ -74,6 +77,9 @@
74
77
  "items": {
75
78
  "$ref": "../entry.json"
76
79
  }
80
+ },
81
+ "_versions": {
82
+ "$ref": "../util-copy.json#/$defs/versionsArray"
77
83
  }
78
84
  },
79
85
  "additionalProperties": false,
@@ -115,6 +121,9 @@
115
121
  "$ref": "../entry.json"
116
122
  }
117
123
  },
124
+ "_versions": {
125
+ "$ref": "../util-copy.json#/$defs/versionsArray"
126
+ },
118
127
  "_copy": {
119
128
  "$ref": "../util-copy.json#/$defs/copyBlock_copy_generic"
120
129
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "$id": "template.json",
5
5
  "type": "object",
6
6
  "$defs": {
@@ -68,6 +68,35 @@
68
68
  },
69
69
  "additionalProperties": false
70
70
  },
71
+ "legendaryGroupTemplateData": {
72
+ "type": "object",
73
+ "properties": {
74
+ "name": {
75
+ "type": "string"
76
+ },
77
+ "source": {
78
+ "$ref": "../util.json#/$defs/source"
79
+ },
80
+ "page": {
81
+ "$ref": "../util.json#/$defs/page"
82
+ },
83
+ "ref": {
84
+ "type": "string"
85
+ },
86
+ "apply": {
87
+ "type": "object",
88
+ "properties": {
89
+ "_root": {
90
+ "$ref": "legendarygroups.json#/$defs/legendaryGroupData"
91
+ },
92
+ "_mod": {
93
+ "$ref": "../util-copy.json#/$defs/_modObject"
94
+ }
95
+ }
96
+ }
97
+ },
98
+ "additionalProperties": false
99
+ },
71
100
  "monsterTemplate": {
72
101
  "anyOf": [
73
102
  {
@@ -210,6 +239,79 @@
210
239
  ]
211
240
  }
212
241
  ]
242
+ },
243
+ "legendaryGroupTemplate": {
244
+ "anyOf": [
245
+ {
246
+ "type": "object",
247
+ "properties": {
248
+ "name": {
249
+ "type": "string"
250
+ },
251
+ "source": {
252
+ "$ref": "../util.json#/$defs/source"
253
+ },
254
+ "page": {
255
+ "$ref": "../util.json#/$defs/page"
256
+ },
257
+ "ref": {
258
+ "type": "string"
259
+ },
260
+ "apply": {
261
+ "type": "object",
262
+ "properties": {
263
+ "_root": {
264
+ "$ref": "legendarygroups.json#/$defs/legendaryGroupData"
265
+ },
266
+ "_mod": {
267
+ "$ref": "../util-copy.json#/$defs/_modObject"
268
+ }
269
+ }
270
+ }
271
+ },
272
+ "additionalProperties": false,
273
+ "required": [
274
+ "name",
275
+ "source",
276
+ "apply"
277
+ ]
278
+ },
279
+ {
280
+ "type": "object",
281
+ "properties": {
282
+ "name": {
283
+ "type": "string"
284
+ },
285
+ "source": {
286
+ "$ref": "../util.json#/$defs/source"
287
+ },
288
+ "page": {
289
+ "$ref": "../util.json#/$defs/page"
290
+ },
291
+ "ref": {
292
+ "type": "string"
293
+ },
294
+ "apply": {
295
+ "type": "object",
296
+ "properties": {
297
+ "_root": {
298
+ "$ref": "legendarygroups.json#/$defs/legendaryGroupData"
299
+ },
300
+ "_mod": {
301
+ "$ref": "../util-copy.json#/$defs/_modObject"
302
+ }
303
+ }
304
+ },
305
+ "_copy": {
306
+ "$ref": "../util-copy.json#/$defs/copyBlock_copy_generic"
307
+ }
308
+ },
309
+ "additionalProperties": false,
310
+ "required": [
311
+ "_copy"
312
+ ]
313
+ }
314
+ ]
213
315
  }
214
316
  },
215
317
  "properties": {
@@ -223,6 +325,14 @@
223
325
  "items": {
224
326
  "$ref": "#/$defs/monsterTemplate"
225
327
  }
328
+ },
329
+ "legendaryGroupTemplate": {
330
+ "type": "array",
331
+ "minItems": 1,
332
+ "uniqueItems": true,
333
+ "items": {
334
+ "$ref": "#/$defs/legendaryGroupTemplate"
335
+ }
226
336
  }
227
337
  },
228
338
  "additionalProperties": false
@@ -32,25 +32,7 @@
32
32
  "$ref": "util-copy.json#/$defs/_modObject"
33
33
  },
34
34
  "_templates": {
35
- "type": "array",
36
- "items": {
37
- "type": "object",
38
- "properties": {
39
- "name": {
40
- "type": "string"
41
- },
42
- "source": {
43
- "$ref": "util.json#/$defs/source"
44
- }
45
- },
46
- "required": [
47
- "name",
48
- "source"
49
- ],
50
- "additionalProperties": false
51
- },
52
- "minItems": 1,
53
- "uniqueItems": true
35
+ "$ref": "util-copy.json#/$defs/_templatesArray"
54
36
  },
55
37
  "_preserve": {
56
38
  "type": "object",
@@ -1493,25 +1475,7 @@
1493
1475
  "$ref": "util-copy.json#/$defs/_modObject"
1494
1476
  },
1495
1477
  "_templates": {
1496
- "type": "array",
1497
- "items": {
1498
- "type": "object",
1499
- "properties": {
1500
- "name": {
1501
- "type": "string"
1502
- },
1503
- "source": {
1504
- "$ref": "util.json#/$defs/source"
1505
- }
1506
- },
1507
- "required": [
1508
- "name",
1509
- "source"
1510
- ],
1511
- "additionalProperties": false
1512
- },
1513
- "minItems": 1,
1514
- "uniqueItems": true
1478
+ "$ref": "util-copy.json#/$defs/_templatesArray"
1515
1479
  },
1516
1480
  "_preserve": {
1517
1481
  "type": "object",
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "util-copy.json",
4
4
  "title": "Util: Copy",
5
- "version": "1.1.1",
5
+ "version": "1.1.2",
6
6
  "$defs": {
7
7
  "_mod_renameArr_rename": {
8
8
  "type": "object",
@@ -913,25 +913,7 @@
913
913
  "$ref": "#/$defs/_modObject"
914
914
  },
915
915
  "_templates": {
916
- "type": "array",
917
- "items": {
918
- "type": "object",
919
- "properties": {
920
- "name": {
921
- "type": "string"
922
- },
923
- "source": {
924
- "$ref": "util.json#/$defs/source"
925
- }
926
- },
927
- "required": [
928
- "name",
929
- "source"
930
- ],
931
- "additionalProperties": false
932
- },
933
- "minItems": 1,
934
- "uniqueItems": true
916
+ "$ref": "#/$defs/_templatesArray"
935
917
  },
936
918
  "_preserve": {
937
919
  "type": "object",
@@ -951,25 +933,7 @@
951
933
  "$ref": "#/$defs/_modObject"
952
934
  },
953
935
  "_templates": {
954
- "type": "array",
955
- "items": {
956
- "type": "object",
957
- "properties": {
958
- "name": {
959
- "type": "string"
960
- },
961
- "source": {
962
- "$ref": "util.json#/$defs/source"
963
- }
964
- },
965
- "required": [
966
- "name",
967
- "source"
968
- ],
969
- "additionalProperties": false
970
- },
971
- "minItems": 1,
972
- "uniqueItems": true
936
+ "$ref": "#/$defs/_templatesArray"
973
937
  },
974
938
  "_preserve": {
975
939
  "type": "object",
@@ -1062,6 +1026,11 @@
1062
1026
  "_mod": {
1063
1027
  "$ref": "#/$defs/_modObject"
1064
1028
  },
1029
+ "_templates": {
1030
+ "description": "Note that this is currently largely unsupported and unstable, and may be adjusted/removed in future.",
1031
+ "$ref": "#/$defs/_templatesArray",
1032
+ "markdownDescription": "Note that this is currently largely unsupported and unstable, and may be adjusted/removed in future."
1033
+ },
1065
1034
  "_preserve": {
1066
1035
  "description": "Note that, by default, all properties are preserved for a version. To avoid preserving properties, pass an empty object `{}`.",
1067
1036
  "$ref": "#/$defs/_preserveObject",
@@ -1161,6 +1130,27 @@
1161
1130
  }
1162
1131
  }
1163
1132
  },
1133
+ "_templatesArray": {
1134
+ "type": "array",
1135
+ "items": {
1136
+ "type": "object",
1137
+ "properties": {
1138
+ "name": {
1139
+ "type": "string"
1140
+ },
1141
+ "source": {
1142
+ "$ref": "util.json#/$defs/source"
1143
+ }
1144
+ },
1145
+ "required": [
1146
+ "name",
1147
+ "source"
1148
+ ],
1149
+ "additionalProperties": false
1150
+ },
1151
+ "minItems": 1,
1152
+ "uniqueItems": true
1153
+ },
1164
1154
  "copyableProps": {
1165
1155
  "type": "string",
1166
1156
  "description": "This is the list of props for which there is a `_copy` implementation. `_copy` may not be declared for props other than these.",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "legendarygroups.json",
4
- "version": "1.2.3",
4
+ "version": "1.2.4",
5
5
  "type": "object",
6
6
  "$defs": {
7
7
  "legendaryGroupData": {
@@ -36,6 +36,9 @@
36
36
  "items": {
37
37
  "$ref": "../entry.json"
38
38
  }
39
+ },
40
+ "_versions": {
41
+ "$ref": "../util-copy.json#/$defs/versionsArray"
39
42
  }
40
43
  },
41
44
  "additionalProperties": false
@@ -74,6 +77,9 @@
74
77
  "items": {
75
78
  "$ref": "../entry.json"
76
79
  }
80
+ },
81
+ "_versions": {
82
+ "$ref": "../util-copy.json#/$defs/versionsArray"
77
83
  }
78
84
  },
79
85
  "additionalProperties": false,
@@ -115,6 +121,9 @@
115
121
  "$ref": "../entry.json"
116
122
  }
117
123
  },
124
+ "_versions": {
125
+ "$ref": "../util-copy.json#/$defs/versionsArray"
126
+ },
118
127
  "_copy": {
119
128
  "$ref": "../util-copy.json#/$defs/copyBlock_copy_generic"
120
129
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "$id": "template.json",
5
5
  "type": "object",
6
6
  "$defs": {
@@ -68,6 +68,35 @@
68
68
  },
69
69
  "additionalProperties": false
70
70
  },
71
+ "legendaryGroupTemplateData": {
72
+ "type": "object",
73
+ "properties": {
74
+ "name": {
75
+ "type": "string"
76
+ },
77
+ "source": {
78
+ "$ref": "../util.json#/$defs/source"
79
+ },
80
+ "page": {
81
+ "$ref": "../util.json#/$defs/page"
82
+ },
83
+ "ref": {
84
+ "type": "string"
85
+ },
86
+ "apply": {
87
+ "type": "object",
88
+ "properties": {
89
+ "_root": {
90
+ "$ref": "legendarygroups.json#/$defs/legendaryGroupData"
91
+ },
92
+ "_mod": {
93
+ "$ref": "../util-copy.json#/$defs/_modObject"
94
+ }
95
+ }
96
+ }
97
+ },
98
+ "additionalProperties": false
99
+ },
71
100
  "monsterTemplate": {
72
101
  "anyOf": [
73
102
  {
@@ -210,6 +239,79 @@
210
239
  ]
211
240
  }
212
241
  ]
242
+ },
243
+ "legendaryGroupTemplate": {
244
+ "anyOf": [
245
+ {
246
+ "type": "object",
247
+ "properties": {
248
+ "name": {
249
+ "type": "string"
250
+ },
251
+ "source": {
252
+ "$ref": "../util.json#/$defs/source"
253
+ },
254
+ "page": {
255
+ "$ref": "../util.json#/$defs/page"
256
+ },
257
+ "ref": {
258
+ "type": "string"
259
+ },
260
+ "apply": {
261
+ "type": "object",
262
+ "properties": {
263
+ "_root": {
264
+ "$ref": "legendarygroups.json#/$defs/legendaryGroupData"
265
+ },
266
+ "_mod": {
267
+ "$ref": "../util-copy.json#/$defs/_modObject"
268
+ }
269
+ }
270
+ }
271
+ },
272
+ "additionalProperties": false,
273
+ "required": [
274
+ "name",
275
+ "source",
276
+ "apply"
277
+ ]
278
+ },
279
+ {
280
+ "type": "object",
281
+ "properties": {
282
+ "name": {
283
+ "type": "string"
284
+ },
285
+ "source": {
286
+ "$ref": "../util.json#/$defs/source"
287
+ },
288
+ "page": {
289
+ "$ref": "../util.json#/$defs/page"
290
+ },
291
+ "ref": {
292
+ "type": "string"
293
+ },
294
+ "apply": {
295
+ "type": "object",
296
+ "properties": {
297
+ "_root": {
298
+ "$ref": "legendarygroups.json#/$defs/legendaryGroupData"
299
+ },
300
+ "_mod": {
301
+ "$ref": "../util-copy.json#/$defs/_modObject"
302
+ }
303
+ }
304
+ },
305
+ "_copy": {
306
+ "$ref": "../util-copy.json#/$defs/copyBlock_copy_generic"
307
+ }
308
+ },
309
+ "additionalProperties": false,
310
+ "required": [
311
+ "_copy"
312
+ ]
313
+ }
314
+ ]
213
315
  }
214
316
  },
215
317
  "properties": {
@@ -223,6 +325,14 @@
223
325
  "items": {
224
326
  "$ref": "#/$defs/monsterTemplate"
225
327
  }
328
+ },
329
+ "legendaryGroupTemplate": {
330
+ "type": "array",
331
+ "minItems": 1,
332
+ "uniqueItems": true,
333
+ "items": {
334
+ "$ref": "#/$defs/legendaryGroupTemplate"
335
+ }
226
336
  }
227
337
  },
228
338
  "additionalProperties": false
@@ -32,25 +32,7 @@
32
32
  "$ref": "util-copy.json#/$defs/_modObject"
33
33
  },
34
34
  "_templates": {
35
- "type": "array",
36
- "items": {
37
- "type": "object",
38
- "properties": {
39
- "name": {
40
- "type": "string"
41
- },
42
- "source": {
43
- "$ref": "util.json#/$defs/source"
44
- }
45
- },
46
- "required": [
47
- "name",
48
- "source"
49
- ],
50
- "additionalProperties": false
51
- },
52
- "minItems": 1,
53
- "uniqueItems": true
35
+ "$ref": "util-copy.json#/$defs/_templatesArray"
54
36
  },
55
37
  "_preserve": {
56
38
  "type": "object",
@@ -1493,25 +1475,7 @@
1493
1475
  "$ref": "util-copy.json#/$defs/_modObject"
1494
1476
  },
1495
1477
  "_templates": {
1496
- "type": "array",
1497
- "items": {
1498
- "type": "object",
1499
- "properties": {
1500
- "name": {
1501
- "type": "string"
1502
- },
1503
- "source": {
1504
- "$ref": "util.json#/$defs/source"
1505
- }
1506
- },
1507
- "required": [
1508
- "name",
1509
- "source"
1510
- ],
1511
- "additionalProperties": false
1512
- },
1513
- "minItems": 1,
1514
- "uniqueItems": true
1478
+ "$ref": "util-copy.json#/$defs/_templatesArray"
1515
1479
  },
1516
1480
  "_preserve": {
1517
1481
  "type": "object",
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "util-copy.json",
4
4
  "title": "Util: Copy",
5
- "version": "1.1.1",
5
+ "version": "1.1.2",
6
6
  "$defs": {
7
7
  "_mod_renameArr_rename": {
8
8
  "type": "object",
@@ -913,25 +913,7 @@
913
913
  "$ref": "#/$defs/_modObject"
914
914
  },
915
915
  "_templates": {
916
- "type": "array",
917
- "items": {
918
- "type": "object",
919
- "properties": {
920
- "name": {
921
- "type": "string"
922
- },
923
- "source": {
924
- "$ref": "util.json#/$defs/source"
925
- }
926
- },
927
- "required": [
928
- "name",
929
- "source"
930
- ],
931
- "additionalProperties": false
932
- },
933
- "minItems": 1,
934
- "uniqueItems": true
916
+ "$ref": "#/$defs/_templatesArray"
935
917
  },
936
918
  "_preserve": {
937
919
  "type": "object",
@@ -951,25 +933,7 @@
951
933
  "$ref": "#/$defs/_modObject"
952
934
  },
953
935
  "_templates": {
954
- "type": "array",
955
- "items": {
956
- "type": "object",
957
- "properties": {
958
- "name": {
959
- "type": "string"
960
- },
961
- "source": {
962
- "$ref": "util.json#/$defs/source"
963
- }
964
- },
965
- "required": [
966
- "name",
967
- "source"
968
- ],
969
- "additionalProperties": false
970
- },
971
- "minItems": 1,
972
- "uniqueItems": true
936
+ "$ref": "#/$defs/_templatesArray"
973
937
  },
974
938
  "_preserve": {
975
939
  "type": "object",
@@ -1062,6 +1026,11 @@
1062
1026
  "_mod": {
1063
1027
  "$ref": "#/$defs/_modObject"
1064
1028
  },
1029
+ "_templates": {
1030
+ "description": "Note that this is currently largely unsupported and unstable, and may be adjusted/removed in future.",
1031
+ "$ref": "#/$defs/_templatesArray",
1032
+ "markdownDescription": "Note that this is currently largely unsupported and unstable, and may be adjusted/removed in future."
1033
+ },
1065
1034
  "_preserve": {
1066
1035
  "description": "Note that, by default, all properties are preserved for a version. To avoid preserving properties, pass an empty object `{}`.",
1067
1036
  "$ref": "#/$defs/_preserveObject",
@@ -1161,6 +1130,27 @@
1161
1130
  }
1162
1131
  }
1163
1132
  },
1133
+ "_templatesArray": {
1134
+ "type": "array",
1135
+ "items": {
1136
+ "type": "object",
1137
+ "properties": {
1138
+ "name": {
1139
+ "type": "string"
1140
+ },
1141
+ "source": {
1142
+ "$ref": "util.json#/$defs/source"
1143
+ }
1144
+ },
1145
+ "required": [
1146
+ "name",
1147
+ "source"
1148
+ ],
1149
+ "additionalProperties": false
1150
+ },
1151
+ "minItems": 1,
1152
+ "uniqueItems": true
1153
+ },
1164
1154
  "copyableProps": {
1165
1155
  "type": "string",
1166
1156
  "description": "This is the list of props for which there is a `_copy` implementation. `_copy` may not be declared for props other than these.",