abse/boostxl-tmp107
This code defines a 6-pin electronic component with a specified footprint, 3D models, and pin labels, suitable for PCB design and visualization.
- Version
- 1.0.7
- License
- unset
- Stars
- 0
scripts/verify-release.mjs
import { readFile } from "node:fs/promises"
const circuit = JSON.parse(
await readFile(new URL("../dist/index/circuit.json", import.meta.url), "utf8"),
)
const fail = (message) => {
throw new Error(`Release verification failed: ${message}`)
}
const assert = (condition, message) => {
if (!condition) fail(message)
}
const byType = (type) => circuit.filter((element) => element.type === type)
const populatedComponents = byType("source_component").filter(
(component) => component.supplier_part_numbers,
)
const byName = new Map(
populatedComponents.map((component) => [component.name, component]),
)
const errors = circuit.filter((element) => element.type.includes("error"))
assert(errors.length === 0, `${errors.length} circuit error element(s) remain`)
const board = byType("pcb_board")[0]
assert(board, "pcb_board is missing")
assert(board.width === 53.34 && board.height === 40.64, "board must be 53.34 x 40.64 mm")
assert(board.num_layers === 2, "board must have two copper layers")
assert(board.min_via_hole_diameter === 0.3, "minimum via hole must be 0.3 mm")
assert(board.min_via_pad_diameter === 0.45, "minimum via pad must be 0.45 mm")
const expectedParts = {
J1: ["SSQ-110-03-T-D", "C5379997"],
J2: ["SSQ-110-03-T-D", "C5379997"],
J3: ["PZ254V-12-6P", "C492420"],
U1: ["SN74LVC1G07DBVR", "C7829"],
U2: ["TMP107BIDR", "C2870479"],
U3: ["TMP107BIDR", "C2870479"],
U4: ["TMP107BIDR", "C2870479"],
R1: ["0603WAF3301T5E", "C22978"],
R2: ["CQ03WAF1002T5E", "C516551"],
C1: ["GRM188R71E104KA01D", "C77050"],
C2: ["GRM188R71E104KA01D", "C77050"],
C3: ["GRM188R71E104KA01D", "C77050"],
C4: ["GRM188R71E104KA01D", "C77050"],
}
assert(byName.size === Object.keys(expectedParts).length, "expected exactly 13 populated components")
for (const [name, [mpn, jlcpcb]] of Object.entries(expectedParts)) {
const component = byName.get(name)
assert(component, `${name} is missing`)
assert(component.manufacturer_part_number === mpn, `${name} MPN differs from ${mpn}`)
assert(component.supplier_part_numbers?.jlcpcb?.includes(jlcpcb), `${name} must use JLCPCB ${jlcpcb}`)
}
const sheets = byType("schematic_sheet")
assert(sheets.length === 1, "expected one complete schematic sheet")
assert(
sheets[0].name === "BOOSTXL-TMP107 Complete Schematic",
"complete schematic sheet name changed",
)
const u1Projection = byType("schematic_component").find(
(component) => component.symbol_name === "opamp_with_power_right",
)
assert(u1Projection, "U1 must use the connected powered-triangle schematic projection")
const couponBoxes = byType("schematic_rect").filter(
(rect) => rect.width === 4.4 && rect.height === 7.2,
)
assert(couponBoxes.length === 2, "U3 and U4 must use the two TI-proportioned 4.4 x 7.2 mm coupon boxes")
for (const box of couponBoxes) {
assert(box.center.y === -2.2, `${box.schematic_rect_id} vertical alignment changed`)
}
const pcbComponents = byType("pcb_component")
for (const name of ["J1", "J2"]) {
const sourceId = byName.get(name).source_component_id
const component = pcbComponents.find((item) => item.source_component_id === sourceId)
assert(component?.layer === "bottom", `${name} must be bottom-mounted so the female socket points down`)
}
assert(byType("pcb_cutout").length === 16, "expected sixteen routed breakaway slots")
assert(byType("pcb_trace").length > 0, "autorouted PCB traces are missing")
assert(byType("pcb_copper_pour").some((pour) => pour.layer === "bottom"), "bottom ground pour is missing")
const vias = byType("pcb_via")
assert(vias.length > 0, "expected routed vias")
for (const via of vias) {
assert(via.hole_diameter >= 0.3, `${via.pcb_via_id} hole is below 0.3 mm`)
assert(via.outer_diameter >= 0.45, `${via.pcb_via_id} pad is below 0.45 mm`)
}
console.log(
`Release verification passed: ${byName.size} parts, ${sheets.length} sheets, ` +
`${byType("pcb_trace").length} routed trace groups, ${vias.length} vias, zero circuit errors.`,
)