hrithik18k/punck-tscircuit-recreation

A four-layer Eurorack drum/sampler controller PCB built around an STM32H743, dual QSPI flash, PCM5100 stereo DAC, TL074 analog audio circuitry, input clamps, 12V-to-3.3V power regulation, MIDI/USB/SWD connectors, controls, LEDs, and trigger/audio I/O.

Version
1.0.3
License
unset
Stars
0

scripts/preview-native.ts

import fs from 'node:fs'
// Publish snapshots only from successful native builds. Never substitute imported routes.
fs.mkdirSync('preview',{recursive:true})
for(const name of ['components','controls']) {
 const input=`dist/native/${name}/circuit.json`
 const json=JSON.parse(fs.readFileSync(input,'utf8'))
 const errors=json.filter((e:any)=>e.type.endsWith('_error'))
 if(errors.length)throw Error(`${name}: ${errors.length} errors; refusing to replace the preview`)
 if(!json.some((e:any)=>e.type==='schematic_component')||!json.some((e:any)=>e.type==='pcb_trace'))throw Error(`${name}: schematic or routing missing`)
 fs.copyFileSync(input,`preview/${name}.circuit.json`)
}