zhangwei
3 天以前 51d0f634f6fe65d4718c5c0170f2e94e05ea787b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// clean.js
import fs from 'fs';
import path from 'path';
 
const directoriesToDelete = ['dist'];
 
// 删除文件夹
directoriesToDelete.forEach((dir) => {
    const dirPath = path.join(process.cwd(), dir);
    if (fs.existsSync(dirPath)) {
        fs.rmSync(dirPath, { recursive: true, force: true });
        console.log(`Deleted directory: ${dirPath}`);
    } else {
        console.log(`Directory not found: ${dirPath}`);
    }
});