const roots = ["apps", "packages", "scripts"]; const limit = 400; const oversized: string[] = []; for (const root of roots) { const glob = new Bun.Glob("**/*.ts"); for await (const relative of glob.scan({ cwd: root, onlyFiles: true })) { const path = `${root}/${relative}`; const lineCount = (await Bun.file(path).text()).split("\n").length; if (lineCount > limit) oversized.push(`${path}: ${lineCount} 行`); } } if (oversized.length > 0) { console.error(`以下文件超过 ${limit} 行:\n${oversized.join("\n")}`); process.exit(1); } console.log(`文件规模检查通过:TypeScript 文件均不超过 ${limit} 行。`); export {};