imrishabh18/nema-23-stepper-controller

A four-layer NEMA23 stepper motor controller PCB featuring an RP2040 MCU, DRV8452 dual-phase driver, USB‑C PD power input/protection, current and temperature sensing, status LED/buzzer, and optional magnetic encoder.

Version
1.3.2
License
unset
Stars
1

scripts/check-drc.mjs

import {spawnSync} from 'node:child_process'
import {readFileSync,writeFileSync,mkdirSync} from 'node:fs'
import {runAllChecks} from '@tscircuit/checks'

// Core may log asynchronous checker exceptions without returning a nonzero exit.
// Treat these as failures and independently invoke all DRC checks as well.
const result=spawnSync('bun',['run','build'],{encoding:'utf8',maxBuffer:32*1024*1024})
process.stdout.write(result.stdout??'');process.stderr.write(result.stderr??'')
if(result.error)throw result.error
if(result.status!==0||/Async effect error|Unresolved boundary conflict/.test((result.stdout??'')+(result.stderr??'')))throw Error('Build or asynchronous DRC failed')
const json=JSON.parse(readFileSync('dist/index/circuit.json'))
const results=await runAllChecks(json)
mkdirSync('checks',{recursive:true})
writeFileSync('checks/drc.json',JSON.stringify(results,null,2))
const errors=results.filter(e=>e.type.endsWith('_error')||e.type==='error')
if(errors.length)throw Error(JSON.stringify(errors,null,2))
const verify=spawnSync('bun',['run','verify:built'],{stdio:'inherit'})
if(verify.error||verify.status!==0)throw verify.error??Error('Built assertions failed')
console.log(`PASS: independent full DRC, zero errors (${results.length} non-error diagnostic records).`)