Spaces:
Sleeping
Sleeping
File size: 895 Bytes
06671aa | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | import { readdirSync, statSync } from "node:fs";
import { join, relative } from "node:path";
const root = process.cwd();
const srcDir = join(root, "src");
const offenders = [];
function walk(dir) {
for (const entry of readdirSync(dir)) {
const full = join(dir, entry);
const stat = statSync(full);
if (stat.isDirectory()) {
walk(full);
continue;
}
if (entry.endsWith(".js") || entry.endsWith(".js.map")) {
offenders.push(relative(root, full));
}
}
}
walk(srcDir);
if (offenders.length > 0) {
console.error("");
console.error("ERROR: Generated JavaScript files were found inside backend/src.");
console.error("backend/src must contain TypeScript source only.");
console.error("");
console.error("Delete these files:");
for (const file of offenders) {
console.error(` - ${file}`);
}
console.error("");
process.exit(1);
}
|