imrishabh18/rp2040-motor-controller
This circuit incorporates a USB-C Power Delivery (PD) interface with a CH224K controller, a WJ500V-5.08-04P motor output connector, multiple power conditioning components including capacitors, resistors, diodes, and an RP2040 microcontroller, to manage motor control, signal routing, and power management for a USB-powered stepper motor system.
- Version
- 1.0.14
- License
- unset
- Stars
- 0
scripts/check-built.ts
import { mkdirSync, writeFileSync } from "node:fs";
// tsci check currently prints diagnostics without failing on embedded errors.
// Gate the reported count as well as the process exit status.
const file = process.argv[2] ?? "dist/index/circuit.json";
mkdirSync("reports", { recursive: true });
for (const [name, args] of [
["tsci-check", ["check", file]],
["shorts", ["check", "shorts", file, "--mode", "gerber", "--layer", "all"]],
] as const) {
const process = Bun.spawn(["bunx", "--no-install", "tsci", ...args], {
stdout: "pipe", stderr: "pipe",
});
const [stdout, stderr, code] = await Promise.all([
new Response(process.stdout).text(),
new Response(process.stderr).text(),
process.exited,
]);
const output = stdout + stderr;
writeFileSync(`reports/${name}.log`, output);
console.log(output);
if (code !== 0 || (name === "tsci-check" && !/^Errors: 0\s*$/m.test(output)) ||
(name === "shorts" && !output.includes("No shorts detected"))) {
throw new Error(`${name} failed; see reports/${name}.log`);
}
}