1
0
Files
DiAL/scripts/clean.ts
lanyuanxiaoyao ad87be6956 refactor: 精简 package.json scripts,引入 eslint-plugin-prettier 统一格式检查
删除 start/build:web/format:check,简化 check 为 typecheck+lint+test

引入 eslint-plugin-prettier 将 Prettier 集成至 ESLint,统一质量检查入口

简化 lint-staged 配置,扩展 clean 清理范围至 dist/
2026-05-12 21:43:20 +08:00

21 lines
692 B
TypeScript

import { rm } from "node:fs/promises";
import { resolve } from "node:path";
const root = resolve(import.meta.dir, "..");
const patterns: Array<{ desc: string; glob: string }> = [
{ desc: "构建产物", glob: "dist/**" },
{ desc: "Bun 构建缓存", glob: ".build/**" },
{ desc: "Bun 构建临时文件", glob: ".*.bun-build" },
];
for (const { desc, glob } of patterns) {
const entries = await Array.fromAsync(new Bun.Glob(glob).scan({ cwd: root, dot: true }));
if (entries.length === 0) continue;
for (const entry of entries) {
const full = resolve(root, entry);
await rm(full, { force: true, recursive: true });
console.log(`已清理 ${desc}: ${entry}`);
}
}