clean-dist.js 406 B

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