-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathremove-bitcore-lib-dep.js
More file actions
33 lines (28 loc) · 1.07 KB
/
remove-bitcore-lib-dep.js
File metadata and controls
33 lines (28 loc) · 1.07 KB
1
2
3
4
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
const fs = require('fs');
const Path = require('path');
const prefix = (__dirname.indexOf('node_modules') === -1) ? './' : './../../../';
console.log('remove-bitcore-lib-dep started with prefix: ', prefix);
const pathsToClean = [
Path.resolve(prefix + 'node_modules/bitcore-ecies/node_modules/bitcore-lib'),
Path.resolve(prefix + 'node_modules/bitcore-message/node_modules/bitcore-lib'),
Path.resolve(prefix + 'node_modules/bitcore-mnemonic/node_modules/bitcore-lib'),
];
console.log(pathsToClean);
(function () {
function deleteFolderRecursive(path) {
if (fs.existsSync(path)) {
fs.readdirSync(path).forEach(function (file, index) {
const curPath = path + "/" + file;
if (fs.lstatSync(curPath).isDirectory()) { // recurse
deleteFolderRecursive(curPath);
} else { // delete file
fs.unlinkSync(curPath);
}
});
fs.rmdirSync(path);
}
}
for (let path of pathsToClean) {
deleteFolderRecursive(path);
}
})();