UNPKG

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