file-entry-cache 2.0.0 → 6.0.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.
Files changed (4) hide show
  1. package/README.md +11 -6
  2. package/cache.js +145 -73
  3. package/changelog.md +97 -16
  4. package/package.json +24 -28
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' );
1
+ var path = require('path');
2
+ var crypto = require('crypto');
2
3
 
3
4
  module.exports = {
4
- createFromFile: function ( filePath ) {
5
- var fname = path.basename( filePath );
6
- var dir = path.dirname( filePath );
7
- 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);
8
9
  },
9
10
 
10
- create: function ( cacheId, _path ) {
11
- var fs = require( 'fs' );
12
- var flatCache = require( 'flat-cache' );
13
- var cache = flatCache.load( cacheId, _path );
14
- var assign = require( 'object-assign' );
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();
@@ -36,14 +36,25 @@ module.exports = {
36
36
  * @type {Object}
37
37
  */
38
38
  cache: cache,
39
+
40
+ /**
41
+ * Given a buffer, calculate md5 hash of its content.
42
+ * @method getHash
43
+ * @param {Buffer} buffer buffer to calculate hash on
44
+ * @return {String} content hash digest
45
+ */
46
+ getHash: function (buffer) {
47
+ return crypto.createHash('md5').update(buffer).digest('hex');
48
+ },
49
+
39
50
  /**
40
51
  * Return whether or not a file has changed since last time reconcile was called.
41
52
  * @method hasFileChanged
42
53
  * @param {String} file the filepath to check
43
54
  * @return {Boolean} wheter or not the file has changed
44
55
  */
45
- hasFileChanged: function ( file ) {
46
- return this.getFileDescriptor( file ).changed;
56
+ hasFileChanged: function (file) {
57
+ return this.getFileDescriptor(file).changed;
47
58
  },
48
59
 
49
60
  /**
@@ -55,58 +66,98 @@ module.exports = {
55
66
  * @param {Array} files the files to analyze and compare to the previous seen files
56
67
  * @return {[type]} [description]
57
68
  */
58
- analyzeFiles: function ( files ) {
69
+ analyzeFiles: function (files) {
59
70
  var me = this;
60
- files = files || [ ];
71
+ files = files || [];
61
72
 
62
73
  var res = {
63
74
  changedFiles: [],
64
75
  notFoundFiles: [],
65
- notChangedFiles: []
76
+ notChangedFiles: [],
66
77
  };
67
78
 
68
- me.normalizeEntries( files ).forEach( function ( entry ) {
69
- if ( entry.changed ) {
70
- res.changedFiles.push( entry.key );
79
+ me.normalizeEntries(files).forEach(function (entry) {
80
+ if (entry.changed) {
81
+ res.changedFiles.push(entry.key);
71
82
  return;
72
83
  }
73
- if ( entry.notFound ) {
74
- res.notFoundFiles.push( entry.key );
84
+ if (entry.notFound) {
85
+ res.notFoundFiles.push(entry.key);
75
86
  return;
76
87
  }
77
- res.notChangedFiles.push( entry.key );
78
- } );
88
+ res.notChangedFiles.push(entry.key);
89
+ });
79
90
  return res;
80
91
  },
81
92
 
82
- getFileDescriptor: function ( file ) {
83
- var meta = cache.getKey( file );
84
- var cacheExists = !!meta;
93
+ getFileDescriptor: function (file) {
85
94
  var fstat;
86
- var me = this;
87
95
 
88
96
  try {
89
- fstat = fs.statSync( file );
97
+ fstat = fs.statSync(file);
90
98
  } catch (ex) {
91
- me.removeEntry( file );
99
+ this.removeEntry(file);
92
100
  return { key: file, notFound: true, err: ex };
93
101
  }
94
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
+
95
114
  var cSize = fstat.size;
96
115
  var cTime = fstat.mtime.getTime();
97
116
 
98
- if ( !meta ) {
117
+ var isDifferentDate;
118
+ var isDifferentSize;
119
+
120
+ if (!meta) {
99
121
  meta = { size: cSize, mtime: cTime };
100
122
  } else {
101
- var isDifferentDate = cTime !== meta.mtime;
102
- var isDifferentSize = cSize !== meta.size;
123
+ isDifferentDate = cTime !== meta.mtime;
124
+ isDifferentSize = cSize !== meta.size;
103
125
  }
104
126
 
105
- var nEntry = normalizedEntries[ file ] = {
127
+ var nEntry = (normalizedEntries[file] = {
106
128
  key: file,
107
129
  changed: !cacheExists || isDifferentDate || isDifferentSize,
108
- meta: meta
109
- };
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
+
147
+ var isDifferent = true;
148
+ var hash = this.getHash(contentBuffer);
149
+
150
+ if (!meta) {
151
+ meta = { hash: hash };
152
+ } else {
153
+ isDifferent = hash !== meta.hash;
154
+ }
155
+
156
+ var nEntry = (normalizedEntries[file] = {
157
+ key: file,
158
+ changed: !cacheExists || isDifferent,
159
+ meta: meta,
160
+ });
110
161
 
111
162
  return nEntry;
112
163
  },
@@ -119,15 +170,18 @@ module.exports = {
119
170
  * @param files {Array} the array of files to compare against the ones in the cache
120
171
  * @returns {Array}
121
172
  */
122
- getUpdatedFiles: function ( files ) {
173
+ getUpdatedFiles: function (files) {
123
174
  var me = this;
124
- files = files || [ ];
175
+ files = files || [];
125
176
 
126
- return me.normalizeEntries( files ).filter( function ( entry ) {
127
- return entry.changed;
128
- } ).map( function ( entry ) {
129
- return entry.key;
130
- } );
177
+ return me
178
+ .normalizeEntries(files)
179
+ .filter(function (entry) {
180
+ return entry.changed;
181
+ })
182
+ .map(function (entry) {
183
+ return entry.key;
184
+ });
131
185
  },
132
186
 
133
187
  /**
@@ -136,13 +190,13 @@ module.exports = {
136
190
  * @param files
137
191
  * @returns {*}
138
192
  */
139
- normalizeEntries: function ( files ) {
140
- files = files || [ ];
193
+ normalizeEntries: function (files) {
194
+ files = files || [];
141
195
 
142
196
  var me = this;
143
- var nEntries = files.map( function ( file ) {
144
- return me.getFileDescriptor( file );
145
- } );
197
+ var nEntries = files.map(function (file) {
198
+ return me.getFileDescriptor(file);
199
+ });
146
200
 
147
201
  //normalizeEntries = nEntries;
148
202
  return nEntries;
@@ -155,9 +209,9 @@ module.exports = {
155
209
  * @method removeEntry
156
210
  * @param entryName
157
211
  */
158
- removeEntry: function ( entryName ) {
159
- delete normalizedEntries[ entryName ];
160
- cache.removeKey( entryName );
212
+ removeEntry: function (entryName) {
213
+ delete normalizedEntries[entryName];
214
+ cache.removeKey(entryName);
161
215
  },
162
216
 
163
217
  /**
@@ -172,45 +226,63 @@ module.exports = {
172
226
  * remove the cache from the file and clear the memory cache
173
227
  */
174
228
  destroy: function () {
175
- normalizedEntries = { };
229
+ normalizedEntries = {};
176
230
  cache.destroy();
177
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
+ return meta;
238
+ },
239
+
240
+ _getMetaForFileUsingMtimeAndSize: function (cacheEntry) {
241
+ var stat = fs.statSync(cacheEntry.key);
242
+ var meta = Object.assign(cacheEntry.meta, {
243
+ size: stat.size,
244
+ mtime: stat.mtime.getTime(),
245
+ });
246
+ return meta;
247
+ },
248
+
178
249
  /**
179
250
  * Sync the files and persist them to the cache
180
251
  * @method reconcile
181
252
  */
182
- reconcile: function () {
253
+ reconcile: function (noPrune) {
183
254
  removeNotFoundFiles();
184
255
 
256
+ noPrune = typeof noPrune === 'undefined' ? true : noPrune;
257
+
185
258
  var entries = normalizedEntries;
186
- var keys = Object.keys( entries );
259
+ var keys = Object.keys(entries);
187
260
 
188
- if ( keys.length === 0 ) {
261
+ if (keys.length === 0) {
189
262
  return;
190
263
  }
191
264
 
192
- keys.forEach( function ( entryName ) {
193
- var cacheEntry = entries[ entryName ];
265
+ var me = this;
194
266
 
195
- try {
196
- var stat = fs.statSync( cacheEntry.key );
197
- var meta = assign( cacheEntry.meta, {
198
- size: stat.size,
199
- mtime: stat.mtime.getTime()
200
- } );
267
+ keys.forEach(function (entryName) {
268
+ var cacheEntry = entries[entryName];
201
269
 
202
- cache.setKey( entryName, meta );
270
+ try {
271
+ var meta = useChecksum
272
+ ? me._getMetaForFileUsingCheckSum(cacheEntry)
273
+ : me._getMetaForFileUsingMtimeAndSize(cacheEntry);
274
+ cache.setKey(entryName, meta);
203
275
  } catch (err) {
204
276
  // if the file does not exists we don't save it
205
277
  // other errors are just thrown
206
- if ( err.code !== 'ENOENT' ) {
278
+ if (err.code !== 'ENOENT') {
207
279
  throw err;
208
280
  }
209
281
  }
210
- } );
282
+ });
211
283
 
212
- cache.save( true );
213
- }
284
+ cache.save(noPrune);
285
+ },
214
286
  };
215
- }
287
+ },
216
288
  };
package/changelog.md CHANGED
@@ -1,74 +1,155 @@
1
1
 
2
2
  # file-entry-cache - Changelog
3
+ ## v6.0.0
4
+ - **Refactoring**
5
+ - 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
6
+
7
+
8
+ - 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
9
+
10
+
11
+ - 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
12
+
13
+
14
+ - 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
15
+
16
+
17
+ ## v5.0.1
18
+ - **Bug Fixes**
19
+ - 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
20
+
21
+ Old mode using checkSum can still be used by passing the `useCheckSum` parameter to the `create` or `createFromFile` methods.
22
+
23
+ ## v5.0.0
24
+ - **Refactoring**
25
+ - 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
26
+
27
+ 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.
28
+
29
+ To use it:
30
+
31
+ ```js
32
+ // to make the cache use the checkSum check do the following:
33
+ var fCache = fileEntryCache.create(cacheName, dir, useCheckSum); // pass the third parameter as true
34
+ var otherCache = fileEntryCache.createFromFile(cacheName, useCheckSum); // pass the second parameter as true
35
+ ```
36
+
37
+ ## v4.0.0
38
+ - **Build Scripts Changes**
39
+ - 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
40
+
41
+
42
+ - **Other changes**
43
+ - 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
44
+
45
+ node.js >=4 is required so object-assign is no longer needed, the native
46
+ Object.assign can be used instead.
47
+
48
+ ## v3.0.0
49
+ - **Build Scripts Changes**
50
+ - 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
51
+
52
+
53
+ - 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
54
+
55
+
56
+ - **Refactoring**
57
+ - 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
58
+
59
+
60
+ - **Other changes**
61
+ - 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
62
+
63
+
64
+ - 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
65
+
66
+
67
+ - 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
68
+
69
+
70
+ - 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
71
+
72
+
73
+ - 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
74
+
75
+
76
+ - 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
77
+
78
+
79
+ - **Revert**
80
+ - 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
81
+
82
+ This reverts commit 4edc2dcec01574247bfc2e0a2fe26527332b7df3.
83
+
3
84
  ## v2.0.0
4
85
  - **Features**
5
- - 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
86
+ - 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
6
87
 
7
88
 
8
89
  ## v1.3.1
9
90
  - **Build Scripts Changes**
10
- - 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
91
+ - 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
11
92
 
12
93
 
13
94
  ## v1.3.0
14
95
  - **Features**
15
- - 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
96
+ - 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
16
97
 
17
98
 
18
99
  ## v1.2.4
19
100
  - **Enhancements**
20
- - 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
101
+ - 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
21
102
 
22
103
 
23
104
  ## v1.2.3
24
105
  - **Build Scripts Changes**
25
- - 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
106
+ - 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
26
107
 
27
108
 
28
109
  ## v1.2.2
29
110
  - **Build Scripts Changes**
30
- - 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
111
+ - 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
31
112
 
32
113
 
33
114
  ## v1.2.1
34
115
  - **Build Scripts Changes**
35
- - 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
116
+ - 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
36
117
 
37
118
 
38
119
  - **Other changes**
39
- - 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
120
+ - 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
40
121
 
41
122
 
42
123
  ## v1.2.0
43
124
  - **Features**
44
- - 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
125
+ - 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
45
126
 
46
127
 
47
128
  ## v1.1.1
48
129
  - **Features**
49
- - 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
130
+ - 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
50
131
 
51
132
 
52
133
  ## v1.1.0
53
134
  - **Features**
54
- - 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
135
+ - 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
55
136
 
56
137
 
57
- - 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
138
+ - 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
58
139
 
59
140
 
60
- - 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
141
+ - 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
61
142
 
62
143
 
63
144
  - **Build Scripts Changes**
64
- - 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
145
+ - 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
65
146
 
66
147
 
67
148
  - **Documentation**
68
- - 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
149
+ - 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
69
150
 
70
151
 
71
152
  - **Other changes**
72
- - 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
153
+ - 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
73
154
 
74
155
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "file-entry-cache",
3
- "version": "2.0.0",
3
+ "version": "6.0.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": "royriojas/file-entry-cache",
6
6
  "license": "MIT",
@@ -13,14 +13,11 @@
13
13
  "cache.js"
14
14
  ],
15
15
  "engines": {
16
- "node": ">=0.10.0"
16
+ "node": "^10.12.0 || >=12.0.0"
17
17
  },
18
18
  "scripts": {
19
- "beautify": "esbeautifier 'cache.js' 'test/**/*.js'",
20
- "beautify-check": "npm run beautify -- -k",
21
- "eslint": "eslinter 'cache.js' 'specs/**/*.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,15 +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",
30
+ "perf": "node perf.js",
33
31
  "cover": "istanbul cover test/runner.js html text-summary",
34
32
  "watch": "watch-run -i -p 'test/specs/**/*.js' istanbul cover test/runner.js html text-summary"
35
33
  },
36
34
  "prepush": [
37
- "npm run verify"
35
+ "npm run eslint --silent"
38
36
  ],
39
37
  "precommit": [
40
- "npm run verify"
38
+ "npm run eslint --silent"
41
39
  ],
42
40
  "keywords": [
43
41
  "file cache",
@@ -60,25 +58,23 @@
60
58
  "projectName": "file-entry-cache"
61
59
  },
62
60
  "devDependencies": {
63
- "chai": "^3.2.0",
64
- "changelogx": "^1.0.18",
65
- "commander": "^2.6.0",
66
- "del": "^2.0.2",
67
- "esbeautifier": "^4.2.11",
68
- "eslinter": "^2.3.3",
69
- "glob-expand": "^0.1.0",
70
- "istanbul": "^0.3.6",
71
- "mocha": "^2.1.0",
72
- "precommit": "^1.1.5",
73
- "prepush": "^3.1.4",
74
- "proxyquire": "^1.3.1",
75
- "sinon": "^1.12.2",
76
- "sinon-chai": "^2.7.0",
77
- "watch-run": "^1.2.1",
78
- "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"
79
76
  },
80
77
  "dependencies": {
81
- "flat-cache": "^1.2.1",
82
- "object-assign": "^4.0.1"
78
+ "flat-cache": "^3.0.4"
83
79
  }
84
80
  }