22 lines
989 B
JavaScript
22 lines
989 B
JavaScript
import { readFile } from "node:fs/promises";
|
|
import { resolve } from "node:path";
|
|
import { FIVE_AXIS_CASES } from "../web/workspace/five-axis-machine-catalog.mjs";
|
|
|
|
const root = resolve(new URL("..", import.meta.url).pathname);
|
|
const checks = [];
|
|
const errors = [];
|
|
for (const item of FIVE_AXIS_CASES) {
|
|
const paths = [...item.localCases, item.kinematicsSource];
|
|
for (const relative of paths) {
|
|
try {
|
|
const text = await readFile(resolve(root, relative), "utf8");
|
|
checks.push({ case: item.id, path: relative, bytes: Buffer.byteLength(text) });
|
|
} catch (error) {
|
|
errors.push({ case: item.id, path: relative, error: error instanceof Error ? error.message : String(error) });
|
|
}
|
|
}
|
|
}
|
|
const report = { report_id: "FIVE-AXIS-CATALOG-LOCAL-SOURCE", status: errors.length ? "failed" : "verified", caseCount: FIVE_AXIS_CASES.length, fileCount: checks.length, checks, errors };
|
|
console.log(JSON.stringify(report, null, 2));
|
|
if (errors.length) process.exitCode = 1;
|