增加日志清理功能

master
yutent 2023-03-23 14:34:43 +08:00
parent 135bced616
commit 10fe226d0a
1 changed files with 7 additions and 0 deletions

View File

@ -21,6 +21,7 @@ export default function compile(root = '', isProd = false, es) {
if (isProd) {
fs.rm(DIST_DIR, true)
}
let ready = false
chokidar
.watch(SOURCE_DIR)
@ -28,6 +29,10 @@ export default function compile(root = '', isProd = false, es) {
let file = filePath.slice(SOURCE_DIR.length)
let target = join(DIST_DIR, file)
if (ready) {
console.clear()
}
if (act === 'add' || act === 'change') {
let ext = file.slice(file.lastIndexOf('.') + 1)
@ -65,6 +70,8 @@ export default function compile(root = '', isProd = false, es) {
}
})
.on('ready', () => {
console.clear()
ready = true
if (isProd) {
process.exit()
}