-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcleanup.js
More file actions
26 lines (23 loc) · 700 Bytes
/
Copy pathcleanup.js
File metadata and controls
26 lines (23 loc) · 700 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
const fs = require('fs')
const Path = require('path')
const deleteFolderRecursive = (path) => {
if (fs.existsSync(path)) {
fs.readdirSync(path).forEach((file) => {
const curPath = Path.join(path, file)
if (fs.lstatSync(curPath).isDirectory()) {
deleteFolderRecursive(curPath)
} else {
fs.unlinkSync(curPath)
}
})
fs.rmdirSync(path)
}
}
const folder = process.argv.slice(2)[0]
if (folder) {
deleteFolderRecursive(Path.join(__dirname, 'build', folder))
} else {
deleteFolderRecursive(Path.join(__dirname, 'build/cjs'))
deleteFolderRecursive(Path.join(__dirname, 'build/esm'))
deleteFolderRecursive(Path.join(__dirname, 'build/umd'))
}