Harden bot, storage and web API

This commit is contained in:
Shinuwa 2026-06-30 17:25:00 +02:00
parent e974bc6660
commit 20624a5c9c
43 changed files with 1265 additions and 1012 deletions

31
scripts/check-syntax.js Normal file
View file

@ -0,0 +1,31 @@
import fs from "node:fs";
import path from "node:path";
import { spawnSync } from "node:child_process";
const ROOTS = ["index.js", "deployCommands.js", "src", "public/scripts", "scripts", "test"];
function collectJavaScriptFiles(entry) {
const absolutePath = path.resolve(entry);
const stat = fs.statSync(absolutePath);
if (stat.isFile()) {
return absolutePath.endsWith(".js") ? [absolutePath] : [];
}
return fs
.readdirSync(absolutePath, { withFileTypes: true })
.flatMap((child) =>
collectJavaScriptFiles(path.join(absolutePath, child.name))
);
}
const files = ROOTS.flatMap(collectJavaScriptFiles);
for (const file of files) {
const result = spawnSync(process.execPath, ["--check", file], {
stdio: "inherit",
});
if (result.status !== 0) {
process.exit(result.status || 1);
}
}
console.log(`Syntax checked: ${files.length} JavaScript files`);