From 10fa083915647abe575f62ca7f99f3aec39e8ae4 Mon Sep 17 00:00:00 2001 From: Jon Cherry <53948466+joncherry@users.noreply.github.com> Date: Sat, 22 Nov 2025 22:41:34 -0800 Subject: [PATCH 01/10] fix: add vson footprint --- src/fn/index.ts | 1 + src/fn/vson.ts | 153 ++++++++++++++++++ src/footprinter.ts | 5 + ...SON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm.snap.svg | 1 + ...-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm.snap.svg | 1 + tests/vson.test.ts | 18 +++ tests/vson2.test.ts | 18 +++ 7 files changed, 197 insertions(+) create mode 100644 src/fn/vson.ts create mode 100644 tests/__snapshots__/VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm.snap.svg create mode 100644 tests/__snapshots__/VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm.snap.svg create mode 100644 tests/vson.test.ts create mode 100644 tests/vson2.test.ts diff --git a/src/fn/index.ts b/src/fn/index.ts index a697f502..df1ae6ed 100644 --- a/src/fn/index.ts +++ b/src/fn/index.ts @@ -59,6 +59,7 @@ export { sot23w } from "./sot23w" export { to92s } from "./to92s" export { jst } from "./jst" export { sod110 } from "./sod110" +export { vson } from "./vson" export { vssop } from "./vssop" export { msop } from "./msop" export { sod323w } from "./sod323w" diff --git a/src/fn/vson.ts b/src/fn/vson.ts new file mode 100644 index 00000000..c6cf82a2 --- /dev/null +++ b/src/fn/vson.ts @@ -0,0 +1,153 @@ +import type { + AnyCircuitElement, + PcbSmtPad, + PcbSilkscreenPath, +} from "circuit-json" +import { rectpad } from "../helpers/rectpad" +import { z } from "zod" +import { base_def } from "../helpers/zod/base_def" +import { length, distance } from "circuit-json" +import { dim2d } from "src/helpers/zod/dim-2d" +import { type SilkscreenRef, silkscreenRef } from "src/helpers/silkscreenRef" + +// can't use defaults because there is not a lot of common dimensions. +export const vson_def = base_def.extend({ + fn: z.string(), + num_pins: z.number().optional().default(8), + p: distance, + w: length, + h: length, + grid: dim2d, + disableEp: z.boolean().optional().describe("use a central exposed pad"), + ep: dim2d, + pinw: length, + pinh: length, +}) + +export type VsonDefInput = z.input +export type VsonDef = z.infer + +export const vson = ( + raw_params: VsonDefInput, +): { circuitJson: AnyCircuitElement[]; parameters: any } => { + const parameters = vson_def.parse(raw_params) + const { num_pins, p, w, h, grid, disableEp, ep, pinw, pinh } = parameters + + if (num_pins % 2 !== 0) { + throw new Error("invalid number of pins") + } + + const pads: PcbSmtPad[] = [] + + // place the 8 or 10 outside pins + for (let i = 0; i < num_pins; i++) { + const { pinX, pinY } = getCcwVsonCoords({ + pinCount: num_pins, + pinIndex: i, + width: w, + pitch: p, + }) + pads.push(rectpad(i + 1, pinX, pinY, pinw, pinh)) + } + + // place the central exposed pad (ep) + if (!disableEp) { + pads.push(rectpad(parameters.num_pins + 1, 0, 0, ep.x, ep.y)) + } + + // draw silkscreen lines around grid dimensions + const silkscreenPaths = getSilkscreenPaths(grid) + + // draw the text for the reference designator + const silkscreenRefText: SilkscreenRef = silkscreenRef( + 0, + grid.y / 2 + p, + grid.y / 6, + ) + + return { + circuitJson: [...pads, ...silkscreenPaths, silkscreenRefText], + parameters, + } +} + +const getCcwVsonCoords = (params: { + pinCount: number + pinIndex: number + width: number + pitch: number +}) => { + let pinY = 0 + let pinX = 0 + const centerY = ((params.pinCount / 2 - 1) * params.pitch) / 2 + const pinHalf = params.pinCount / 2 + if (params.pinIndex + 1 <= pinHalf) { + pinY = params.pitch * params.pinIndex - centerY + pinX = 0 - params.width / 2 + } else { + pinY = params.pitch * (params.pinCount - params.pinIndex - 1) - centerY + pinX = params.width / 2 + } + + return { pinX, pinY } +} + +const getSilkscreenPaths = (grid: { x: number; y: number }) => { + const borderMargin = 0.1 + const cornerLine = 0.2 + const silkscreenPaths: PcbSilkscreenPath[] = [ + // top silkscreen path + { + layer: "top", + pcb_component_id: "", + pcb_silkscreen_path_id: "", + type: "pcb_silkscreen_path", + route: [ + { + x: -grid.x / 2 - borderMargin, + y: grid.y / 2 + borderMargin - cornerLine, + }, + { + x: -grid.x / 2 - borderMargin, + y: grid.y / 2 + borderMargin, + }, + { + x: grid.x / 2 + borderMargin, + y: grid.y / 2 + borderMargin, + }, + { + x: grid.x / 2 + borderMargin, + y: grid.y / 2 + borderMargin - cornerLine, + }, + ], + stroke_width: 0.1, + }, + // bottom silkscreen path + { + layer: "top", + pcb_component_id: "", + pcb_silkscreen_path_id: "", + type: "pcb_silkscreen_path", + route: [ + { + x: -grid.x / 2 - borderMargin, + y: -grid.y / 2 - borderMargin + cornerLine, + }, + { + x: -grid.x / 2 - borderMargin, + y: -grid.y / 2 - borderMargin, + }, + { + x: grid.x / 2 + borderMargin, + y: -grid.y / 2 - borderMargin, + }, + { + x: grid.x / 2 + borderMargin, + y: -grid.y / 2 - borderMargin + cornerLine, + }, + ], + stroke_width: 0.1, + }, + ] + return silkscreenPaths +} diff --git a/src/footprinter.ts b/src/footprinter.ts index 21440424..2940f886 100644 --- a/src/footprinter.ts +++ b/src/footprinter.ts @@ -157,6 +157,11 @@ export type Footprinter = { ) => FootprinterParamsBuilder< "w" | "h" | "p" | "pl" | "pw" | "epw" | "eph" | "ep" > + vson: ( + num_pins?: number, + ) => FootprinterParamsBuilder< + "p" | "w" | "h" | "grid" | "disableEp" | "ep" | "pinw" | "pinh" + > vssop: ( num_pins?: number, ) => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw"> diff --git a/tests/__snapshots__/VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm.snap.svg b/tests/__snapshots__/VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm.snap.svg new file mode 100644 index 00000000..24520a35 --- /dev/null +++ b/tests/__snapshots__/VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm.snap.svg @@ -0,0 +1 @@ +{REF} \ No newline at end of file diff --git a/tests/__snapshots__/VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm.snap.svg b/tests/__snapshots__/VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm.snap.svg new file mode 100644 index 00000000..e3430fbb --- /dev/null +++ b/tests/__snapshots__/VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm.snap.svg @@ -0,0 +1 @@ +{REF} \ No newline at end of file diff --git a/tests/vson.test.ts b/tests/vson.test.ts new file mode 100644 index 00000000..c92c1481 --- /dev/null +++ b/tests/vson.test.ts @@ -0,0 +1,18 @@ +import { test, expect } from "bun:test" +import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" +import { fp } from "../src/footprinter" + +// can't use VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm title from kicad-viewer. +// instead have to add extra flags +test("VSON8-1EP_grid3x3mm_P0.65mm_EP1.65x2.4mm_w2.9mm_h2.9mm_pinw0.85mm_pinh0.35mm", () => { + const circuitJson = fp + .string( + "VSON8-1EP_grid3x3mm_P0.65mm_EP1.65x2.4mm_w2.9mm_h2.9mm_pinw0.85mm_pinh0.35mm", + ) + .circuitJson() + const svgContent = convertCircuitJsonToPcbSvg(circuitJson) + expect(svgContent).toMatchSvgSnapshot( + import.meta.path, + "VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm", + ) +}) diff --git a/tests/vson2.test.ts b/tests/vson2.test.ts new file mode 100644 index 00000000..a0138d2b --- /dev/null +++ b/tests/vson2.test.ts @@ -0,0 +1,18 @@ +import { test, expect } from "bun:test" +import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" +import { fp } from "../src/footprinter" + +// can't use VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm title from kicad-viewer. +// instead have to add extra flags +test("VSON10-1EP_grid3x3mm_P0.5mm_EP1.2x2mm_w2.875mm_h2.875mm_pinw0.875mm_pinh0.25mm", () => { + const circuitJson = fp + .string( + "VSON10-1EP_grid3x3mm_P0.5mm_EP1.2x2mm_w2.875mm_h2.875mm_pinw0.875mm_pinh0.25mm", + ) + .circuitJson() + const svgContent = convertCircuitJsonToPcbSvg(circuitJson) + expect(svgContent).toMatchSvgSnapshot( + import.meta.path, + "VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm", + ) +}) From c0b43a0db5ab135a2b3cdbf2eb00d7455d8b7470 Mon Sep 17 00:00:00 2001 From: Jon Cherry <53948466+joncherry@users.noreply.github.com> Date: Sat, 22 Nov 2025 22:51:46 -0800 Subject: [PATCH 02/10] fix: add vson footprint - small fix --- src/fn/vson.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fn/vson.ts b/src/fn/vson.ts index c6cf82a2..d3285193 100644 --- a/src/fn/vson.ts +++ b/src/fn/vson.ts @@ -18,7 +18,10 @@ export const vson_def = base_def.extend({ w: length, h: length, grid: dim2d, - disableEp: z.boolean().optional().describe("use a central exposed pad"), + disableEp: z + .boolean() + .optional() + .describe("do not use a central exposed pad"), ep: dim2d, pinw: length, pinh: length, From 0dc217c789be31dcf55f2d105674e062429ee9fa Mon Sep 17 00:00:00 2001 From: Jon Cherry <53948466+joncherry@users.noreply.github.com> Date: Mon, 24 Nov 2025 13:09:57 -0800 Subject: [PATCH 03/10] chore: add tests for no ep --- src/fn/vson.ts | 17 ++++++----------- src/footprinter.ts | 4 +--- .../Texas_VSON-HR-8_1.5x2mm_P0.5mm.snap.svg | 1 + .../VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm.snap.svg | 2 +- ...ON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm.snap.svg | 2 +- .../VSON-8_1.5x2mm_P0.5mm.snap.svg | 1 + tests/vson.test.ts | 4 ++-- tests/vson2.test.ts | 4 ++-- tests/vson3.test.ts | 16 ++++++++++++++++ tests/vson4.test.ts | 16 ++++++++++++++++ 10 files changed, 47 insertions(+), 20 deletions(-) create mode 100644 tests/__snapshots__/Texas_VSON-HR-8_1.5x2mm_P0.5mm.snap.svg create mode 100644 tests/__snapshots__/VSON-8_1.5x2mm_P0.5mm.snap.svg create mode 100644 tests/vson3.test.ts create mode 100644 tests/vson4.test.ts diff --git a/src/fn/vson.ts b/src/fn/vson.ts index d3285193..27041be7 100644 --- a/src/fn/vson.ts +++ b/src/fn/vson.ts @@ -16,13 +16,8 @@ export const vson_def = base_def.extend({ num_pins: z.number().optional().default(8), p: distance, w: length, - h: length, grid: dim2d, - disableEp: z - .boolean() - .optional() - .describe("do not use a central exposed pad"), - ep: dim2d, + ep: dim2d.default("0x0mm"), pinw: length, pinh: length, }) @@ -34,7 +29,7 @@ export const vson = ( raw_params: VsonDefInput, ): { circuitJson: AnyCircuitElement[]; parameters: any } => { const parameters = vson_def.parse(raw_params) - const { num_pins, p, w, h, grid, disableEp, ep, pinw, pinh } = parameters + const { num_pins, p, w, grid, ep, pinw, pinh } = parameters if (num_pins % 2 !== 0) { throw new Error("invalid number of pins") @@ -54,7 +49,7 @@ export const vson = ( } // place the central exposed pad (ep) - if (!disableEp) { + if (ep.x > 0 && ep.y > 0) { pads.push(rectpad(parameters.num_pins + 1, 0, 0, ep.x, ep.y)) } @@ -97,7 +92,7 @@ const getCcwVsonCoords = (params: { const getSilkscreenPaths = (grid: { x: number; y: number }) => { const borderMargin = 0.1 - const cornerLine = 0.2 + const cornerLine = grid.y / 30 const silkscreenPaths: PcbSilkscreenPath[] = [ // top silkscreen path { @@ -123,7 +118,7 @@ const getSilkscreenPaths = (grid: { x: number; y: number }) => { y: grid.y / 2 + borderMargin - cornerLine, }, ], - stroke_width: 0.1, + stroke_width: grid.y / 30, }, // bottom silkscreen path { @@ -149,7 +144,7 @@ const getSilkscreenPaths = (grid: { x: number; y: number }) => { y: -grid.y / 2 - borderMargin + cornerLine, }, ], - stroke_width: 0.1, + stroke_width: grid.y / 30, }, ] return silkscreenPaths diff --git a/src/footprinter.ts b/src/footprinter.ts index 2940f886..41fa3874 100644 --- a/src/footprinter.ts +++ b/src/footprinter.ts @@ -159,9 +159,7 @@ export type Footprinter = { > vson: ( num_pins?: number, - ) => FootprinterParamsBuilder< - "p" | "w" | "h" | "grid" | "disableEp" | "ep" | "pinw" | "pinh" - > + ) => FootprinterParamsBuilder<"p" | "w" | "grid" | "ep" | "pinw" | "pinh"> vssop: ( num_pins?: number, ) => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw"> diff --git a/tests/__snapshots__/Texas_VSON-HR-8_1.5x2mm_P0.5mm.snap.svg b/tests/__snapshots__/Texas_VSON-HR-8_1.5x2mm_P0.5mm.snap.svg new file mode 100644 index 00000000..1bf6ed40 --- /dev/null +++ b/tests/__snapshots__/Texas_VSON-HR-8_1.5x2mm_P0.5mm.snap.svg @@ -0,0 +1 @@ +{REF} \ No newline at end of file diff --git a/tests/__snapshots__/VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm.snap.svg b/tests/__snapshots__/VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm.snap.svg index 24520a35..c71a17f5 100644 --- a/tests/__snapshots__/VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm.snap.svg +++ b/tests/__snapshots__/VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm.snap.svg @@ -1 +1 @@ -{REF} \ No newline at end of file +{REF} \ No newline at end of file diff --git a/tests/__snapshots__/VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm.snap.svg b/tests/__snapshots__/VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm.snap.svg index e3430fbb..884c22c8 100644 --- a/tests/__snapshots__/VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm.snap.svg +++ b/tests/__snapshots__/VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm.snap.svg @@ -1 +1 @@ -{REF} \ No newline at end of file +{REF} \ No newline at end of file diff --git a/tests/__snapshots__/VSON-8_1.5x2mm_P0.5mm.snap.svg b/tests/__snapshots__/VSON-8_1.5x2mm_P0.5mm.snap.svg new file mode 100644 index 00000000..50895921 --- /dev/null +++ b/tests/__snapshots__/VSON-8_1.5x2mm_P0.5mm.snap.svg @@ -0,0 +1 @@ +{REF} \ No newline at end of file diff --git a/tests/vson.test.ts b/tests/vson.test.ts index c92c1481..1d24e781 100644 --- a/tests/vson.test.ts +++ b/tests/vson.test.ts @@ -4,10 +4,10 @@ import { fp } from "../src/footprinter" // can't use VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm title from kicad-viewer. // instead have to add extra flags -test("VSON8-1EP_grid3x3mm_P0.65mm_EP1.65x2.4mm_w2.9mm_h2.9mm_pinw0.85mm_pinh0.35mm", () => { +test("VSON8-1EP_grid3x3mm_P0.65mm_EP1.65x2.4mm_w2.9mm_pinw0.85mm_pinh0.35mm", () => { const circuitJson = fp .string( - "VSON8-1EP_grid3x3mm_P0.65mm_EP1.65x2.4mm_w2.9mm_h2.9mm_pinw0.85mm_pinh0.35mm", + "VSON8-1EP_grid3x3mm_P0.65mm_EP1.65x2.4mm_w2.9mm_pinw0.85mm_pinh0.35mm", ) .circuitJson() const svgContent = convertCircuitJsonToPcbSvg(circuitJson) diff --git a/tests/vson2.test.ts b/tests/vson2.test.ts index a0138d2b..6b694edd 100644 --- a/tests/vson2.test.ts +++ b/tests/vson2.test.ts @@ -4,10 +4,10 @@ import { fp } from "../src/footprinter" // can't use VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm title from kicad-viewer. // instead have to add extra flags -test("VSON10-1EP_grid3x3mm_P0.5mm_EP1.2x2mm_w2.875mm_h2.875mm_pinw0.875mm_pinh0.25mm", () => { +test("VSON10-1EP_grid3x3mm_P0.5mm_EP1.2x2mm_w2.875mm_pinw0.875mm_pinh0.25mm", () => { const circuitJson = fp .string( - "VSON10-1EP_grid3x3mm_P0.5mm_EP1.2x2mm_w2.875mm_h2.875mm_pinw0.875mm_pinh0.25mm", + "VSON10-1EP_grid3x3mm_P0.5mm_EP1.2x2mm_w2.875mm_pinw0.875mm_pinh0.25mm", ) .circuitJson() const svgContent = convertCircuitJsonToPcbSvg(circuitJson) diff --git a/tests/vson3.test.ts b/tests/vson3.test.ts new file mode 100644 index 00000000..dc1e3d3e --- /dev/null +++ b/tests/vson3.test.ts @@ -0,0 +1,16 @@ +import { test, expect } from "bun:test" +import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" +import { fp } from "../src/footprinter" + +// can't use Texas_VSON-HR-8_1.5x2mm_P0.5mm title from kicad-viewer. +// instead have to add extra flags +test("VSON8_grid1.5x2mm_P0.5mm_w1.45mm_pinw0.8mm_pinh0.25mm", () => { + const circuitJson = fp + .string("VSON8_grid1.5x2mm_P0.5mm_w1.45mm_pinw0.8mm_pinh0.25mm") + .circuitJson() + const svgContent = convertCircuitJsonToPcbSvg(circuitJson) + expect(svgContent).toMatchSvgSnapshot( + import.meta.path, + "Texas_VSON-HR-8_1.5x2mm_P0.5mm", + ) +}) diff --git a/tests/vson4.test.ts b/tests/vson4.test.ts new file mode 100644 index 00000000..b03840af --- /dev/null +++ b/tests/vson4.test.ts @@ -0,0 +1,16 @@ +import { test, expect } from "bun:test" +import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" +import { fp } from "../src/footprinter" + +// can't use VSON-8_1.5x2mm_P0.5mm title from kicad-viewer. +// instead have to add extra flags +test("VSON8_grid1.5x2mm_P0.5mm_w1.075mm_pinw0.575mm_pinh0.35mm", () => { + const circuitJson = fp + .string("VSON8_grid1.5x2mm_P0.5mm_w1.075mm_pinw0.575mm_pinh0.35mm") + .circuitJson() + const svgContent = convertCircuitJsonToPcbSvg(circuitJson) + expect(svgContent).toMatchSvgSnapshot( + import.meta.path, + "VSON-8_1.5x2mm_P0.5mm", + ) +}) From 31fbc42f12d5f56bd620035a9badbf76911d916e Mon Sep 17 00:00:00 2001 From: Jon Cherry <53948466+joncherry@users.noreply.github.com> Date: Mon, 24 Nov 2025 13:48:18 -0800 Subject: [PATCH 04/10] chore: add tests for offset ep --- src/fn/vson.ts | 5 +++-- src/footprinter.ts | 4 +++- .../VSON-8_3.3x3.3mm_P0.65mm_NexFET.snap.svg | 1 + .../VSONP-8-1EP_5x6_P1.27mm.snap.svg | 1 + tests/vson5.test.ts | 18 ++++++++++++++++++ tests/vson6.test.ts | 18 ++++++++++++++++++ 6 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 tests/__snapshots__/VSON-8_3.3x3.3mm_P0.65mm_NexFET.snap.svg create mode 100644 tests/__snapshots__/VSONP-8-1EP_5x6_P1.27mm.snap.svg create mode 100644 tests/vson5.test.ts create mode 100644 tests/vson6.test.ts diff --git a/src/fn/vson.ts b/src/fn/vson.ts index 27041be7..f87f6769 100644 --- a/src/fn/vson.ts +++ b/src/fn/vson.ts @@ -18,6 +18,7 @@ export const vson_def = base_def.extend({ w: length, grid: dim2d, ep: dim2d.default("0x0mm"), + epx: length.default("0mm"), pinw: length, pinh: length, }) @@ -29,7 +30,7 @@ export const vson = ( raw_params: VsonDefInput, ): { circuitJson: AnyCircuitElement[]; parameters: any } => { const parameters = vson_def.parse(raw_params) - const { num_pins, p, w, grid, ep, pinw, pinh } = parameters + const { num_pins, p, w, grid, ep, epx, pinw, pinh } = parameters if (num_pins % 2 !== 0) { throw new Error("invalid number of pins") @@ -50,7 +51,7 @@ export const vson = ( // place the central exposed pad (ep) if (ep.x > 0 && ep.y > 0) { - pads.push(rectpad(parameters.num_pins + 1, 0, 0, ep.x, ep.y)) + pads.push(rectpad(parameters.num_pins + 1, epx, 0, ep.x, ep.y)) } // draw silkscreen lines around grid dimensions diff --git a/src/footprinter.ts b/src/footprinter.ts index 41fa3874..6e1e4060 100644 --- a/src/footprinter.ts +++ b/src/footprinter.ts @@ -159,7 +159,9 @@ export type Footprinter = { > vson: ( num_pins?: number, - ) => FootprinterParamsBuilder<"p" | "w" | "grid" | "ep" | "pinw" | "pinh"> + ) => FootprinterParamsBuilder< + "p" | "w" | "grid" | "ep" | "epx" | "pinw" | "pinh" + > vssop: ( num_pins?: number, ) => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw"> diff --git a/tests/__snapshots__/VSON-8_3.3x3.3mm_P0.65mm_NexFET.snap.svg b/tests/__snapshots__/VSON-8_3.3x3.3mm_P0.65mm_NexFET.snap.svg new file mode 100644 index 00000000..eae241a9 --- /dev/null +++ b/tests/__snapshots__/VSON-8_3.3x3.3mm_P0.65mm_NexFET.snap.svg @@ -0,0 +1 @@ +{REF} \ No newline at end of file diff --git a/tests/__snapshots__/VSONP-8-1EP_5x6_P1.27mm.snap.svg b/tests/__snapshots__/VSONP-8-1EP_5x6_P1.27mm.snap.svg new file mode 100644 index 00000000..e73683e9 --- /dev/null +++ b/tests/__snapshots__/VSONP-8-1EP_5x6_P1.27mm.snap.svg @@ -0,0 +1 @@ +{REF} \ No newline at end of file diff --git a/tests/vson5.test.ts b/tests/vson5.test.ts new file mode 100644 index 00000000..ca3f9d2b --- /dev/null +++ b/tests/vson5.test.ts @@ -0,0 +1,18 @@ +import { test, expect } from "bun:test" +import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" +import { fp } from "../src/footprinter" + +// can't use VSONP-8-1EP_5x6_P1.27mm title from kicad-viewer. +// instead have to add extra flags +test("VSON8-1EP_grid5x6_P1.27mm_ep4.35x4.51mm_epx0.33mm_w5.6mm_pinw0.7mm_pinh0.7mm", () => { + const circuitJson = fp + .string( + "VSON8-1EP_grid5x6_P1.27mm_ep4.35x4.51mm_epx0.33mm_w5.6mm_pinw0.7mm_pinh0.7mm", + ) + .circuitJson() + const svgContent = convertCircuitJsonToPcbSvg(circuitJson) + expect(svgContent).toMatchSvgSnapshot( + import.meta.path, + "VSONP-8-1EP_5x6_P1.27mm", + ) +}) diff --git a/tests/vson6.test.ts b/tests/vson6.test.ts new file mode 100644 index 00000000..9defbf71 --- /dev/null +++ b/tests/vson6.test.ts @@ -0,0 +1,18 @@ +import { test, expect } from "bun:test" +import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" +import { fp } from "../src/footprinter" + +// can't use VSON-8_3.3x3.3mm_P0.65mm_NexFET title from kicad-viewer. +// instead have to add extra flags +test("VSON8_grid3.3x3.3mm_P0.65mm_ep1.9x2.45mm_epx0.385mm_w2.88mm_pinw0.63mm_pinh0.5mm", () => { + const circuitJson = fp + .string( + "VSON8_grid3.3x3.3mm_P0.65mm_ep1.9x2.45mm_epx0.385mm_w2.88mm_pinw0.63mm_pinh0.5mm", + ) + .circuitJson() + const svgContent = convertCircuitJsonToPcbSvg(circuitJson) + expect(svgContent).toMatchSvgSnapshot( + import.meta.path, + "VSON-8_3.3x3.3mm_P0.65mm_NexFET", + ) +}) From 591af14e91f9dcc829af3d0dc1b7414ae661e4a3 Mon Sep 17 00:00:00 2001 From: Jon Cherry <53948466+joncherry@users.noreply.github.com> Date: Mon, 24 Nov 2025 14:19:48 -0800 Subject: [PATCH 05/10] chore: rename test --- tests/{vson.test.ts => vson1.test.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/{vson.test.ts => vson1.test.ts} (100%) diff --git a/tests/vson.test.ts b/tests/vson1.test.ts similarity index 100% rename from tests/vson.test.ts rename to tests/vson1.test.ts From 0bc6a30ccebc893249653057be1a081480d23de6 Mon Sep 17 00:00:00 2001 From: Jon Cherry <53948466+joncherry@users.noreply.github.com> Date: Tue, 25 Nov 2025 13:26:29 -0800 Subject: [PATCH 06/10] chore: add kicad parity tests --- .../Texas_VSON-HR-8_1.5x2mm_P0.5mm.snap.svg | 1 + ...1.5x2mm_P0.5mm_boolean_difference.snap.svg | 1 + ...SON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm.snap.svg | 1 + ....5mm_EP1.2x2mm_boolean_difference.snap.svg | 1 + ...-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm.snap.svg | 1 + ...m_EP1.65x2.4mm_boolean_difference.snap.svg | 1 + .../VSON-8_1.5x2mm_P0.5mm.snap.svg | 1 + ...1.5x2mm_P0.5mm_boolean_difference.snap.svg | 1 + .../VSON-8_3.3x3.3mm_P0.65mm_NexFET.snap.svg | 1 + ...P0.65mm_NexFET_boolean_difference.snap.svg | 1 + .../VSONP-8-1EP_5x6_P1.27mm.snap.svg | 1 + ...EP_5x6_P1.27mm_boolean_difference.snap.svg | 1 + tests/kicad-parity/vson1_kicad_parity.test.ts | 21 +++++++++++++++++++ tests/kicad-parity/vson2_kicad_parity.test.ts | 21 +++++++++++++++++++ tests/kicad-parity/vson3_kicad_parity.test.ts | 21 +++++++++++++++++++ tests/kicad-parity/vson4_kicad_parity.test.ts | 21 +++++++++++++++++++ tests/kicad-parity/vson5_kicad_parity.test.ts | 21 +++++++++++++++++++ tests/kicad-parity/vson6_kicad_parity.test.ts | 21 +++++++++++++++++++ 18 files changed, 138 insertions(+) create mode 100644 tests/kicad-parity/__snapshots__/Texas_VSON-HR-8_1.5x2mm_P0.5mm.snap.svg create mode 100644 tests/kicad-parity/__snapshots__/Texas_VSON-HR-8_1.5x2mm_P0.5mm_boolean_difference.snap.svg create mode 100644 tests/kicad-parity/__snapshots__/VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm.snap.svg create mode 100644 tests/kicad-parity/__snapshots__/VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm_boolean_difference.snap.svg create mode 100644 tests/kicad-parity/__snapshots__/VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm.snap.svg create mode 100644 tests/kicad-parity/__snapshots__/VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm_boolean_difference.snap.svg create mode 100644 tests/kicad-parity/__snapshots__/VSON-8_1.5x2mm_P0.5mm.snap.svg create mode 100644 tests/kicad-parity/__snapshots__/VSON-8_1.5x2mm_P0.5mm_boolean_difference.snap.svg create mode 100644 tests/kicad-parity/__snapshots__/VSON-8_3.3x3.3mm_P0.65mm_NexFET.snap.svg create mode 100644 tests/kicad-parity/__snapshots__/VSON-8_3.3x3.3mm_P0.65mm_NexFET_boolean_difference.snap.svg create mode 100644 tests/kicad-parity/__snapshots__/VSONP-8-1EP_5x6_P1.27mm.snap.svg create mode 100644 tests/kicad-parity/__snapshots__/VSONP-8-1EP_5x6_P1.27mm_boolean_difference.snap.svg create mode 100644 tests/kicad-parity/vson1_kicad_parity.test.ts create mode 100644 tests/kicad-parity/vson2_kicad_parity.test.ts create mode 100644 tests/kicad-parity/vson3_kicad_parity.test.ts create mode 100644 tests/kicad-parity/vson4_kicad_parity.test.ts create mode 100644 tests/kicad-parity/vson5_kicad_parity.test.ts create mode 100644 tests/kicad-parity/vson6_kicad_parity.test.ts diff --git a/tests/kicad-parity/__snapshots__/Texas_VSON-HR-8_1.5x2mm_P0.5mm.snap.svg b/tests/kicad-parity/__snapshots__/Texas_VSON-HR-8_1.5x2mm_P0.5mm.snap.svg new file mode 100644 index 00000000..2fd653d9 --- /dev/null +++ b/tests/kicad-parity/__snapshots__/Texas_VSON-HR-8_1.5x2mm_P0.5mm.snap.svg @@ -0,0 +1 @@ +{REF}Diff: 0.00% \ No newline at end of file diff --git a/tests/kicad-parity/__snapshots__/Texas_VSON-HR-8_1.5x2mm_P0.5mm_boolean_difference.snap.svg b/tests/kicad-parity/__snapshots__/Texas_VSON-HR-8_1.5x2mm_P0.5mm_boolean_difference.snap.svg new file mode 100644 index 00000000..56cfe474 --- /dev/null +++ b/tests/kicad-parity/__snapshots__/Texas_VSON-HR-8_1.5x2mm_P0.5mm_boolean_difference.snap.svg @@ -0,0 +1 @@ +Texas_VSON-HR-8_1.5x2mm_P0.5mm - Alignment Analysis (Footprinter vs KiCad)VSON8_grid1.5x2mm_P0.5mm_w1.45mm_pinw0.8mm_pinh0.25mmKiCad: Texas_VSON-HR-8_1.5x2mm_P0.5mmPerfect alignment = complete overlap \ No newline at end of file diff --git a/tests/kicad-parity/__snapshots__/VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm.snap.svg b/tests/kicad-parity/__snapshots__/VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm.snap.svg new file mode 100644 index 00000000..6e117e84 --- /dev/null +++ b/tests/kicad-parity/__snapshots__/VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm.snap.svg @@ -0,0 +1 @@ +{REF}Diff: 0.00% \ No newline at end of file diff --git a/tests/kicad-parity/__snapshots__/VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm_boolean_difference.snap.svg b/tests/kicad-parity/__snapshots__/VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm_boolean_difference.snap.svg new file mode 100644 index 00000000..f91c57f3 --- /dev/null +++ b/tests/kicad-parity/__snapshots__/VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm_boolean_difference.snap.svg @@ -0,0 +1 @@ +VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm - Alignment Analysis (Footprinter vs KiCad)VSON10-1EP_grid3x3mm_P0.5mm_EP1.2x2mm_w2.875mm_pinw0.875mm_pinh0.25mmKiCad: VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mmPerfect alignment = complete overlap \ No newline at end of file diff --git a/tests/kicad-parity/__snapshots__/VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm.snap.svg b/tests/kicad-parity/__snapshots__/VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm.snap.svg new file mode 100644 index 00000000..eb82fa5c --- /dev/null +++ b/tests/kicad-parity/__snapshots__/VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm.snap.svg @@ -0,0 +1 @@ +{REF}Diff: 0.00% \ No newline at end of file diff --git a/tests/kicad-parity/__snapshots__/VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm_boolean_difference.snap.svg b/tests/kicad-parity/__snapshots__/VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm_boolean_difference.snap.svg new file mode 100644 index 00000000..b873927b --- /dev/null +++ b/tests/kicad-parity/__snapshots__/VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm_boolean_difference.snap.svg @@ -0,0 +1 @@ +VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm - Alignment Analysis (Footprinter vs KiCad)VSON8-1EP_grid3x3mm_P0.65mm_EP1.65x2.4mm_w2.9mm_pinw0.85mm_pinh0.35mmKiCad: VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mmPerfect alignment = complete overlap \ No newline at end of file diff --git a/tests/kicad-parity/__snapshots__/VSON-8_1.5x2mm_P0.5mm.snap.svg b/tests/kicad-parity/__snapshots__/VSON-8_1.5x2mm_P0.5mm.snap.svg new file mode 100644 index 00000000..9ba88e70 --- /dev/null +++ b/tests/kicad-parity/__snapshots__/VSON-8_1.5x2mm_P0.5mm.snap.svg @@ -0,0 +1 @@ +{REF}Diff: 0.00% \ No newline at end of file diff --git a/tests/kicad-parity/__snapshots__/VSON-8_1.5x2mm_P0.5mm_boolean_difference.snap.svg b/tests/kicad-parity/__snapshots__/VSON-8_1.5x2mm_P0.5mm_boolean_difference.snap.svg new file mode 100644 index 00000000..0a71de6d --- /dev/null +++ b/tests/kicad-parity/__snapshots__/VSON-8_1.5x2mm_P0.5mm_boolean_difference.snap.svg @@ -0,0 +1 @@ +VSON-8_1.5x2mm_P0.5mm - Alignment Analysis (Footprinter vs KiCad)VSON8_grid1.5x2mm_P0.5mm_w1.075mm_pinw0.575mm_pinh0.35mmKiCad: VSON-8_1.5x2mm_P0.5mmPerfect alignment = complete overlap \ No newline at end of file diff --git a/tests/kicad-parity/__snapshots__/VSON-8_3.3x3.3mm_P0.65mm_NexFET.snap.svg b/tests/kicad-parity/__snapshots__/VSON-8_3.3x3.3mm_P0.65mm_NexFET.snap.svg new file mode 100644 index 00000000..9e62be06 --- /dev/null +++ b/tests/kicad-parity/__snapshots__/VSON-8_3.3x3.3mm_P0.65mm_NexFET.snap.svg @@ -0,0 +1 @@ +{REF}Diff: 9.63% \ No newline at end of file diff --git a/tests/kicad-parity/__snapshots__/VSON-8_3.3x3.3mm_P0.65mm_NexFET_boolean_difference.snap.svg b/tests/kicad-parity/__snapshots__/VSON-8_3.3x3.3mm_P0.65mm_NexFET_boolean_difference.snap.svg new file mode 100644 index 00000000..b1686312 --- /dev/null +++ b/tests/kicad-parity/__snapshots__/VSON-8_3.3x3.3mm_P0.65mm_NexFET_boolean_difference.snap.svg @@ -0,0 +1 @@ +VSON-8_3.3x3.3mm_P0.65mm_NexFET - Alignment Analysis (Footprinter vs KiCad)VSON8_grid3.3x3.3mm_P0.65mm_ep1.9x2.45mm_epx0.385mm_w2.88mm_pinw0.63mm_pinh0.5mmKiCad: VSON-8_3.3x3.3mm_P0.65mm_NexFETPerfect alignment = complete overlap \ No newline at end of file diff --git a/tests/kicad-parity/__snapshots__/VSONP-8-1EP_5x6_P1.27mm.snap.svg b/tests/kicad-parity/__snapshots__/VSONP-8-1EP_5x6_P1.27mm.snap.svg new file mode 100644 index 00000000..88008807 --- /dev/null +++ b/tests/kicad-parity/__snapshots__/VSONP-8-1EP_5x6_P1.27mm.snap.svg @@ -0,0 +1 @@ +{REF}Diff: 0.00% \ No newline at end of file diff --git a/tests/kicad-parity/__snapshots__/VSONP-8-1EP_5x6_P1.27mm_boolean_difference.snap.svg b/tests/kicad-parity/__snapshots__/VSONP-8-1EP_5x6_P1.27mm_boolean_difference.snap.svg new file mode 100644 index 00000000..477785d4 --- /dev/null +++ b/tests/kicad-parity/__snapshots__/VSONP-8-1EP_5x6_P1.27mm_boolean_difference.snap.svg @@ -0,0 +1 @@ +VSONP-8-1EP_5x6_P1.27mm - Alignment Analysis (Footprinter vs KiCad)VSON8-1EP_grid5x6_P1.27mm_ep4.35x4.51mm_epx0.33mm_w5.6mm_pinw0.7mm_pinh0.7mmKiCad: VSONP-8-1EP_5x6_P1.27mmPerfect alignment = complete overlap \ No newline at end of file diff --git a/tests/kicad-parity/vson1_kicad_parity.test.ts b/tests/kicad-parity/vson1_kicad_parity.test.ts new file mode 100644 index 00000000..e03527a3 --- /dev/null +++ b/tests/kicad-parity/vson1_kicad_parity.test.ts @@ -0,0 +1,21 @@ +import { expect, test } from "bun:test" +import { compareFootprinterVsKicad } from "../fixtures/compareFootprinterVsKicad" +import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" + +test("parity/VSON8-1EP_grid3x3mm_P0.65mm_EP1.65x2.4mm_w2.9mm_pinw0.85mm_pinh0.35mm", async () => { + const { avgRelDiff, combinedFootprintElements, booleanDifferenceSvg } = + await compareFootprinterVsKicad( + "VSON8-1EP_grid3x3mm_P0.65mm_EP1.65x2.4mm_w2.9mm_pinw0.85mm_pinh0.35mm", + "Package_SON.pretty/VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm.circuit.json", + ) + + const svgContent = convertCircuitJsonToPcbSvg(combinedFootprintElements) + expect(svgContent).toMatchSvgSnapshot( + import.meta.path, + "VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm", + ) + expect(booleanDifferenceSvg).toMatchSvgSnapshot( + import.meta.path, + "VSON-8-1EP_3x3mm_P0.65mm_EP1.65x2.4mm_boolean_difference", + ) +}) diff --git a/tests/kicad-parity/vson2_kicad_parity.test.ts b/tests/kicad-parity/vson2_kicad_parity.test.ts new file mode 100644 index 00000000..57dd4325 --- /dev/null +++ b/tests/kicad-parity/vson2_kicad_parity.test.ts @@ -0,0 +1,21 @@ +import { expect, test } from "bun:test" +import { compareFootprinterVsKicad } from "../fixtures/compareFootprinterVsKicad" +import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" + +test("parity/VSON10-1EP_grid3x3mm_P0.5mm_EP1.2x2mm_w2.875mm_pinw0.875mm_pinh0.25mm", async () => { + const { avgRelDiff, combinedFootprintElements, booleanDifferenceSvg } = + await compareFootprinterVsKicad( + "VSON10-1EP_grid3x3mm_P0.5mm_EP1.2x2mm_w2.875mm_pinw0.875mm_pinh0.25mm", + "Package_SON.pretty/VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm.circuit.json", + ) + + const svgContent = convertCircuitJsonToPcbSvg(combinedFootprintElements) + expect(svgContent).toMatchSvgSnapshot( + import.meta.path, + "VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm", + ) + expect(booleanDifferenceSvg).toMatchSvgSnapshot( + import.meta.path, + "VSON-10-1EP_3x3mm_P0.5mm_EP1.2x2mm_boolean_difference", + ) +}) diff --git a/tests/kicad-parity/vson3_kicad_parity.test.ts b/tests/kicad-parity/vson3_kicad_parity.test.ts new file mode 100644 index 00000000..3e370475 --- /dev/null +++ b/tests/kicad-parity/vson3_kicad_parity.test.ts @@ -0,0 +1,21 @@ +import { expect, test } from "bun:test" +import { compareFootprinterVsKicad } from "../fixtures/compareFootprinterVsKicad" +import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" + +test("parity/VSON8_grid1.5x2mm_P0.5mm_w1.45mm_pinw0.8mm_pinh0.25mm", async () => { + const { avgRelDiff, combinedFootprintElements, booleanDifferenceSvg } = + await compareFootprinterVsKicad( + "VSON8_grid1.5x2mm_P0.5mm_w1.45mm_pinw0.8mm_pinh0.25mm", + "Package_SON.pretty/Texas_VSON-HR-8_1.5x2mm_P0.5mm.circuit.json", + ) + + const svgContent = convertCircuitJsonToPcbSvg(combinedFootprintElements) + expect(svgContent).toMatchSvgSnapshot( + import.meta.path, + "Texas_VSON-HR-8_1.5x2mm_P0.5mm", + ) + expect(booleanDifferenceSvg).toMatchSvgSnapshot( + import.meta.path, + "Texas_VSON-HR-8_1.5x2mm_P0.5mm_boolean_difference", + ) +}) diff --git a/tests/kicad-parity/vson4_kicad_parity.test.ts b/tests/kicad-parity/vson4_kicad_parity.test.ts new file mode 100644 index 00000000..44eeaafd --- /dev/null +++ b/tests/kicad-parity/vson4_kicad_parity.test.ts @@ -0,0 +1,21 @@ +import { expect, test } from "bun:test" +import { compareFootprinterVsKicad } from "../fixtures/compareFootprinterVsKicad" +import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" + +test("parity/VSON8_grid1.5x2mm_P0.5mm_w1.075mm_pinw0.575mm_pinh0.35mm", async () => { + const { avgRelDiff, combinedFootprintElements, booleanDifferenceSvg } = + await compareFootprinterVsKicad( + "VSON8_grid1.5x2mm_P0.5mm_w1.075mm_pinw0.575mm_pinh0.35mm", + "Package_SON.pretty/VSON-8_1.5x2mm_P0.5mm.circuit.json", + ) + + const svgContent = convertCircuitJsonToPcbSvg(combinedFootprintElements) + expect(svgContent).toMatchSvgSnapshot( + import.meta.path, + "VSON-8_1.5x2mm_P0.5mm", + ) + expect(booleanDifferenceSvg).toMatchSvgSnapshot( + import.meta.path, + "VSON-8_1.5x2mm_P0.5mm_boolean_difference", + ) +}) diff --git a/tests/kicad-parity/vson5_kicad_parity.test.ts b/tests/kicad-parity/vson5_kicad_parity.test.ts new file mode 100644 index 00000000..aa0a0382 --- /dev/null +++ b/tests/kicad-parity/vson5_kicad_parity.test.ts @@ -0,0 +1,21 @@ +import { expect, test } from "bun:test" +import { compareFootprinterVsKicad } from "../fixtures/compareFootprinterVsKicad" +import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" + +test("parity/VSON8-1EP_grid5x6_P1.27mm_ep4.35x4.51mm_epx0.33mm_w5.6mm_pinw0.7mm_pinh0.7mm", async () => { + const { avgRelDiff, combinedFootprintElements, booleanDifferenceSvg } = + await compareFootprinterVsKicad( + "VSON8-1EP_grid5x6_P1.27mm_ep4.35x4.51mm_epx0.33mm_w5.6mm_pinw0.7mm_pinh0.7mm", + "Package_SON.pretty/VSONP-8-1EP_5x6_P1.27mm.circuit.json", + ) + + const svgContent = convertCircuitJsonToPcbSvg(combinedFootprintElements) + expect(svgContent).toMatchSvgSnapshot( + import.meta.path, + "VSONP-8-1EP_5x6_P1.27mm", + ) + expect(booleanDifferenceSvg).toMatchSvgSnapshot( + import.meta.path, + "VSONP-8-1EP_5x6_P1.27mm_boolean_difference", + ) +}) diff --git a/tests/kicad-parity/vson6_kicad_parity.test.ts b/tests/kicad-parity/vson6_kicad_parity.test.ts new file mode 100644 index 00000000..3678f709 --- /dev/null +++ b/tests/kicad-parity/vson6_kicad_parity.test.ts @@ -0,0 +1,21 @@ +import { expect, test } from "bun:test" +import { compareFootprinterVsKicad } from "../fixtures/compareFootprinterVsKicad" +import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" + +test("parity/VSON8_grid3.3x3.3mm_P0.65mm_ep1.9x2.45mm_epx0.385mm_w2.88mm_pinw0.63mm_pinh0.5mm", async () => { + const { avgRelDiff, combinedFootprintElements, booleanDifferenceSvg } = + await compareFootprinterVsKicad( + "VSON8_grid3.3x3.3mm_P0.65mm_ep1.9x2.45mm_epx0.385mm_w2.88mm_pinw0.63mm_pinh0.5mm", + "Package_SON.pretty/VSON-8_3.3x3.3mm_P0.65mm_NexFET.circuit.json", + ) + + const svgContent = convertCircuitJsonToPcbSvg(combinedFootprintElements) + expect(svgContent).toMatchSvgSnapshot( + import.meta.path, + "VSON-8_3.3x3.3mm_P0.65mm_NexFET", + ) + expect(booleanDifferenceSvg).toMatchSvgSnapshot( + import.meta.path, + "VSON-8_3.3x3.3mm_P0.65mm_NexFET_boolean_difference", + ) +}) From 8e3a79d2b193d85d78c775af3c65752ed315461a Mon Sep 17 00:00:00 2001 From: Jon Cherry <53948466+joncherry@users.noreply.github.com> Date: Wed, 3 Dec 2025 19:17:20 -0800 Subject: [PATCH 07/10] chore: remove texas vson test --- tests/kicad-parity/vson3_kicad_parity.test.ts | 10 ++++----- tests/kicad-parity/vson4_kicad_parity.test.ts | 10 ++++----- tests/kicad-parity/vson5_kicad_parity.test.ts | 10 ++++----- tests/kicad-parity/vson6_kicad_parity.test.ts | 21 ------------------- tests/vson3.test.ts | 8 +++---- tests/vson4.test.ts | 10 +++++---- tests/vson5.test.ts | 8 +++---- tests/vson6.test.ts | 18 ---------------- 8 files changed, 29 insertions(+), 66 deletions(-) delete mode 100644 tests/kicad-parity/vson6_kicad_parity.test.ts delete mode 100644 tests/vson6.test.ts diff --git a/tests/kicad-parity/vson3_kicad_parity.test.ts b/tests/kicad-parity/vson3_kicad_parity.test.ts index 3e370475..44eeaafd 100644 --- a/tests/kicad-parity/vson3_kicad_parity.test.ts +++ b/tests/kicad-parity/vson3_kicad_parity.test.ts @@ -2,20 +2,20 @@ import { expect, test } from "bun:test" import { compareFootprinterVsKicad } from "../fixtures/compareFootprinterVsKicad" import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" -test("parity/VSON8_grid1.5x2mm_P0.5mm_w1.45mm_pinw0.8mm_pinh0.25mm", async () => { +test("parity/VSON8_grid1.5x2mm_P0.5mm_w1.075mm_pinw0.575mm_pinh0.35mm", async () => { const { avgRelDiff, combinedFootprintElements, booleanDifferenceSvg } = await compareFootprinterVsKicad( - "VSON8_grid1.5x2mm_P0.5mm_w1.45mm_pinw0.8mm_pinh0.25mm", - "Package_SON.pretty/Texas_VSON-HR-8_1.5x2mm_P0.5mm.circuit.json", + "VSON8_grid1.5x2mm_P0.5mm_w1.075mm_pinw0.575mm_pinh0.35mm", + "Package_SON.pretty/VSON-8_1.5x2mm_P0.5mm.circuit.json", ) const svgContent = convertCircuitJsonToPcbSvg(combinedFootprintElements) expect(svgContent).toMatchSvgSnapshot( import.meta.path, - "Texas_VSON-HR-8_1.5x2mm_P0.5mm", + "VSON-8_1.5x2mm_P0.5mm", ) expect(booleanDifferenceSvg).toMatchSvgSnapshot( import.meta.path, - "Texas_VSON-HR-8_1.5x2mm_P0.5mm_boolean_difference", + "VSON-8_1.5x2mm_P0.5mm_boolean_difference", ) }) diff --git a/tests/kicad-parity/vson4_kicad_parity.test.ts b/tests/kicad-parity/vson4_kicad_parity.test.ts index 44eeaafd..aa0a0382 100644 --- a/tests/kicad-parity/vson4_kicad_parity.test.ts +++ b/tests/kicad-parity/vson4_kicad_parity.test.ts @@ -2,20 +2,20 @@ import { expect, test } from "bun:test" import { compareFootprinterVsKicad } from "../fixtures/compareFootprinterVsKicad" import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" -test("parity/VSON8_grid1.5x2mm_P0.5mm_w1.075mm_pinw0.575mm_pinh0.35mm", async () => { +test("parity/VSON8-1EP_grid5x6_P1.27mm_ep4.35x4.51mm_epx0.33mm_w5.6mm_pinw0.7mm_pinh0.7mm", async () => { const { avgRelDiff, combinedFootprintElements, booleanDifferenceSvg } = await compareFootprinterVsKicad( - "VSON8_grid1.5x2mm_P0.5mm_w1.075mm_pinw0.575mm_pinh0.35mm", - "Package_SON.pretty/VSON-8_1.5x2mm_P0.5mm.circuit.json", + "VSON8-1EP_grid5x6_P1.27mm_ep4.35x4.51mm_epx0.33mm_w5.6mm_pinw0.7mm_pinh0.7mm", + "Package_SON.pretty/VSONP-8-1EP_5x6_P1.27mm.circuit.json", ) const svgContent = convertCircuitJsonToPcbSvg(combinedFootprintElements) expect(svgContent).toMatchSvgSnapshot( import.meta.path, - "VSON-8_1.5x2mm_P0.5mm", + "VSONP-8-1EP_5x6_P1.27mm", ) expect(booleanDifferenceSvg).toMatchSvgSnapshot( import.meta.path, - "VSON-8_1.5x2mm_P0.5mm_boolean_difference", + "VSONP-8-1EP_5x6_P1.27mm_boolean_difference", ) }) diff --git a/tests/kicad-parity/vson5_kicad_parity.test.ts b/tests/kicad-parity/vson5_kicad_parity.test.ts index aa0a0382..3678f709 100644 --- a/tests/kicad-parity/vson5_kicad_parity.test.ts +++ b/tests/kicad-parity/vson5_kicad_parity.test.ts @@ -2,20 +2,20 @@ import { expect, test } from "bun:test" import { compareFootprinterVsKicad } from "../fixtures/compareFootprinterVsKicad" import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" -test("parity/VSON8-1EP_grid5x6_P1.27mm_ep4.35x4.51mm_epx0.33mm_w5.6mm_pinw0.7mm_pinh0.7mm", async () => { +test("parity/VSON8_grid3.3x3.3mm_P0.65mm_ep1.9x2.45mm_epx0.385mm_w2.88mm_pinw0.63mm_pinh0.5mm", async () => { const { avgRelDiff, combinedFootprintElements, booleanDifferenceSvg } = await compareFootprinterVsKicad( - "VSON8-1EP_grid5x6_P1.27mm_ep4.35x4.51mm_epx0.33mm_w5.6mm_pinw0.7mm_pinh0.7mm", - "Package_SON.pretty/VSONP-8-1EP_5x6_P1.27mm.circuit.json", + "VSON8_grid3.3x3.3mm_P0.65mm_ep1.9x2.45mm_epx0.385mm_w2.88mm_pinw0.63mm_pinh0.5mm", + "Package_SON.pretty/VSON-8_3.3x3.3mm_P0.65mm_NexFET.circuit.json", ) const svgContent = convertCircuitJsonToPcbSvg(combinedFootprintElements) expect(svgContent).toMatchSvgSnapshot( import.meta.path, - "VSONP-8-1EP_5x6_P1.27mm", + "VSON-8_3.3x3.3mm_P0.65mm_NexFET", ) expect(booleanDifferenceSvg).toMatchSvgSnapshot( import.meta.path, - "VSONP-8-1EP_5x6_P1.27mm_boolean_difference", + "VSON-8_3.3x3.3mm_P0.65mm_NexFET_boolean_difference", ) }) diff --git a/tests/kicad-parity/vson6_kicad_parity.test.ts b/tests/kicad-parity/vson6_kicad_parity.test.ts deleted file mode 100644 index 3678f709..00000000 --- a/tests/kicad-parity/vson6_kicad_parity.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { expect, test } from "bun:test" -import { compareFootprinterVsKicad } from "../fixtures/compareFootprinterVsKicad" -import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" - -test("parity/VSON8_grid3.3x3.3mm_P0.65mm_ep1.9x2.45mm_epx0.385mm_w2.88mm_pinw0.63mm_pinh0.5mm", async () => { - const { avgRelDiff, combinedFootprintElements, booleanDifferenceSvg } = - await compareFootprinterVsKicad( - "VSON8_grid3.3x3.3mm_P0.65mm_ep1.9x2.45mm_epx0.385mm_w2.88mm_pinw0.63mm_pinh0.5mm", - "Package_SON.pretty/VSON-8_3.3x3.3mm_P0.65mm_NexFET.circuit.json", - ) - - const svgContent = convertCircuitJsonToPcbSvg(combinedFootprintElements) - expect(svgContent).toMatchSvgSnapshot( - import.meta.path, - "VSON-8_3.3x3.3mm_P0.65mm_NexFET", - ) - expect(booleanDifferenceSvg).toMatchSvgSnapshot( - import.meta.path, - "VSON-8_3.3x3.3mm_P0.65mm_NexFET_boolean_difference", - ) -}) diff --git a/tests/vson3.test.ts b/tests/vson3.test.ts index dc1e3d3e..b03840af 100644 --- a/tests/vson3.test.ts +++ b/tests/vson3.test.ts @@ -2,15 +2,15 @@ import { test, expect } from "bun:test" import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" import { fp } from "../src/footprinter" -// can't use Texas_VSON-HR-8_1.5x2mm_P0.5mm title from kicad-viewer. +// can't use VSON-8_1.5x2mm_P0.5mm title from kicad-viewer. // instead have to add extra flags -test("VSON8_grid1.5x2mm_P0.5mm_w1.45mm_pinw0.8mm_pinh0.25mm", () => { +test("VSON8_grid1.5x2mm_P0.5mm_w1.075mm_pinw0.575mm_pinh0.35mm", () => { const circuitJson = fp - .string("VSON8_grid1.5x2mm_P0.5mm_w1.45mm_pinw0.8mm_pinh0.25mm") + .string("VSON8_grid1.5x2mm_P0.5mm_w1.075mm_pinw0.575mm_pinh0.35mm") .circuitJson() const svgContent = convertCircuitJsonToPcbSvg(circuitJson) expect(svgContent).toMatchSvgSnapshot( import.meta.path, - "Texas_VSON-HR-8_1.5x2mm_P0.5mm", + "VSON-8_1.5x2mm_P0.5mm", ) }) diff --git a/tests/vson4.test.ts b/tests/vson4.test.ts index b03840af..ca3f9d2b 100644 --- a/tests/vson4.test.ts +++ b/tests/vson4.test.ts @@ -2,15 +2,17 @@ import { test, expect } from "bun:test" import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" import { fp } from "../src/footprinter" -// can't use VSON-8_1.5x2mm_P0.5mm title from kicad-viewer. +// can't use VSONP-8-1EP_5x6_P1.27mm title from kicad-viewer. // instead have to add extra flags -test("VSON8_grid1.5x2mm_P0.5mm_w1.075mm_pinw0.575mm_pinh0.35mm", () => { +test("VSON8-1EP_grid5x6_P1.27mm_ep4.35x4.51mm_epx0.33mm_w5.6mm_pinw0.7mm_pinh0.7mm", () => { const circuitJson = fp - .string("VSON8_grid1.5x2mm_P0.5mm_w1.075mm_pinw0.575mm_pinh0.35mm") + .string( + "VSON8-1EP_grid5x6_P1.27mm_ep4.35x4.51mm_epx0.33mm_w5.6mm_pinw0.7mm_pinh0.7mm", + ) .circuitJson() const svgContent = convertCircuitJsonToPcbSvg(circuitJson) expect(svgContent).toMatchSvgSnapshot( import.meta.path, - "VSON-8_1.5x2mm_P0.5mm", + "VSONP-8-1EP_5x6_P1.27mm", ) }) diff --git a/tests/vson5.test.ts b/tests/vson5.test.ts index ca3f9d2b..9defbf71 100644 --- a/tests/vson5.test.ts +++ b/tests/vson5.test.ts @@ -2,17 +2,17 @@ import { test, expect } from "bun:test" import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" import { fp } from "../src/footprinter" -// can't use VSONP-8-1EP_5x6_P1.27mm title from kicad-viewer. +// can't use VSON-8_3.3x3.3mm_P0.65mm_NexFET title from kicad-viewer. // instead have to add extra flags -test("VSON8-1EP_grid5x6_P1.27mm_ep4.35x4.51mm_epx0.33mm_w5.6mm_pinw0.7mm_pinh0.7mm", () => { +test("VSON8_grid3.3x3.3mm_P0.65mm_ep1.9x2.45mm_epx0.385mm_w2.88mm_pinw0.63mm_pinh0.5mm", () => { const circuitJson = fp .string( - "VSON8-1EP_grid5x6_P1.27mm_ep4.35x4.51mm_epx0.33mm_w5.6mm_pinw0.7mm_pinh0.7mm", + "VSON8_grid3.3x3.3mm_P0.65mm_ep1.9x2.45mm_epx0.385mm_w2.88mm_pinw0.63mm_pinh0.5mm", ) .circuitJson() const svgContent = convertCircuitJsonToPcbSvg(circuitJson) expect(svgContent).toMatchSvgSnapshot( import.meta.path, - "VSONP-8-1EP_5x6_P1.27mm", + "VSON-8_3.3x3.3mm_P0.65mm_NexFET", ) }) diff --git a/tests/vson6.test.ts b/tests/vson6.test.ts deleted file mode 100644 index 9defbf71..00000000 --- a/tests/vson6.test.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { test, expect } from "bun:test" -import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" -import { fp } from "../src/footprinter" - -// can't use VSON-8_3.3x3.3mm_P0.65mm_NexFET title from kicad-viewer. -// instead have to add extra flags -test("VSON8_grid3.3x3.3mm_P0.65mm_ep1.9x2.45mm_epx0.385mm_w2.88mm_pinw0.63mm_pinh0.5mm", () => { - const circuitJson = fp - .string( - "VSON8_grid3.3x3.3mm_P0.65mm_ep1.9x2.45mm_epx0.385mm_w2.88mm_pinw0.63mm_pinh0.5mm", - ) - .circuitJson() - const svgContent = convertCircuitJsonToPcbSvg(circuitJson) - expect(svgContent).toMatchSvgSnapshot( - import.meta.path, - "VSON-8_3.3x3.3mm_P0.65mm_NexFET", - ) -}) From b3475dc22a9687f69ac3acd53265f78ec3a9b2af Mon Sep 17 00:00:00 2001 From: Jon Cherry <53948466+joncherry@users.noreply.github.com> Date: Mon, 8 Dec 2025 13:45:59 -0800 Subject: [PATCH 08/10] chore: add code-comments to vson_def params --- src/fn/vson.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/fn/vson.ts b/src/fn/vson.ts index f87f6769..525da80c 100644 --- a/src/fn/vson.ts +++ b/src/fn/vson.ts @@ -14,13 +14,13 @@ import { type SilkscreenRef, silkscreenRef } from "src/helpers/silkscreenRef" export const vson_def = base_def.extend({ fn: z.string(), num_pins: z.number().optional().default(8), - p: distance, - w: length, - grid: dim2d, - ep: dim2d.default("0x0mm"), - epx: length.default("0mm"), - pinw: length, - pinh: length, + p: distance, // pitch length (distance between center of each pin) + w: length, // width between vertical rows of pins + grid: dim2d, // width and height of the border of the footprint (used for silkscreen lines) + ep: dim2d.default("0x0mm"), // width and height of the central exposed thermal pad + epx: length.default("0mm"), // x offset of the center of the central exposed thermal pad + pinw: length, // width of the pin pads + pinh: length, // height of the pin pads }) export type VsonDefInput = z.input From d452368268adaaedce515ab3fd6b29cb11033011 Mon Sep 17 00:00:00 2001 From: Jon Cherry <53948466+joncherry@users.noreply.github.com> Date: Tue, 23 Dec 2025 08:37:23 -0800 Subject: [PATCH 09/10] chore: code comments to describe hints --- src/fn/vson.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/fn/vson.ts b/src/fn/vson.ts index 525da80c..fa30da62 100644 --- a/src/fn/vson.ts +++ b/src/fn/vson.ts @@ -14,13 +14,13 @@ import { type SilkscreenRef, silkscreenRef } from "src/helpers/silkscreenRef" export const vson_def = base_def.extend({ fn: z.string(), num_pins: z.number().optional().default(8), - p: distance, // pitch length (distance between center of each pin) - w: length, // width between vertical rows of pins - grid: dim2d, // width and height of the border of the footprint (used for silkscreen lines) - ep: dim2d.default("0x0mm"), // width and height of the central exposed thermal pad - epx: length.default("0mm"), // x offset of the center of the central exposed thermal pad - pinw: length, // width of the pin pads - pinh: length, // height of the pin pads + p: distance.describe("pitch (distance between center of each pin)"), + w: length.describe("width between vertical rows of pins"), + grid: dim2d.describe("width and height of the border of the footprint"), + ep: dim2d.default("0x0mm").describe("width and height of the central exposed thermal pad"), + epx: length.default("0mm").describe("x offset of the center of the central exposed thermal pad"), + pinw: length.describe("width of the pin pads"), + pinh: length.describe("height of the pin pads"), }) export type VsonDefInput = z.input From ea407f4d2af181ae71939fd672829b81e16d6c38 Mon Sep 17 00:00:00 2001 From: Jon Cherry <53948466+joncherry@users.noreply.github.com> Date: Tue, 23 Dec 2025 08:42:41 -0800 Subject: [PATCH 10/10] chore: format file --- src/fn/vson.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/fn/vson.ts b/src/fn/vson.ts index fa30da62..ca0529f7 100644 --- a/src/fn/vson.ts +++ b/src/fn/vson.ts @@ -17,8 +17,12 @@ export const vson_def = base_def.extend({ p: distance.describe("pitch (distance between center of each pin)"), w: length.describe("width between vertical rows of pins"), grid: dim2d.describe("width and height of the border of the footprint"), - ep: dim2d.default("0x0mm").describe("width and height of the central exposed thermal pad"), - epx: length.default("0mm").describe("x offset of the center of the central exposed thermal pad"), + ep: dim2d + .default("0x0mm") + .describe("width and height of the central exposed thermal pad"), + epx: length + .default("0mm") + .describe("x offset of the center of the central exposed thermal pad"), pinw: length.describe("width of the pin pads"), pinh: length.describe("height of the pin pads"), })