abse/boostxl-bassensors
This code defines React components for various electronic hardware components such as LEDs and sensors, specifying their 3D models, footprints with SMT pads, silkscreen outlines, and pin labels for PCB integration.
- Version
- 1.0.3
- License
- unset
- Stars
- 0
scripts/verify-release.mjs
import assert from "node:assert/strict"
import { readFile } from "node:fs/promises"
const circuit = JSON.parse(await readFile("dist/index/circuit.json", "utf8"))
const source = await readFile("index.circuit.tsx", "utf8")
const expectedParts = {
J1: ["SSQ_110_03_T_D", "C5379997"],
J2: ["SSQ_110_03_T_D", "C5379997"],
C5: ["C1608X7R1C105KT000N", "C76617"],
R2: ["CQ03WAF1002T5E", "C516551"],
R3: ["CQ03WAF1002T5E", "C516551"],
D1: ["A_19_217_GHC_YR1S2_3T", "C72043"],
R4: ["0603WAF4700T5E", "C23179"],
D2: ["KT_0603R", "C2286"],
R7: ["0603WAF1001T5E", "C21190"],
R1: ["0603WAF0000T5E", "C21189"],
J5: ["SM05B_SRSS_TB_LF__SN_", "C136657"],
J6: ["SM05B_SRSS_TB_LF__SN_", "C136657"],
U1: ["TMP116AIDRVR", "C2691433"],
C1: ["GRM188R71E104KA01D", "C77050"],
R8: ["0603WAF0000T5E", "C21189"],
Q1: ["SI2323DS-T1-ES", "C22363748"],
U4: ["DRV5055A4EDBZRQ1", "C2152957"],
C4: ["GRM188R71H103KA01D", "C77053"],
R6: ["0603WAF0000T5E", "C21189"],
Q2: ["SI2323DS-T1-ES", "C22363748"],
U3: ["HDC2010YPAR", "C477922"],
C3: ["GRM188R71E104KA01D", "C77050"],
R5: ["0603WAF0000T5E", "C21189"],
U2: ["OPT3001DNPR", "C90462"],
C2: ["GRM188R71E104KA01D", "C77050"],
}
const components = circuit.filter((e) => e.type === "source_component")
assert.deepEqual(
components.map((c) => c.name).sort(),
Object.keys(expectedParts).sort(),
"The source BOM does not match the reviewed 25-reference design",
)
for (const component of components) {
const [expectedMpn, expectedLcsc] = expectedParts[component.name]
assert.equal(component.manufacturer_part_number, expectedMpn, `${component.name}: wrong MPN`)
assert.ok(
component.supplier_part_numbers?.jlcpcb?.includes(expectedLcsc),
`${component.name}: missing reviewed JLCPCB/LCSC part ${expectedLcsc}`,
)
}
const importedNonPassives = {
SSQ_110_03_T_D: ["J1", "J2"],
A_19_217_GHC_YR1S2_3T: ["D1"],
KT_0603R: ["D2"],
SM05B_SRSS_TB_LF__SN_: ["J5", "J6"],
TMP116AIDRVR: ["U1"],
SI2323DS_T1_ES: ["Q1", "Q2"],
DRV5055A4EDBZRQ1: ["U4"],
HDC2010YPAR: ["U3"],
OPT3001DNPR: ["U2"],
}
for (const [componentName, refs] of Object.entries(importedNonPassives)) {
assert.ok(source.includes(`import { ${componentName} }`), `${componentName}: missing local JLCPCB import`)
for (const ref of refs) {
assert.match(source, new RegExp(`<${componentName}\\s+[\\s\\S]*?name=["']${ref}["']`), `${ref}: not instantiated from ${componentName}`)
}
}
assert.ok(!source.includes("<netlabel"), "Explicit <netlabel> elements are not allowed in this project")
const boards = circuit.filter((e) => e.type === "pcb_board")
assert.equal(boards.length, 1, "Expected exactly one PCB")
const board = boards[0]
assert.equal(board.width, 63.5, "Unexpected board width")
assert.equal(board.height, 35.56, "Unexpected board height")
assert.equal(board.min_via_hole_diameter, 0.3, "Minimum via hole must be 0.3 mm")
assert.equal(board.min_via_pad_diameter, 0.45, "Minimum via pad must be 0.45 mm")
const holes = circuit.filter((e) => e.type === "pcb_hole")
assert.equal(holes.length, 4, "Expected four mounting holes")
for (const hole of holes) assert.equal(hole.hole_diameter, 3.2, "Unexpected mounting-hole diameter")
const cutouts = circuit.filter((e) => e.type === "pcb_cutout")
assert.equal(cutouts.length, 6, "Expected six provisional breakaway slots")
for (const cutout of cutouts) {
assert.equal(cutout.shape, "rect", "Breakaway slot must be rectangular")
assert.equal(cutout.center.x, 27.1, "Unexpected breakaway-slot X position")
}
const sheets = circuit.filter((e) => e.type === "schematic_sheet")
assert.equal(sheets.length, 1, "TI reference schematic is a one-sheet design")
assert.equal(sheets[0].name, "BOOSTXL-BASSENSORS Complete Schematic")
const errors = circuit.filter((e) => typeof e.type === "string" && e.type.endsWith("_error"))
assert.deepEqual(errors, [], `Circuit JSON contains errors: ${errors.map((e) => e.type).join(", ")}`)
console.log("Release audit passed: 25 parts, JLCPCB provenance, one sheet, board rules, and geometry checks")