-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathcleanup.js
29 lines (26 loc) · 812 Bytes
/
cleanup.js
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
/* eslint-disable */
const fs = require('fs')
const Path = require('path')
/* eslint-enable */
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, '../dist', folder))
} else {
deleteFolderRecursive(Path.join(__dirname, '../dist/cjs'))
deleteFolderRecursive(Path.join(__dirname, '../dist/esm'))
deleteFolderRecursive(Path.join(__dirname, '../dist/umd'))
deleteFolderRecursive(Path.join(__dirname, '../dist/types'))
}