abse/smartwatch-flex-top-only
Three-panel flex smartwatch with two parallel R3.9 bends, all components flat-top, low-profile JST connector harnesses, split heartbeat optical windows and screw-retained PCB mounting. Modeled 39 × 50.5 × 14.5mm prototype; 100% routing, zero native DRC and shorts. Hardware qualification pending.
- Version
- 0.2.20
- License
- unset
- Stars
- 0
scripts/compact-cloud-circuits.mjs
import fs from 'node:fs'
import path from 'node:path'
import crypto from 'node:crypto'
// Packaging only: preserve every field and array entry from the real CLI build.
// Pretty-printed native circuit JSON can make registry artifact import time out.
export function compactCloudCircuits(outputDir='dist') {
const manifest=JSON.parse(fs.readFileSync('mechanical/site-previews/manifest.json','utf8'))
const sha=text=>crypto.createHash('sha256').update(text).digest('hex')
const files=[]
for(const name of Object.keys(manifest.entries)) {
const file=path.join(outputDir,name,'circuit.json')
const before=fs.readFileSync(file,'utf8')
const data=JSON.parse(before)
if(data.some(e=>e.type.includes('error')))throw Error(`Native error in ${name}`)
const canonical=JSON.stringify(data)
const compact=canonical+'\n'
if(JSON.stringify(JSON.parse(compact))!==canonical)throw Error(`Circuit data changed during packing: ${name}`)
fs.writeFileSync(file,compact)
files.push({entry:name,beforeBytes:Buffer.byteLength(before),afterBytes:Buffer.byteLength(compact),unchangedCircuitDataSha256:sha(canonical)})
}
const beforeBytes=files.reduce((sum,f)=>sum+f.beforeBytes,0)
const afterBytes=files.reduce((sum,f)=>sum+f.afterBytes,0)
const report={status:'PASS',allCircuitFieldsPreserved:true,beforeBytes,afterBytes,files}
fs.mkdirSync('reports',{recursive:true})
fs.writeFileSync('reports/cloud-circuit-packing.json',JSON.stringify(report,null,2)+'\n')
console.log(`Packed ${files.length} complete circuit files: ${beforeBytes} -> ${afterBytes} bytes; every circuit field preserved`)
return report
}