24 lines
513 B
JavaScript
24 lines
513 B
JavaScript
import * as fs from 'fs'
|
|
import * as path from 'path'
|
|
import { fileURLToPath } from 'url'
|
|
|
|
|
|
const __filename = fileURLToPath(import.meta.url)
|
|
const __dirname = path.dirname(__filename)
|
|
|
|
|
|
const dist = path.join(__dirname, '../', 'dist')
|
|
|
|
export function removeDist() {
|
|
const isExists = fs.existsSync(dist)
|
|
if (isExists) {
|
|
fs.rmdirSync(dist, { recursive: true })
|
|
}
|
|
}
|
|
|
|
export function createDist() {
|
|
const isExists = fs.existsSync(dist)
|
|
if (!isExists) {
|
|
fs.mkdirSync(dist)
|
|
}
|
|
} |