mohan-bee/rc-link-breakaway-panel

A four-layer RC link panel combining an STM32/E28 2.4‑GHz transmitter with USB-RP2040 socket and an STM32/E28 receiver providing six buffered PWM servo outputs, regulated 3.3‑V power, headers, controls, and protection/decoupling.

Version
0.1.5
License
unset
Stars
0

tools/check-built.mjs

import { readFileSync, writeFileSync } from "node:fs";
import { runAllNetlistChecks, runAllPlacementChecks, runAllSchematicChecks, runAllRoutingChecks } from "@tscircuit/checks";

const circuit = JSON.parse(readFileSync("dist/index/circuit.json", "utf8"));
const report = {};
for (const [name, check] of [["netlist", runAllNetlistChecks], ["placement", runAllPlacementChecks], ["schematic", runAllSchematicChecks], ["routing", runAllRoutingChecks]]) {
  const findings = await check(circuit);
  report[name] = findings;
  if (findings.some(f => f.type.endsWith("error"))) throw new Error(`${name} failed`);
}
if (circuit.some(e => e.type.endsWith("error"))) throw new Error("Build contains errors");
if (circuit.some(e => e.type === "cad_component" && e.footprinter_string?.includes("_nosilkscreen"))) throw new Error("PCB-only footprint modifiers must not reach the CAD renderer");
const stylingWarnings = circuit.filter(e => e.type.includes("styling_warning") || e.type.includes("style_warning") || ["source_refdes_convention_warning", "source_confusing_net_name_warning", "schematic_element_outside_sheet_warning"].includes(e.type));
if (stylingWarnings.length) throw new Error(`${stylingWarnings.length} styling/naming/sheet warnings remain`);
writeFileSync("validation/native-checks.json", JSON.stringify({ status: "pass", ...report }, null, 2));
writeFileSync("validation/styling-audit.json", JSON.stringify({status: "pass", stylingWarnings: 0, remainingWarnings: circuit.filter(e => e.type.includes("warning"))}, null, 2));
console.log("Native checks: no errors; zero styling, naming and sheet-boundary warnings.");