mohan-bee/mini-mp3-player

Portable, battery-powered MP3 player hardware with USB charging, microSD storage, an MCU, VS10xx audio decoder, headphone output, status controls, and regulated power rails.

Version
1.2.0
License
unset
Stars
0

scripts/render-sheets.mjs

import fs from 'node:fs'
import { convertCircuitJsonToSchematicSvg } from 'circuit-to-svg'
import { Resvg } from '@resvg/resvg-js'

const circuit = JSON.parse(fs.readFileSync('dist/index/circuit.json', 'utf8'))
fs.mkdirSync('dist/sheets', { recursive: true })
for (const sheet of circuit.filter(e => e.type === 'schematic_sheet')) {
 const svg = convertCircuitJsonToSchematicSvg(circuit, {
  schematicSheetId: sheet.schematic_sheet_id, width: 1800, height: 1400,
 })
 fs.writeFileSync(`dist/sheets/${sheet.name}.svg`, svg)
 fs.writeFileSync(`dist/sheets/${sheet.name}.png`, new Resvg(svg).render().asPng())
}