Devesh36/key-finder

A compact BLE key finder for keys, bags and remotes: replaceable CR2032, piezo alert, status LED and pair button in a 38 mm black keyring enclosure. Includes routed PCB, enclosed/exploded assembly and BOM. Firmware/app and physical qualification remain separate.

Version
0.1.2
License
unset
Stars
0

scripts/normalize-export.ts

import {readFileSync,writeFileSync,existsSync} from 'node:fs'
// Format display annotations without changing electrical geometry.
for(const entry of ['index','assembly','exploded']) {
 const path=`dist/${entry}/circuit.json`
 if(!existsSync(path)) continue
 const text=readFileSync(path,'utf8')
 const json=JSON.parse(text)
 let count=0
 for(const element of json) if(element.type==='pcb_component') {
  for(const field of ['display_offset_x','display_offset_y']) if(typeof element[field]==='number') {
   element[field]=`${element[field]}mm`; count++
  }
 }
 writeFileSync(path,JSON.stringify(json,null,2))
 console.log(`${entry}: normalized ${count} display-offset annotations; copper coordinates unchanged.`)
}