1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 |
|
8 | var pathModule = require('path');
|
9 |
|
10 | var fs = require('fs');
|
11 |
|
12 |
|
13 | var klawSync = require('klaw-sync');
|
14 |
|
15 |
|
16 | var md5 = require('md5');
|
17 |
|
18 | var dirChecksum = function dirChecksum(dirPath) {
|
19 | var basePath = pathModule.resolve(dirPath);
|
20 | var files = klawSync(dirPath, {
|
21 | nodir: true,
|
22 | filter: function filter(_ref) {
|
23 | var path = _ref.path;
|
24 | return !RegExp("^".concat(basePath, "/node_modules/")).test(path) && !RegExp("^".concat(basePath, "/dist/")).test(path) && !RegExp("^".concat(basePath, "/.git/")).test(path) && !RegExp("^".concat(basePath, "/coverage/")).test(path) && !RegExp("^".concat(basePath, "/lib/")).test(path) && !RegExp("^".concat(basePath, "/data/")).test(path);
|
25 | }
|
26 | }).map(function (f) {
|
27 | return f.path;
|
28 | });
|
29 | var md5s = files.map(function (f) {
|
30 | return fs.readFileSync(f);
|
31 | });
|
32 | var concatenatedMd5s = md5s.join();
|
33 | var finalMd5 = md5(concatenatedMd5s);
|
34 | return finalMd5;
|
35 | };
|
36 |
|
37 | var _default = dirChecksum;
|
38 | exports.default = _default; |
\ | No newline at end of file |