file-entry-cache 4.0.0 → 6.0.1

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.
Files changed (4) hide show
  1. package/README.md +11 -6
  2. package/cache.js +140 -77
  3. package/changelog.md +70 -28
  4. package/package.json +23 -27
package/README.md CHANGED
@@ -13,6 +13,17 @@ npm i --save file-entry-cache
13
13
 
14
14
  ## Usage
15
15
 
16
+ The module exposes two functions `create` and `createFromFile`.
17
+
18
+ ## `create(cacheName, [directory, useCheckSum])`
19
+ - **cacheName**: the name of the cache to be created
20
+ - **directory**: Optional the directory to load the cache from
21
+ - **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.
22
+
23
+ ## `createFromFile(pathToCache, [useCheckSum])`
24
+ - **pathToCache**: the path to the cache file (this combines the cache name and directory)
25
+ - **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.
26
+
16
27
  ```js
17
28
  // loads the cache, if one does not exists for the given
18
29
  // Id a new one will be prepared to be created
@@ -93,12 +104,6 @@ In the worst case scenario all the files will be processed. In the best case sce
93
104
  ## Important notes
94
105
  - The values set on the meta attribute of the entries should be `stringify-able` ones if possible, flat-cache uses `circular-json` to try to persist circular structures, but this should be considered experimental. The best results are always obtained with non circular values
95
106
  - All the changes to the cache state are done to memory first and only persisted after reconcile.
96
- - By default non visited entries are removed from the cache. This is done to prevent the file from growing too much. If this is not an issue and
97
- you prefer to do a manual pruning of the cache files, you can pass `true` to the `reconcile` call. Like this:
98
-
99
- ```javascript
100
- cache.reconcile( true /* noPrune */ );
101
- ```
102
107
 
103
108
  ## License
104
109
 
package/cache.js CHANGED
@@ -1,31 +1,31 @@
1
- var path = require( 'path' );
2
- var crypto = require( 'crypto' );
1
+ var path = require('path');
2
+ var crypto = require('crypto');
3
3
 
4
4
  module.exports = {
5
- createFromFile: function ( filePath ) {
6
- var fname = path.basename( filePath );
7
- var dir = path.dirname( filePath );
8
- return this.create( fname, dir );
5
+ createFromFile: function (filePath, useChecksum) {
6
+ var fname = path.basename(filePath);
7
+ var dir = path.dirname(filePath);
8
+ return this.create(fname, dir, useChecksum);
9
9
  },
10
10
 
11
- create: function ( cacheId, _path ) {
12
- var fs = require( 'fs' );
13
- var flatCache = require( 'flat-cache' );
14
- var cache = flatCache.load( cacheId, _path );
15
- var normalizedEntries = { };
11
+ create: function (cacheId, _path, useChecksum) {
12
+ var fs = require('fs');
13
+ var flatCache = require('flat-cache');
14
+ var cache = flatCache.load(cacheId, _path);
15
+ var normalizedEntries = {};
16
16
 
17
17
  var removeNotFoundFiles = function removeNotFoundFiles() {
18
18
  const cachedEntries = cache.keys();
19
19
  // remove not found entries
20
- cachedEntries.forEach( function remover( fPath ) {
20
+ cachedEntries.forEach(function remover(fPath) {
21
21
  try {
22
- fs.statSync( fPath );
22
+ fs.statSync(fPath);
23
23
  } catch (err) {
24
- if ( err.code === 'ENOENT' ) {
25
- cache.removeKey( fPath );
24
+ if (err.code === 'ENOENT') {
25
+ cache.removeKey(fPath);
26
26
  }
27
27
  }
28
- } );
28
+ });
29
29
  };
30
30
 
31
31
  removeNotFoundFiles();
@@ -43,11 +43,8 @@ module.exports = {
43
43
  * @param {Buffer} buffer buffer to calculate hash on
44
44
  * @return {String} content hash digest
45
45
  */
46
- getHash: function ( buffer ) {
47
- return crypto
48
- .createHash( 'md5' )
49
- .update( buffer )
50
- .digest( 'hex' );
46
+ getHash: function (buffer) {
47
+ return crypto.createHash('md5').update(buffer).digest('hex');
51
48
  },
52
49
 
53
50
  /**
@@ -56,8 +53,8 @@ module.exports = {
56
53
  * @param {String} file the filepath to check
57
54
  * @return {Boolean} wheter or not the file has changed
58
55
  */
59
- hasFileChanged: function ( file ) {
60
- return this.getFileDescriptor( file ).changed;
56
+ hasFileChanged: function (file) {
57
+ return this.getFileDescriptor(file).changed;
61
58
  },
62
59
 
63
60
  /**
@@ -69,57 +66,98 @@ module.exports = {
69
66
  * @param {Array} files the files to analyze and compare to the previous seen files
70
67
  * @return {[type]} [description]
71
68
  */
72
- analyzeFiles: function ( files ) {
69
+ analyzeFiles: function (files) {
73
70
  var me = this;
74
- files = files || [ ];
71
+ files = files || [];
75
72
 
76
73
  var res = {
77
74
  changedFiles: [],
78
75
  notFoundFiles: [],
79
- notChangedFiles: []
76
+ notChangedFiles: [],
80
77
  };
81
78
 
82
- me.normalizeEntries( files ).forEach( function ( entry ) {
83
- if ( entry.changed ) {
84
- res.changedFiles.push( entry.key );
79
+ me.normalizeEntries(files).forEach(function (entry) {
80
+ if (entry.changed) {
81
+ res.changedFiles.push(entry.key);
85
82
  return;
86
83
  }
87
- if ( entry.notFound ) {
88
- res.notFoundFiles.push( entry.key );
84
+ if (entry.notFound) {
85
+ res.notFoundFiles.push(entry.key);
89
86
  return;
90
87
  }
91
- res.notChangedFiles.push( entry.key );
92
- } );
88
+ res.notChangedFiles.push(entry.key);
89
+ });
93
90
  return res;
94
91
  },
95
92
 
96
- getFileDescriptor: function ( file ) {
97
- var meta = cache.getKey( file );
98
- var cacheExists = !!meta;
99
- var me = this;
100
- var contentBuffer;
93
+ getFileDescriptor: function (file) {
94
+ var fstat;
101
95
 
102
96
  try {
103
- contentBuffer = fs.readFileSync( file );
97
+ fstat = fs.statSync(file);
104
98
  } catch (ex) {
105
- me.removeEntry( file );
99
+ this.removeEntry(file);
106
100
  return { key: file, notFound: true, err: ex };
107
101
  }
108
102
 
103
+ if (useChecksum) {
104
+ return this._getFileDescriptorUsingChecksum(file);
105
+ }
106
+
107
+ return this._getFileDescriptorUsingMtimeAndSize(file, fstat);
108
+ },
109
+
110
+ _getFileDescriptorUsingMtimeAndSize: function (file, fstat) {
111
+ var meta = cache.getKey(file);
112
+ var cacheExists = !!meta;
113
+
114
+ var cSize = fstat.size;
115
+ var cTime = fstat.mtime.getTime();
116
+
117
+ var isDifferentDate;
118
+ var isDifferentSize;
119
+
120
+ if (!meta) {
121
+ meta = { size: cSize, mtime: cTime };
122
+ } else {
123
+ isDifferentDate = cTime !== meta.mtime;
124
+ isDifferentSize = cSize !== meta.size;
125
+ }
126
+
127
+ var nEntry = (normalizedEntries[file] = {
128
+ key: file,
129
+ changed: !cacheExists || isDifferentDate || isDifferentSize,
130
+ meta: meta,
131
+ });
132
+
133
+ return nEntry;
134
+ },
135
+
136
+ _getFileDescriptorUsingChecksum: function (file) {
137
+ var meta = cache.getKey(file);
138
+ var cacheExists = !!meta;
139
+
140
+ var contentBuffer;
141
+ try {
142
+ contentBuffer = fs.readFileSync(file);
143
+ } catch (ex) {
144
+ contentBuffer = '';
145
+ }
146
+
109
147
  var isDifferent = true;
110
- var hash = this.getHash( contentBuffer );
148
+ var hash = this.getHash(contentBuffer);
111
149
 
112
- if ( !meta ) {
150
+ if (!meta) {
113
151
  meta = { hash: hash };
114
152
  } else {
115
153
  isDifferent = hash !== meta.hash;
116
154
  }
117
155
 
118
- var nEntry = normalizedEntries[ file ] = {
156
+ var nEntry = (normalizedEntries[file] = {
119
157
  key: file,
120
158
  changed: !cacheExists || isDifferent,
121
- meta: meta
122
- };
159
+ meta: meta,
160
+ });
123
161
 
124
162
  return nEntry;
125
163
  },
@@ -132,15 +170,18 @@ module.exports = {
132
170
  * @param files {Array} the array of files to compare against the ones in the cache
133
171
  * @returns {Array}
134
172
  */
135
- getUpdatedFiles: function ( files ) {
173
+ getUpdatedFiles: function (files) {
136
174
  var me = this;
137
- files = files || [ ];
175
+ files = files || [];
138
176
 
139
- return me.normalizeEntries( files ).filter( function ( entry ) {
140
- return entry.changed;
141
- } ).map( function ( entry ) {
142
- return entry.key;
143
- } );
177
+ return me
178
+ .normalizeEntries(files)
179
+ .filter(function (entry) {
180
+ return entry.changed;
181
+ })
182
+ .map(function (entry) {
183
+ return entry.key;
184
+ });
144
185
  },
145
186
 
146
187
  /**
@@ -149,13 +190,13 @@ module.exports = {
149
190
  * @param files
150
191
  * @returns {*}
151
192
  */
152
- normalizeEntries: function ( files ) {
153
- files = files || [ ];
193
+ normalizeEntries: function (files) {
194
+ files = files || [];
154
195
 
155
196
  var me = this;
156
- var nEntries = files.map( function ( file ) {
157
- return me.getFileDescriptor( file );
158
- } );
197
+ var nEntries = files.map(function (file) {
198
+ return me.getFileDescriptor(file);
199
+ });
159
200
 
160
201
  //normalizeEntries = nEntries;
161
202
  return nEntries;
@@ -168,9 +209,9 @@ module.exports = {
168
209
  * @method removeEntry
169
210
  * @param entryName
170
211
  */
171
- removeEntry: function ( entryName ) {
172
- delete normalizedEntries[ entryName ];
173
- cache.removeKey( entryName );
212
+ removeEntry: function (entryName) {
213
+ delete normalizedEntries[entryName];
214
+ cache.removeKey(entryName);
174
215
  },
175
216
 
176
217
  /**
@@ -185,44 +226,66 @@ module.exports = {
185
226
  * remove the cache from the file and clear the memory cache
186
227
  */
187
228
  destroy: function () {
188
- normalizedEntries = { };
229
+ normalizedEntries = {};
189
230
  cache.destroy();
190
231
  },
232
+
233
+ _getMetaForFileUsingCheckSum: function (cacheEntry) {
234
+ var contentBuffer = fs.readFileSync(cacheEntry.key);
235
+ var hash = this.getHash(contentBuffer);
236
+ var meta = Object.assign(cacheEntry.meta, { hash: hash });
237
+ delete meta.size;
238
+ delete meta.mtime;
239
+ return meta;
240
+ },
241
+
242
+ _getMetaForFileUsingMtimeAndSize: function (cacheEntry) {
243
+ var stat = fs.statSync(cacheEntry.key);
244
+ var meta = Object.assign(cacheEntry.meta, {
245
+ size: stat.size,
246
+ mtime: stat.mtime.getTime(),
247
+ });
248
+ delete meta.hash;
249
+ return meta;
250
+ },
251
+
191
252
  /**
192
253
  * Sync the files and persist them to the cache
193
254
  * @method reconcile
194
255
  */
195
- reconcile: function () {
256
+ reconcile: function (noPrune) {
196
257
  removeNotFoundFiles();
197
258
 
259
+ noPrune = typeof noPrune === 'undefined' ? true : noPrune;
260
+
198
261
  var entries = normalizedEntries;
199
- var keys = Object.keys( entries );
200
- var me = this;
262
+ var keys = Object.keys(entries);
201
263
 
202
- if ( keys.length === 0 ) {
264
+ if (keys.length === 0) {
203
265
  return;
204
266
  }
205
267
 
206
- keys.forEach( function ( entryName ) {
207
- var cacheEntry = entries[ entryName ];
268
+ var me = this;
208
269
 
209
- try {
210
- var contentBuffer = fs.readFileSync( cacheEntry.key );
211
- var hash = me.getHash( contentBuffer );
212
- var meta = Object.assign( cacheEntry.meta, { hash: hash } );
270
+ keys.forEach(function (entryName) {
271
+ var cacheEntry = entries[entryName];
213
272
 
214
- cache.setKey( entryName, meta );
273
+ try {
274
+ var meta = useChecksum
275
+ ? me._getMetaForFileUsingCheckSum(cacheEntry)
276
+ : me._getMetaForFileUsingMtimeAndSize(cacheEntry);
277
+ cache.setKey(entryName, meta);
215
278
  } catch (err) {
216
279
  // if the file does not exists we don't save it
217
280
  // other errors are just thrown
218
- if ( err.code !== 'ENOENT' ) {
281
+ if (err.code !== 'ENOENT') {
219
282
  throw err;
220
283
  }
221
284
  }
222
- } );
285
+ });
223
286
 
224
- cache.save( true );
225
- }
287
+ cache.save(noPrune);
288
+ },
226
289
  };
227
- }
290
+ },
228
291
  };
package/changelog.md CHANGED
@@ -1,121 +1,163 @@
1
1
 
2
2
  # file-entry-cache - Changelog
3
+ ## v6.0.1
4
+ - **Other changes**
5
+ - Delete previous mtime when checksum is used and vice versa - [abcf0f9]( https://github.com/royriojas/file-entry-cache/commit/abcf0f9 ), [Milos Djermanovic](https://github.com/Milos Djermanovic), 19/02/2021 18:19:43
6
+
7
+
8
+ - Adds travis jobs on ppc64le - [92e4d4a]( https://github.com/royriojas/file-entry-cache/commit/92e4d4a ), [dineshks1](https://github.com/dineshks1), 25/11/2020 04:52:11
9
+
10
+
11
+ ## v6.0.0
12
+ - **Refactoring**
13
+ - Align file-entry-cache with latest eslint - [4c6f1fb]( https://github.com/royriojas/file-entry-cache/commit/4c6f1fb ), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 02:43:09
14
+
15
+
16
+ - Upgrade deps - [8ab3257]( https://github.com/royriojas/file-entry-cache/commit/8ab3257 ), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 02:41:53
17
+
18
+
19
+ - updated packages - [3dd4231]( https://github.com/royriojas/file-entry-cache/commit/3dd4231 ), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 02:29:37
20
+
21
+
22
+ - Upgrade flat-cache to version 3 - [d7c60ef]( https://github.com/royriojas/file-entry-cache/commit/d7c60ef ), [Roy Riojas](https://github.com/Roy Riojas), 08/11/2020 01:18:04
23
+
24
+
25
+ ## v5.0.1
26
+ - **Bug Fixes**
27
+ - Fix missing checksum comparison from reconcile since now we use mtime and size by default. - [e858aa9]( https://github.com/royriojas/file-entry-cache/commit/e858aa9 ), [Roy Riojas](https://github.com/Roy Riojas), 04/02/2019 09:30:22
28
+
29
+ Old mode using checkSum can still be used by passing the `useCheckSum` parameter to the `create` or `createFromFile` methods.
30
+
31
+ ## v5.0.0
32
+ - **Refactoring**
33
+ - Make checksum comparison optional - [b0f9ae0]( https://github.com/royriojas/file-entry-cache/commit/b0f9ae0 ), [Roy Riojas](https://github.com/Roy Riojas), 03/02/2019 18:17:39
34
+
35
+ To determine if a file has changed we were using the checksum in the newer versions, but eslint was relying on the old behavior where we use the mtime and file size to determine if a file changed. That's why we decided to make the checksum check optional.
36
+
37
+ To use it:
38
+
39
+ ```js
40
+ // to make the cache use the checkSum check do the following:
41
+ var fCache = fileEntryCache.create(cacheName, dir, useCheckSum); // pass the third parameter as true
42
+ var otherCache = fileEntryCache.createFromFile(cacheName, useCheckSum); // pass the second parameter as true
43
+ ```
44
+
3
45
  ## v4.0.0
4
46
  - **Build Scripts Changes**
5
- - use the same node versions eslint use - [563cfee]( https://github.com/royriojas/file-entry-cache/commit/563cfee ), [Roy Riojas](https://github.com/Roy Riojas), 08/01/2019 23:29:34
47
+ - use the same node versions eslint use - [563cfee]( https://github.com/royriojas/file-entry-cache/commit/563cfee ), [Roy Riojas](https://github.com/Roy Riojas), 08/01/2019 20:29:34
6
48
 
7
49
 
8
50
  - **Other changes**
9
- - Remove object-assign dependency. - [d0f598e]( https://github.com/royriojas/file-entry-cache/commit/d0f598e ), [Corey Farrell](https://github.com/Corey Farrell), 08/01/2019 23:09:51
51
+ - Remove object-assign dependency. - [d0f598e]( https://github.com/royriojas/file-entry-cache/commit/d0f598e ), [Corey Farrell](https://github.com/Corey Farrell), 08/01/2019 20:09:51
10
52
 
11
53
  node.js >=4 is required so object-assign is no longer needed, the native
12
54
  Object.assign can be used instead.
13
55
 
14
56
  ## v3.0.0
15
57
  - **Build Scripts Changes**
16
- - Upgrade flat-cache dep to latest - [078b0df]( https://github.com/royriojas/file-entry-cache/commit/078b0df ), [Roy Riojas](https://github.com/Roy Riojas), 08/01/2019 21:54:40
58
+ - Upgrade flat-cache dep to latest - [078b0df]( https://github.com/royriojas/file-entry-cache/commit/078b0df ), [Roy Riojas](https://github.com/Roy Riojas), 08/01/2019 18:54:40
17
59
 
18
60
 
19
- - Commit new package-lock.json file - [245fe62]( https://github.com/royriojas/file-entry-cache/commit/245fe62 ), [Roy Riojas](https://github.com/Roy Riojas), 08/01/2019 20:56:21
61
+ - Commit new package-lock.json file - [245fe62]( https://github.com/royriojas/file-entry-cache/commit/245fe62 ), [Roy Riojas](https://github.com/Roy Riojas), 08/01/2019 17:56:21
20
62
 
21
63
 
22
64
  - **Refactoring**
23
- - add eslintrc file - [6dd32d8]( https://github.com/royriojas/file-entry-cache/commit/6dd32d8 ), [Roy Riojas](https://github.com/Roy Riojas), 22/08/2018 11:58:17
65
+ - add eslintrc file - [6dd32d8]( https://github.com/royriojas/file-entry-cache/commit/6dd32d8 ), [Roy Riojas](https://github.com/Roy Riojas), 22/08/2018 09:58:17
24
66
 
25
67
 
26
68
  - **Other changes**
27
- - Move variable definition out of else block - [ea05441]( https://github.com/royriojas/file-entry-cache/commit/ea05441 ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 25/04/2017 13:19:00
69
+ - Move variable definition out of else block - [ea05441]( https://github.com/royriojas/file-entry-cache/commit/ea05441 ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 25/04/2017 11:19:00
28
70
 
29
71
 
30
- - Add script and cmd to test hash/checksum performance - [7f60e0a]( https://github.com/royriojas/file-entry-cache/commit/7f60e0a ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 24/04/2017 16:43:12
72
+ - Add script and cmd to test hash/checksum performance - [7f60e0a]( https://github.com/royriojas/file-entry-cache/commit/7f60e0a ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 24/04/2017 14:43:12
31
73
 
32
74
 
33
- - Calculate md5 hexdigest instead of Adler-32 checksum - [f9e5c69]( https://github.com/royriojas/file-entry-cache/commit/f9e5c69 ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 24/04/2017 16:43:12
75
+ - Calculate md5 hexdigest instead of Adler-32 checksum - [f9e5c69]( https://github.com/royriojas/file-entry-cache/commit/f9e5c69 ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 24/04/2017 14:43:12
34
76
 
35
77
 
36
- - How to reproduce - [4edc2dc]( https://github.com/royriojas/file-entry-cache/commit/4edc2dc ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 24/04/2017 15:49:32
78
+ - How to reproduce - [4edc2dc]( https://github.com/royriojas/file-entry-cache/commit/4edc2dc ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 24/04/2017 13:49:32
37
79
 
38
80
 
39
- - Test handling of removed files - [09d9ec5]( https://github.com/royriojas/file-entry-cache/commit/09d9ec5 ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 19/04/2017 21:51:50
81
+ - Test handling of removed files - [09d9ec5]( https://github.com/royriojas/file-entry-cache/commit/09d9ec5 ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 19/04/2017 19:51:50
40
82
 
41
83
 
42
- - Use content checksum instead of mtime and fsize - [343b340]( https://github.com/royriojas/file-entry-cache/commit/343b340 ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 19/04/2017 21:51:47
84
+ - Use content checksum instead of mtime and fsize - [343b340]( https://github.com/royriojas/file-entry-cache/commit/343b340 ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 19/04/2017 19:51:47
43
85
 
44
86
 
45
87
  - **Revert**
46
- - Revert "How to reproduce" - [4b4e54a]( https://github.com/royriojas/file-entry-cache/commit/4b4e54a ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 25/04/2017 13:15:36
88
+ - Revert "How to reproduce" - [4b4e54a]( https://github.com/royriojas/file-entry-cache/commit/4b4e54a ), [Zakhar Shapurau](https://github.com/Zakhar Shapurau), 25/04/2017 11:15:36
47
89
 
48
90
  This reverts commit 4edc2dcec01574247bfc2e0a2fe26527332b7df3.
49
91
 
50
92
  ## v2.0.0
51
93
  - **Features**
52
- - do not persist and prune removed files from cache. Relates to [#2](https://github.com/royriojas/file-entry-cache/issues/2) - [408374d]( https://github.com/royriojas/file-entry-cache/commit/408374d ), [Roy Riojas](https://github.com/Roy Riojas), 16/08/2016 15:47:58
94
+ - do not persist and prune removed files from cache. Relates to [#2](https://github.com/royriojas/file-entry-cache/issues/2) - [408374d]( https://github.com/royriojas/file-entry-cache/commit/408374d ), [Roy Riojas](https://github.com/Roy Riojas), 16/08/2016 13:47:58
53
95
 
54
96
 
55
97
  ## v1.3.1
56
98
  - **Build Scripts Changes**
57
- - remove older node version - [0a26ac4]( https://github.com/royriojas/file-entry-cache/commit/0a26ac4 ), [Roy Riojas](https://github.com/Roy Riojas), 01/08/2016 06:09:17
99
+ - remove older node version - [0a26ac4]( https://github.com/royriojas/file-entry-cache/commit/0a26ac4 ), [Roy Riojas](https://github.com/Roy Riojas), 01/08/2016 04:09:17
58
100
 
59
101
 
60
102
  ## v1.3.0
61
103
  - **Features**
62
- - Add an option to not prune non visited keys. Closes [#2](https://github.com/royriojas/file-entry-cache/issues/2) - [b1a64db]( https://github.com/royriojas/file-entry-cache/commit/b1a64db ), [Roy Riojas](https://github.com/Roy Riojas), 01/08/2016 05:52:12
104
+ - Add an option to not prune non visited keys. Closes [#2](https://github.com/royriojas/file-entry-cache/issues/2) - [b1a64db]( https://github.com/royriojas/file-entry-cache/commit/b1a64db ), [Roy Riojas](https://github.com/Roy Riojas), 01/08/2016 03:52:12
63
105
 
64
106
 
65
107
  ## v1.2.4
66
108
  - **Enhancements**
67
- - Expose the flat-cache instance - [f34c557]( https://github.com/royriojas/file-entry-cache/commit/f34c557 ), [royriojas](https://github.com/royriojas), 23/09/2015 20:26:33
109
+ - Expose the flat-cache instance - [f34c557]( https://github.com/royriojas/file-entry-cache/commit/f34c557 ), [royriojas](https://github.com/royriojas), 23/09/2015 18:26:33
68
110
 
69
111
 
70
112
  ## v1.2.3
71
113
  - **Build Scripts Changes**
72
- - update flat-cache dep - [cc7b9ce]( https://github.com/royriojas/file-entry-cache/commit/cc7b9ce ), [royriojas](https://github.com/royriojas), 11/09/2015 18:04:44
114
+ - update flat-cache dep - [cc7b9ce]( https://github.com/royriojas/file-entry-cache/commit/cc7b9ce ), [royriojas](https://github.com/royriojas), 11/09/2015 16:04:44
73
115
 
74
116
 
75
117
  ## v1.2.2
76
118
  - **Build Scripts Changes**
77
- - Add changelogx section to package.json - [a3916ff]( https://github.com/royriojas/file-entry-cache/commit/a3916ff ), [royriojas](https://github.com/royriojas), 11/09/2015 18:00:26
119
+ - Add changelogx section to package.json - [a3916ff]( https://github.com/royriojas/file-entry-cache/commit/a3916ff ), [royriojas](https://github.com/royriojas), 11/09/2015 16:00:26
78
120
 
79
121
 
80
122
  ## v1.2.1
81
123
  - **Build Scripts Changes**
82
- - update flat-cache dep - [e49b0d4]( https://github.com/royriojas/file-entry-cache/commit/e49b0d4 ), [royriojas](https://github.com/royriojas), 11/09/2015 17:55:25
124
+ - update flat-cache dep - [e49b0d4]( https://github.com/royriojas/file-entry-cache/commit/e49b0d4 ), [royriojas](https://github.com/royriojas), 11/09/2015 15:55:25
83
125
 
84
126
 
85
127
  - **Other changes**
86
- - Update dependencies Replaced lodash.assign with smaller object-assign Fixed tests for windows - [0ad3000]( https://github.com/royriojas/file-entry-cache/commit/0ad3000 ), [Bogdan Chadkin](https://github.com/Bogdan Chadkin), 11/09/2015 17:44:18
128
+ - Update dependencies Replaced lodash.assign with smaller object-assign Fixed tests for windows - [0ad3000]( https://github.com/royriojas/file-entry-cache/commit/0ad3000 ), [Bogdan Chadkin](https://github.com/Bogdan Chadkin), 11/09/2015 15:44:18
87
129
 
88
130
 
89
131
  ## v1.2.0
90
132
  - **Features**
91
- - analyzeFiles now returns also the files that were removed - [6ac2431]( https://github.com/royriojas/file-entry-cache/commit/6ac2431 ), [royriojas](https://github.com/royriojas), 04/09/2015 14:40:53
133
+ - analyzeFiles now returns also the files that were removed - [6ac2431]( https://github.com/royriojas/file-entry-cache/commit/6ac2431 ), [royriojas](https://github.com/royriojas), 04/09/2015 12:40:53
92
134
 
93
135
 
94
136
  ## v1.1.1
95
137
  - **Features**
96
- - Add method to check if a file hasChanged - [3640e2b]( https://github.com/royriojas/file-entry-cache/commit/3640e2b ), [Roy Riojas](https://github.com/Roy Riojas), 30/08/2015 07:33:32
138
+ - Add method to check if a file hasChanged - [3640e2b]( https://github.com/royriojas/file-entry-cache/commit/3640e2b ), [Roy Riojas](https://github.com/Roy Riojas), 30/08/2015 05:33:32
97
139
 
98
140
 
99
141
  ## v1.1.0
100
142
  - **Features**
101
- - Create the cache directly from a file path - [a23de61]( https://github.com/royriojas/file-entry-cache/commit/a23de61 ), [Roy Riojas](https://github.com/Roy Riojas), 30/08/2015 06:41:33
143
+ - Create the cache directly from a file path - [a23de61]( https://github.com/royriojas/file-entry-cache/commit/a23de61 ), [Roy Riojas](https://github.com/Roy Riojas), 30/08/2015 04:41:33
102
144
 
103
145
 
104
- - Add a method to remove an entry from the filecache - [7af29fc]( https://github.com/royriojas/file-entry-cache/commit/7af29fc ), [Roy Riojas](https://github.com/Roy Riojas), 03/03/2015 02:25:32
146
+ - Add a method to remove an entry from the filecache - [7af29fc]( https://github.com/royriojas/file-entry-cache/commit/7af29fc ), [Roy Riojas](https://github.com/Roy Riojas), 02/03/2015 23:25:32
105
147
 
106
148
 
107
- - cache module finished - [1f95544]( https://github.com/royriojas/file-entry-cache/commit/1f95544 ), [Roy Riojas](https://github.com/Roy Riojas), 02/03/2015 04:08:08
149
+ - cache module finished - [1f95544]( https://github.com/royriojas/file-entry-cache/commit/1f95544 ), [Roy Riojas](https://github.com/Roy Riojas), 02/03/2015 01:08:08
108
150
 
109
151
 
110
152
  - **Build Scripts Changes**
111
- - set the version for the first release - [7472eaa]( https://github.com/royriojas/file-entry-cache/commit/7472eaa ), [Roy Riojas](https://github.com/Roy Riojas), 02/03/2015 04:29:54
153
+ - set the version for the first release - [7472eaa]( https://github.com/royriojas/file-entry-cache/commit/7472eaa ), [Roy Riojas](https://github.com/Roy Riojas), 02/03/2015 01:29:54
112
154
 
113
155
 
114
156
  - **Documentation**
115
- - Updated documentation - [557358f]( https://github.com/royriojas/file-entry-cache/commit/557358f ), [Roy Riojas](https://github.com/Roy Riojas), 02/03/2015 04:29:29
157
+ - Updated documentation - [557358f]( https://github.com/royriojas/file-entry-cache/commit/557358f ), [Roy Riojas](https://github.com/Roy Riojas), 02/03/2015 01:29:29
116
158
 
117
159
 
118
160
  - **Other changes**
119
- - Initial commit - [3d5f42b]( https://github.com/royriojas/file-entry-cache/commit/3d5f42b ), [Roy Riojas](https://github.com/Roy Riojas), 02/03/2015 00:58:29
161
+ - Initial commit - [3d5f42b]( https://github.com/royriojas/file-entry-cache/commit/3d5f42b ), [Roy Riojas](https://github.com/Roy Riojas), 01/03/2015 21:58:29
120
162
 
121
163
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "file-entry-cache",
3
- "version": "4.0.0",
3
+ "version": "6.0.1",
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": "royriojas/file-entry-cache",
6
6
  "license": "MIT",
@@ -13,14 +13,11 @@
13
13
  "cache.js"
14
14
  ],
15
15
  "engines": {
16
- "node": ">=4"
16
+ "node": "^10.12.0 || >=12.0.0"
17
17
  },
18
18
  "scripts": {
19
- "beautify": "esbeautifier 'cache.js' 'test/**/*.js' 'perf.js'",
20
- "beautify-check": "npm run beautify -- -k",
21
- "eslint": "eslinter 'cache.js' 'specs/**/*.js' 'perf.js'",
22
- "lint": "npm run beautify && npm run eslint",
23
- "verify": "npm run beautify-check && npm run eslint",
19
+ "eslint": "eslint --cache --cache-location=node_modules/.cache/ 'cache.js' 'test/**/*.js' 'perf.js'",
20
+ "autofix": "npm run eslint -- --fix",
24
21
  "install-hooks": "prepush install && changelogx install-hook && precommit install",
25
22
  "changelog": "changelogx -f markdown -o ./changelog.md",
26
23
  "do-changelog": "npm run changelog && git add ./changelog.md && git commit -m 'DOC: Generate changelog' --no-verify",
@@ -29,16 +26,16 @@
29
26
  "bump-major": "npm run pre-v && npm version major -m 'BLD: Release v%s' && npm run post-v",
30
27
  "bump-minor": "npm run pre-v && npm version minor -m 'BLD: Release v%s' && npm run post-v",
31
28
  "bump-patch": "npm run pre-v && npm version patch -m 'BLD: Release v%s' && npm run post-v",
32
- "test": "npm run verify --silent && mocha -R spec test/specs",
29
+ "test": "npm run eslint --silent && mocha -R spec test/specs",
33
30
  "perf": "node perf.js",
34
31
  "cover": "istanbul cover test/runner.js html text-summary",
35
32
  "watch": "watch-run -i -p 'test/specs/**/*.js' istanbul cover test/runner.js html text-summary"
36
33
  },
37
34
  "prepush": [
38
- "npm run verify"
35
+ "npm run eslint --silent"
39
36
  ],
40
37
  "precommit": [
41
- "npm run verify"
38
+ "npm run eslint --silent"
42
39
  ],
43
40
  "keywords": [
44
41
  "file cache",
@@ -61,24 +58,23 @@
61
58
  "projectName": "file-entry-cache"
62
59
  },
63
60
  "devDependencies": {
64
- "chai": "^3.2.0",
65
- "changelogx": "3.0.0",
66
- "commander": "^2.6.0",
67
- "del": "^2.0.2",
68
- "esbeautifier": "^4.2.11",
69
- "eslinter": "^2.3.3",
70
- "glob-expand": "^0.1.0",
71
- "istanbul": "^0.3.6",
72
- "mocha": "^2.1.0",
73
- "precommit": "^1.1.5",
74
- "prepush": "^3.1.4",
75
- "proxyquire": "^1.3.1",
76
- "sinon": "^1.12.2",
77
- "sinon-chai": "^2.7.0",
78
- "watch-run": "^1.2.1",
79
- "write": "^0.3.1"
61
+ "chai": "^4.2.0",
62
+ "changelogx": "^5.0.6",
63
+ "del": "^6.0.0",
64
+ "eslint": "^7.13.0",
65
+ "eslint-config-prettier": "^6.15.0",
66
+ "eslint-plugin-mocha": "^8.0.0",
67
+ "eslint-plugin-prettier": "^3.1.4",
68
+ "glob-expand": "^0.2.1",
69
+ "istanbul": "^0.4.5",
70
+ "mocha": "^8.2.1",
71
+ "precommit": "^1.2.2",
72
+ "prepush": "^3.1.11",
73
+ "prettier": "^2.1.2",
74
+ "watch-run": "^1.2.5",
75
+ "write": "^2.0.0"
80
76
  },
81
77
  "dependencies": {
82
- "flat-cache": "^2.0.1"
78
+ "flat-cache": "^3.0.4"
83
79
  }
84
80
  }