-
-
Notifications
You must be signed in to change notification settings - Fork 123
Expand file tree
/
Copy pathcleanup.cjs
More file actions
27 lines (22 loc) · 829 Bytes
/
cleanup.cjs
File metadata and controls
27 lines (22 loc) · 829 Bytes
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
const fs = require('fs');
const path = require('path');
const currentDir = path.dirname(require.main.filename);
function deleteFolderRecursive(path) {
if (fs.existsSync(path) && fs.lstatSync(path).isDirectory()) {
fs.readdirSync(path).forEach(function (file, index) {
let curPath = path + '/' + file;
if (fs.lstatSync(curPath).isDirectory()) {
// recurse
deleteFolderRecursive(curPath);
} else {
// delete file
fs.unlinkSync(curPath);
}
});
console.log(`Deleting directory "${path}"...`);
fs.rmdirSync(path);
}
}
deleteFolderRecursive(`${currentDir}\\node_modules\\vue-data-ui`);
deleteFolderRecursive(`${currentDir}\\node_modules\\.vite`);
deleteFolderRecursive('dist');