file-entry-cache 8.0.0 → 9.1.0
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 +6 -5
- package/cache.js +264 -237
- package/package.json +22 -19
package/README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# file-entry-cache
|
|
2
|
-
> Super simple cache for file metadata, useful for process that work on a given series of files
|
|
3
|
-
> and that only need to repeat the job on the changed ones since the previous run of the process — Edit
|
|
2
|
+
> Super simple cache for file metadata, useful for process that work on a given series of files and that only need to repeat the job on the changed ones since the previous run of the process
|
|
4
3
|
|
|
5
4
|
[](https://npmjs.org/package/file-entry-cache)
|
|
6
5
|
[](https://github.com/jaredwray/file-entry-cache/actions/workflows/tests.yaml)
|
|
@@ -18,14 +17,16 @@ npm i --save file-entry-cache
|
|
|
18
17
|
|
|
19
18
|
The module exposes two functions `create` and `createFromFile`.
|
|
20
19
|
|
|
21
|
-
## `create(cacheName, [directory, useCheckSum])`
|
|
20
|
+
## `create(cacheName, [directory, useCheckSum, currentWorkingDir])`
|
|
22
21
|
- **cacheName**: the name of the cache to be created
|
|
23
22
|
- **directory**: Optional the directory to load the cache from
|
|
24
23
|
- **usecheckSum**: Whether to use md5 checksum to verify if file changed. If false the default will be to use the mtime and size of the file.
|
|
24
|
+
- **currentWorkingDir**: Optional the current working directory to use when resolving relative paths
|
|
25
25
|
|
|
26
|
-
## `createFromFile(pathToCache, [useCheckSum])`
|
|
26
|
+
## `createFromFile(pathToCache, [useCheckSum, currentWorkingDir])`
|
|
27
27
|
- **pathToCache**: the path to the cache file (this combines the cache name and directory)
|
|
28
28
|
- **useCheckSum**: Whether to use md5 checksum to verify if file changed. If false the default will be to use the mtime and size of the file.
|
|
29
|
+
- **currentWorkingDir**: Optional the current working directory to use when resolving relative paths
|
|
29
30
|
|
|
30
31
|
```js
|
|
31
32
|
// loads the cache, if one does not exists for the given
|
|
@@ -110,6 +111,6 @@ In the worst case scenario all the files will be processed. In the best case sce
|
|
|
110
111
|
|
|
111
112
|
## License
|
|
112
113
|
|
|
113
|
-
MIT
|
|
114
|
+
MIT (c) Jared Wray
|
|
114
115
|
|
|
115
116
|
|
package/cache.js
CHANGED
|
@@ -1,64 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/* eslint-disable unicorn/no-this-assignment, func-names, no-multi-assign */
|
|
2
|
+
const path = require('node:path');
|
|
3
|
+
const crypto = require('node:crypto');
|
|
3
4
|
|
|
4
5
|
module.exports = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
6
|
+
createFromFile(filePath, useChecksum, currentWorkingDir) {
|
|
7
|
+
const fname = path.basename(filePath);
|
|
8
|
+
const dir = path.dirname(filePath);
|
|
9
|
+
return this.create(fname, dir, useChecksum, currentWorkingDir);
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
create(cacheId, _path, useChecksum, currentWorkingDir) {
|
|
13
|
+
const fs = require('node:fs');
|
|
14
|
+
const flatCache = require('flat-cache');
|
|
15
|
+
const cache = flatCache.load(cacheId, _path);
|
|
16
|
+
let normalizedEntries = {};
|
|
17
|
+
|
|
18
|
+
const removeNotFoundFiles = function removeNotFoundFiles() {
|
|
19
|
+
const cachedEntries = cache.keys();
|
|
20
|
+
// Remove not found entries
|
|
21
|
+
for (const fPath of cachedEntries) {
|
|
22
|
+
try {
|
|
23
|
+
let filePath = fPath;
|
|
24
|
+
if (currentWorkingDir) {
|
|
25
|
+
filePath = path.join(currentWorkingDir, fPath);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
fs.statSync(filePath);
|
|
29
|
+
} catch (error) {
|
|
30
|
+
if (error.code === 'ENOENT') {
|
|
31
|
+
cache.removeKey(fPath);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
removeNotFoundFiles();
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
/**
|
|
41
|
+
* The flat cache storage used to persist the metadata of the `files
|
|
36
42
|
* @type {Object}
|
|
37
43
|
*/
|
|
38
|
-
|
|
44
|
+
cache,
|
|
39
45
|
|
|
40
|
-
|
|
46
|
+
/**
|
|
47
|
+
* To enable relative paths as the key with current working directory
|
|
48
|
+
* @type {string}
|
|
49
|
+
*/
|
|
50
|
+
currentWorkingDir: currentWorkingDir ?? undefined,
|
|
51
|
+
|
|
52
|
+
/**
|
|
41
53
|
* Given a buffer, calculate md5 hash of its content.
|
|
42
54
|
* @method getHash
|
|
43
55
|
* @param {Buffer} buffer buffer to calculate hash on
|
|
44
56
|
* @return {String} content hash digest
|
|
45
57
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
58
|
+
getHash(buffer) {
|
|
59
|
+
return crypto.createHash('md5').update(buffer).digest('hex');
|
|
60
|
+
},
|
|
49
61
|
|
|
50
|
-
|
|
62
|
+
/**
|
|
51
63
|
* Return whether or not a file has changed since last time reconcile was called.
|
|
52
64
|
* @method hasFileChanged
|
|
53
65
|
* @param {String} file the filepath to check
|
|
54
66
|
* @return {Boolean} wheter or not the file has changed
|
|
55
67
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
68
|
+
hasFileChanged(file) {
|
|
69
|
+
return this.getFileDescriptor(file).changed;
|
|
70
|
+
},
|
|
59
71
|
|
|
60
|
-
|
|
61
|
-
*
|
|
72
|
+
/**
|
|
73
|
+
* Given an array of file paths it return and object with three arrays:
|
|
62
74
|
* - changedFiles: Files that changed since previous run
|
|
63
75
|
* - notChangedFiles: Files that haven't change
|
|
64
76
|
* - notFoundFiles: Files that were not found, probably deleted
|
|
@@ -66,103 +78,114 @@ module.exports = {
|
|
|
66
78
|
* @param {Array} files the files to analyze and compare to the previous seen files
|
|
67
79
|
* @return {[type]} [description]
|
|
68
80
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
81
|
+
analyzeFiles(files) {
|
|
82
|
+
const me = this;
|
|
83
|
+
files ||= [];
|
|
84
|
+
|
|
85
|
+
const res = {
|
|
86
|
+
changedFiles: [],
|
|
87
|
+
notFoundFiles: [],
|
|
88
|
+
notChangedFiles: [],
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
for (const entry of me.normalizeEntries(files)) {
|
|
92
|
+
if (entry.changed) {
|
|
93
|
+
res.changedFiles.push(entry.key);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (entry.notFound) {
|
|
98
|
+
res.notFoundFiles.push(entry.key);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
res.notChangedFiles.push(entry.key);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return res;
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
getFileDescriptor(file) {
|
|
109
|
+
let fstat;
|
|
110
|
+
|
|
111
|
+
try {
|
|
112
|
+
fstat = fs.statSync(file);
|
|
113
|
+
} catch (error) {
|
|
114
|
+
this.removeEntry(file);
|
|
115
|
+
return {key: file, notFound: true, err: error};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (useChecksum) {
|
|
119
|
+
return this._getFileDescriptorUsingChecksum(file);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return this._getFileDescriptorUsingMtimeAndSize(file, fstat);
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
_getFileKey(file) {
|
|
126
|
+
if (this.currentWorkingDir) {
|
|
127
|
+
return file.split(this.currentWorkingDir).pop();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return file;
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
_getFileDescriptorUsingMtimeAndSize(file, fstat) {
|
|
134
|
+
let meta = cache.getKey(this._getFileKey(file));
|
|
135
|
+
const cacheExists = Boolean(meta);
|
|
136
|
+
|
|
137
|
+
const cSize = fstat.size;
|
|
138
|
+
const cTime = fstat.mtime.getTime();
|
|
139
|
+
|
|
140
|
+
let isDifferentDate;
|
|
141
|
+
let isDifferentSize;
|
|
142
|
+
|
|
143
|
+
if (meta) {
|
|
144
|
+
isDifferentDate = cTime !== meta.mtime;
|
|
145
|
+
isDifferentSize = cSize !== meta.size;
|
|
146
|
+
} else {
|
|
147
|
+
meta = {size: cSize, mtime: cTime};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const nEntry = (normalizedEntries[this._getFileKey(file)] = {
|
|
151
|
+
key: this._getFileKey(file),
|
|
152
|
+
changed: !cacheExists || isDifferentDate || isDifferentSize,
|
|
153
|
+
meta,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
return nEntry;
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
_getFileDescriptorUsingChecksum(file) {
|
|
160
|
+
let meta = cache.getKey(this._getFileKey(file));
|
|
161
|
+
const cacheExists = Boolean(meta);
|
|
162
|
+
|
|
163
|
+
let contentBuffer;
|
|
164
|
+
try {
|
|
165
|
+
contentBuffer = fs.readFileSync(file);
|
|
166
|
+
} catch {
|
|
167
|
+
contentBuffer = '';
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
let isDifferent = true;
|
|
171
|
+
const hash = this.getHash(contentBuffer);
|
|
172
|
+
|
|
173
|
+
if (meta) {
|
|
174
|
+
isDifferent = hash !== meta.hash;
|
|
175
|
+
} else {
|
|
176
|
+
meta = {hash};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const nEntry = (normalizedEntries[this._getFileKey(file)] = {
|
|
180
|
+
key: this._getFileKey(file),
|
|
181
|
+
changed: !cacheExists || isDifferent,
|
|
182
|
+
meta,
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
return nEntry;
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
/**
|
|
166
189
|
* Return the list o the files that changed compared
|
|
167
190
|
* against the ones stored in the cache
|
|
168
191
|
*
|
|
@@ -170,122 +193,126 @@ module.exports = {
|
|
|
170
193
|
* @param files {Array} the array of files to compare against the ones in the cache
|
|
171
194
|
* @returns {Array}
|
|
172
195
|
*/
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
},
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* return the list of files
|
|
196
|
+
getUpdatedFiles(files) {
|
|
197
|
+
const me = this;
|
|
198
|
+
files ||= [];
|
|
199
|
+
|
|
200
|
+
return me
|
|
201
|
+
.normalizeEntries(files)
|
|
202
|
+
.filter(entry => entry.changed)
|
|
203
|
+
.map(entry => entry.key);
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Return the list of files
|
|
189
208
|
* @method normalizeEntries
|
|
190
209
|
* @param files
|
|
191
210
|
* @returns {*}
|
|
192
211
|
*/
|
|
193
|
-
|
|
194
|
-
|
|
212
|
+
normalizeEntries(files) {
|
|
213
|
+
files ||= [];
|
|
195
214
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
return me.getFileDescriptor(file);
|
|
199
|
-
});
|
|
215
|
+
const me = this;
|
|
216
|
+
const nEntries = files.map(file => me.getFileDescriptor(file));
|
|
200
217
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
218
|
+
// NormalizeEntries = nEntries;
|
|
219
|
+
return nEntries;
|
|
220
|
+
},
|
|
204
221
|
|
|
205
|
-
|
|
222
|
+
/**
|
|
206
223
|
* Remove an entry from the file-entry-cache. Useful to force the file to still be considered
|
|
207
224
|
* modified the next time the process is run
|
|
208
225
|
*
|
|
209
226
|
* @method removeEntry
|
|
210
227
|
* @param entryName
|
|
211
228
|
*/
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
229
|
+
removeEntry(entryName) {
|
|
230
|
+
delete normalizedEntries[this._getFileKey(entryName)];
|
|
231
|
+
cache.removeKey(this._getFileKey(entryName));
|
|
232
|
+
},
|
|
216
233
|
|
|
217
|
-
|
|
234
|
+
/**
|
|
218
235
|
* Delete the cache file from the disk
|
|
219
236
|
* @method deleteCacheFile
|
|
220
237
|
*/
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
238
|
+
deleteCacheFile() {
|
|
239
|
+
cache.removeCacheFile();
|
|
240
|
+
},
|
|
224
241
|
|
|
225
|
-
|
|
226
|
-
*
|
|
242
|
+
/**
|
|
243
|
+
* Remove the cache from the file and clear the memory cache
|
|
227
244
|
*/
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
245
|
+
destroy() {
|
|
246
|
+
normalizedEntries = {};
|
|
247
|
+
cache.destroy();
|
|
248
|
+
},
|
|
249
|
+
|
|
250
|
+
_getMetaForFileUsingCheckSum(cacheEntry) {
|
|
251
|
+
let filePath = cacheEntry.key;
|
|
252
|
+
if (this.currentWorkingDir) {
|
|
253
|
+
filePath = path.join(this.currentWorkingDir, filePath);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const contentBuffer = fs.readFileSync(filePath);
|
|
257
|
+
const hash = this.getHash(contentBuffer);
|
|
258
|
+
const meta = Object.assign(cacheEntry.meta, {hash});
|
|
259
|
+
delete meta.size;
|
|
260
|
+
delete meta.mtime;
|
|
261
|
+
return meta;
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
_getMetaForFileUsingMtimeAndSize(cacheEntry) {
|
|
265
|
+
let filePath = cacheEntry.key;
|
|
266
|
+
if (currentWorkingDir) {
|
|
267
|
+
filePath = path.join(currentWorkingDir, filePath);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const stat = fs.statSync(filePath);
|
|
271
|
+
const meta = Object.assign(cacheEntry.meta, {
|
|
272
|
+
size: stat.size,
|
|
273
|
+
mtime: stat.mtime.getTime(),
|
|
274
|
+
});
|
|
275
|
+
delete meta.hash;
|
|
276
|
+
return meta;
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
/**
|
|
253
280
|
* Sync the files and persist them to the cache
|
|
254
281
|
* @method reconcile
|
|
255
282
|
*/
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
283
|
+
reconcile(noPrune) {
|
|
284
|
+
removeNotFoundFiles();
|
|
285
|
+
|
|
286
|
+
noPrune = noPrune === undefined ? true : noPrune;
|
|
287
|
+
|
|
288
|
+
const entries = normalizedEntries;
|
|
289
|
+
const keys = Object.keys(entries);
|
|
290
|
+
|
|
291
|
+
if (keys.length === 0) {
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
const me = this;
|
|
296
|
+
|
|
297
|
+
for (const entryName of keys) {
|
|
298
|
+
const cacheEntry = entries[entryName];
|
|
299
|
+
|
|
300
|
+
try {
|
|
301
|
+
const meta = useChecksum
|
|
302
|
+
? me._getMetaForFileUsingCheckSum(cacheEntry)
|
|
303
|
+
: me._getMetaForFileUsingMtimeAndSize(cacheEntry);
|
|
304
|
+
cache.setKey(this._getFileKey(entryName), meta);
|
|
305
|
+
} catch (error) {
|
|
306
|
+
// If the file does not exists we don't save it
|
|
307
|
+
// other errors are just thrown
|
|
308
|
+
if (error.code !== 'ENOENT') {
|
|
309
|
+
throw error;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
cache.save(noPrune);
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
},
|
|
291
318
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "file-entry-cache",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.1.0",
|
|
4
4
|
"description": "Super simple cache for file metadata, useful for process that work o a given series of files and that only need to repeat the job on the changed ones since the previous run of the process",
|
|
5
5
|
"repository": "jaredwray/file-entry-cache",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,21 +13,20 @@
|
|
|
13
13
|
"cache.js"
|
|
14
14
|
],
|
|
15
15
|
"engines": {
|
|
16
|
-
"node": ">=
|
|
16
|
+
"node": ">=18"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"test": "
|
|
23
|
-
"test:ci": "npm run eslint --silent && c8 --reporter=lcov mocha -R spec test/specs",
|
|
19
|
+
"clean": "rimraf ./coverage /node_modules ./package-lock.json ./yarn.lock ./pnpm-lock.yaml",
|
|
20
|
+
"test": "xo --fix && c8 mocha -R spec test/specs/cache.js test/relative.js",
|
|
21
|
+
"test:relative": "rimraf ./rfixtures ./tfixtures && mocha test/relative.js",
|
|
22
|
+
"test:ci": "xo && c8 --reporter=lcov mocha -R spec test/specs/cache.js test/relative.js",
|
|
24
23
|
"perf": "node perf.js"
|
|
25
24
|
},
|
|
26
25
|
"prepush": [
|
|
27
|
-
"npm run
|
|
26
|
+
"npm run test"
|
|
28
27
|
],
|
|
29
28
|
"precommit": [
|
|
30
|
-
"npm run
|
|
29
|
+
"npm run test"
|
|
31
30
|
],
|
|
32
31
|
"keywords": [
|
|
33
32
|
"file cache",
|
|
@@ -38,19 +37,23 @@
|
|
|
38
37
|
"cache"
|
|
39
38
|
],
|
|
40
39
|
"devDependencies": {
|
|
41
|
-
"c8": "^
|
|
40
|
+
"c8": "^10.1.2",
|
|
42
41
|
"chai": "^4.3.10",
|
|
43
|
-
"eslint": "^8.56.0",
|
|
44
|
-
"eslint-config-prettier": "^9.1.0",
|
|
45
|
-
"eslint-plugin-mocha": "^10.2.0",
|
|
46
|
-
"eslint-plugin-prettier": "^5.0.1",
|
|
47
42
|
"glob-expand": "^0.2.1",
|
|
48
|
-
"mocha": "^10.
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"write": "^2.0.0"
|
|
43
|
+
"mocha": "^10.5.1",
|
|
44
|
+
"rimraf": "^5.0.7",
|
|
45
|
+
"webpack": "^5.92.1",
|
|
46
|
+
"write": "^2.0.0",
|
|
47
|
+
"xo": "^0.58.0"
|
|
52
48
|
},
|
|
53
49
|
"dependencies": {
|
|
54
|
-
"flat-cache": "^
|
|
50
|
+
"flat-cache": "^5.0.0"
|
|
51
|
+
},
|
|
52
|
+
"xo": {
|
|
53
|
+
"rules": {
|
|
54
|
+
"unicorn/prefer-module": "off",
|
|
55
|
+
"n/prefer-global/process": "off",
|
|
56
|
+
"unicorn/prevent-abbreviations": "off"
|
|
57
|
+
}
|
|
55
58
|
}
|
|
56
59
|
}
|