24 lines
414 B
JavaScript
24 lines
414 B
JavaScript
const { execSync } = require('child_process')
|
|
const fs = require('fs-extra')
|
|
const path = require('path')
|
|
|
|
function cleanOutRoot() {
|
|
const outDir = path.resolve(process.cwd(), 'out')
|
|
|
|
if (!fs.pathExistsSync(outDir)) {
|
|
return
|
|
}
|
|
|
|
|
|
fs.removeSync(outDir)
|
|
|
|
if (fs.pathExistsSync(outDir)) {
|
|
execSync(`cmd /c rd /s /q "${outDir}"`, { stdio: 'ignore' })
|
|
|
|
process.exitCode = 1
|
|
}
|
|
}
|
|
|
|
cleanOutRoot()
|
|
|