MustafaMulla29/rp2040-bldc-motor-controller-new
A USB‑C PD–powered RP2040 BLDC motor controller PCB with 3.3 V logic, MCT8329A sensorless commutation, three MOSFET half-bridges, protected power switching, USB data, controls, and motor connectors.
- Version
- 0.3.82
- License
- unset
- Stars
- 0
scripts/validate.mjs
import { spawnSync } from "node:child_process"
import { mkdirSync, writeFileSync } from "node:fs"
const outputDir = ".tscircuit/checks"
mkdirSync(outputDir, { recursive: true })
const checks = [
["typecheck", "bun", ["run", "typecheck"]],
["saved-routing", "bun", ["scripts/check-saved-routing.mjs"]],
["netlist", "./node_modules/.bin/tsci", ["check", "netlist", "index.circuit.tsx"]],
["schematic-placement", "./node_modules/.bin/tsci", ["check", "schematic-placement", "index.circuit.tsx"]],
["placement", "./node_modules/.bin/tsci", ["check", "placement", "index.circuit.tsx"]],
]
for (const [name, command, args] of checks) {
const r = spawnSync(command, args, { encoding: "utf8", timeout: 240_000, maxBuffer: 20e6 })
const output = (r.stdout ?? "") + (r.stderr ?? "")
writeFileSync(`${outputDir}/${name}.txt`, output)
const schematicIssues = [...output.matchAll(/<SchematicPlacementIssues>([\s\S]*?)<\/SchematicPlacementIssues>/g)]
.some(match => match[1].trim().length > 0)
const failed = r.status !== 0 || Boolean(schematicIssues) || /Errors: [1-9]/.test(output) || /source_failed_to_create_component_error/.test(output)
console.log(`${name}: ${failed ? "FAIL" : "PASS"} (${outputDir}/${name}.txt)`)
if (failed) process.exit(1)
}
console.log("Representation checks passed. This is not an electrical or fabrication signoff.")