From 9f16cb5363416349949aae4c851502aa7d6ca493 Mon Sep 17 00:00:00 2001 From: baeltaezaer Date: Tue, 7 Jul 2026 02:29:32 -0600 Subject: [PATCH] fix: add spdip alias --- src/footprinter.ts | 1 + tests/dip.test.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/footprinter.ts b/src/footprinter.ts index fa51a3b4..592d2f5b 100644 --- a/src/footprinter.ts +++ b/src/footprinter.ts @@ -273,6 +273,7 @@ const normalizeDefinition = (def: string): string => { .replace(/^pinheader(?=[\d_]|$)/i, "pinrow") .replace(/^sot23-(\d+)(?=_|$)/i, "sot23_$1") .replace(/^sot-223-(\d+)(?=_|$)/i, "sot223_$1") + .replace(/^spdip-(\d+)(?=_|$)/i, "dip$1") .replace(/^to-220f-(\d+)(?=_|$)/i, "to220f_$1") .replace(/^jst_(ph|sh|zh)_(\d+)(?=_|$)/i, "jst$2_$1") } diff --git a/tests/dip.test.ts b/tests/dip.test.ts index ccc0d214..0ba5f19f 100644 --- a/tests/dip.test.ts +++ b/tests/dip.test.ts @@ -1,7 +1,7 @@ -import { test, expect } from "bun:test" +import { expect, test } from "bun:test" +import type { AnyCircuitElement } from "circuit-json" import { convertCircuitJsonToPcbSvg } from "circuit-to-svg" import { fp } from "../src/footprinter" -import type { AnyCircuitElement } from "circuit-json" test("dip footprint", () => { const circuitJson = fp().dip(4).w(4).p(2).circuitJson() @@ -31,6 +31,12 @@ test("dip16 with nosquareplating", () => { ) }) +test("SPDIP-28 alias", () => { + const aliasJson = fp.string("SPDIP-28").json() + const canonicalJson = fp.string("dip28").json() + expect(aliasJson).toEqual(canonicalJson) +}) + test("dip4_w3.00mm", () => { const circuitJson = fp .string("dip4_w3.00mm") @@ -81,7 +87,7 @@ test("dip4", () => { test("dip8_p1.27mm", () => { const circuitJson = fp.string("dip8_p1.27mm").circuitJson() - let svgContent = convertCircuitJsonToPcbSvg(circuitJson) + const svgContent = convertCircuitJsonToPcbSvg(circuitJson) expect(svgContent).toMatchSvgSnapshot(import.meta.path, "dip8_p1.27mm") })