circuit-json-to-tscircuit 0.0.44 → 0.0.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,11 @@ on:
4
4
  push:
5
5
  branches:
6
6
  - main
7
+ permissions:
8
+ contents: write
9
+ id-token: write
10
+ pull-requests: write
11
+
7
12
  jobs:
8
13
  publish:
9
14
  runs-on: ubuntu-latest
@@ -13,13 +18,12 @@ jobs:
13
18
  uses: oven-sh/setup-bun@v1
14
19
  with:
15
20
  bun-version: latest
16
- - uses: actions/setup-node@v3
21
+ - uses: actions/setup-node@v6
17
22
  with:
18
- node-version: 20
23
+ node-version: 24
19
24
  registry-url: https://registry.npmjs.org/
25
+ package-manager-cache: false
20
26
  - run: npm install -g pver
21
27
  - run: bun install --frozen-lockfile
22
28
  - run: bun run build
23
29
  - run: pver release
24
- env:
25
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -565,7 +565,7 @@ var convertSmtPads = (circuitJson) => {
565
565
  } else if (smtPad.shape === "rotated_rect") {
566
566
  const cornerRadius = smtPad.corner_radius ?? smtPad.rect_border_radius ?? void 0;
567
567
  elementStrings.push(
568
- `<smtpad ${commonAttrs.join(" ")}${solderMaskAttrs}${formatOptionalMmAttr("cornerRadius", cornerRadius)}${formatOptionalMmAttr("solderMaskMarginLeft", smtPad.soldermask_margin_left)}${formatOptionalMmAttr("solderMaskMarginTop", smtPad.soldermask_margin_top)}${formatOptionalMmAttr("solderMaskMarginRight", smtPad.soldermask_margin_right)}${formatOptionalMmAttr("solderMaskMarginBottom", smtPad.soldermask_margin_bottom)} width="${mmStr6(smtPad.width ?? 0)}" height="${mmStr6(smtPad.height ?? 0)}"${formatPcbRotationAttr(smtPad.ccw_rotation)} shape="rotated_rect" />`
568
+ `<smtpad ${commonAttrs.join(" ")}${solderMaskAttrs}${formatOptionalMmAttr("cornerRadius", cornerRadius)}${formatOptionalMmAttr("solderMaskMarginLeft", smtPad.soldermask_margin_left)}${formatOptionalMmAttr("solderMaskMarginTop", smtPad.soldermask_margin_top)}${formatOptionalMmAttr("solderMaskMarginRight", smtPad.soldermask_margin_right)}${formatOptionalMmAttr("solderMaskMarginBottom", smtPad.soldermask_margin_bottom)} width="${mmStr6(smtPad.width ?? 0)}" height="${mmStr6(smtPad.height ?? 0)}" ccwRotation={${smtPad.ccw_rotation ?? 0}} shape="rotated_rect" />`
569
569
  );
570
570
  }
571
571
  }
package/dist/cli/main.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  convertCircuitJsonToTscircuit
4
- } from "../chunk-UXTI3RT6.js";
4
+ } from "../chunk-E24YLRWU.js";
5
5
 
6
6
  // cli/main.ts
7
7
  import { Command } from "commander";
@@ -16,7 +16,11 @@ var package_default = {
16
16
  "./cli": "./dist/cli/main.js"
17
17
  },
18
18
  type: "module",
19
- version: "0.0.43",
19
+ version: "0.0.45",
20
+ repository: {
21
+ type: "git",
22
+ url: "https://github.com/tscircuit/circuit-json-to-tscircuit.git"
23
+ },
20
24
  scripts: {
21
25
  build: "tsup-node lib/index.ts cli/main.ts --format esm --dts",
22
26
  "build:site": "bun build ./site/index.html --outdir site-build",
package/dist/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  convertCircuitJsonToTscircuit
3
- } from "../chunk-UXTI3RT6.js";
3
+ } from "../chunk-E24YLRWU.js";
4
4
  export {
5
5
  convertCircuitJsonToTscircuit
6
6
  };
@@ -51,7 +51,7 @@ export const convertSmtPads: FootprintElementConverter = (circuitJson) => {
51
51
  smtPad.corner_radius ?? smtPad.rect_border_radius ?? undefined
52
52
 
53
53
  elementStrings.push(
54
- `<smtpad ${commonAttrs.join(" ")}${solderMaskAttrs}${formatOptionalMmAttr("cornerRadius", cornerRadius)}${formatOptionalMmAttr("solderMaskMarginLeft", smtPad.soldermask_margin_left)}${formatOptionalMmAttr("solderMaskMarginTop", smtPad.soldermask_margin_top)}${formatOptionalMmAttr("solderMaskMarginRight", smtPad.soldermask_margin_right)}${formatOptionalMmAttr("solderMaskMarginBottom", smtPad.soldermask_margin_bottom)} width="${mmStr(smtPad.width ?? 0)}" height="${mmStr(smtPad.height ?? 0)}"${formatPcbRotationAttr(smtPad.ccw_rotation)} shape="rotated_rect" />`,
54
+ `<smtpad ${commonAttrs.join(" ")}${solderMaskAttrs}${formatOptionalMmAttr("cornerRadius", cornerRadius)}${formatOptionalMmAttr("solderMaskMarginLeft", smtPad.soldermask_margin_left)}${formatOptionalMmAttr("solderMaskMarginTop", smtPad.soldermask_margin_top)}${formatOptionalMmAttr("solderMaskMarginRight", smtPad.soldermask_margin_right)}${formatOptionalMmAttr("solderMaskMarginBottom", smtPad.soldermask_margin_bottom)} width="${mmStr(smtPad.width ?? 0)}" height="${mmStr(smtPad.height ?? 0)}" ccwRotation={${smtPad.ccw_rotation ?? 0}} shape="rotated_rect" />`,
55
55
  )
56
56
  }
57
57
  }
package/package.json CHANGED
@@ -6,7 +6,11 @@
6
6
  "./cli": "./dist/cli/main.js"
7
7
  },
8
8
  "type": "module",
9
- "version": "0.0.44",
9
+ "version": "0.0.46",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/tscircuit/circuit-json-to-tscircuit.git"
13
+ },
10
14
  "scripts": {
11
15
  "build": "tsup-node lib/index.ts cli/main.ts --format esm --dts",
12
16
  "build:site": "bun build ./site/index.html --outdir site-build",
@@ -16,7 +16,7 @@ test("test16 support pcb smtpad shapes", async () => {
16
16
  footprint={<footprint>
17
17
  <smtpad portHints={["1"]} pcbX="1mm" pcbY="2mm" layer="top" coveredWithSolderMask={true} solderMaskMargin="0.03mm" width="1.5mm" height="0.8mm" radius="0.4mm" shape="pill" />
18
18
  <smtpad portHints={["2"]} layer="top" coveredWithSolderMask={true} solderMaskMargin="0.06mm" shape="polygon" points={[{"x":0,"y":0},{"x":1,"y":0},{"x":0.5,"y":1}]} />
19
- <smtpad portHints={["3"]} pcbX="-1mm" pcbY="-2mm" layer="bottom" coveredWithSolderMask={true} solderMaskMargin="0.04mm" cornerRadius="0.15mm" solderMaskMarginLeft="0.01mm" solderMaskMarginTop="0.02mm" solderMaskMarginRight="0.03mm" solderMaskMarginBottom="0.05mm" width="2mm" height="0.6mm" pcbRotation="45deg" shape="rotated_rect" />
19
+ <smtpad portHints={["3"]} pcbX="-1mm" pcbY="-2mm" layer="bottom" coveredWithSolderMask={true} solderMaskMargin="0.04mm" cornerRadius="0.15mm" solderMaskMarginLeft="0.01mm" solderMaskMarginTop="0.02mm" solderMaskMarginRight="0.03mm" solderMaskMarginBottom="0.05mm" width="2mm" height="0.6mm" ccwRotation={45} shape="rotated_rect" />
20
20
  <smtpad portHints={["4"]} pcbX="2.5mm" pcbY="-1.5mm" layer="bottom" coveredWithSolderMask={true} solderMaskMargin="0.05mm" rectBorderRadius="0.25mm" cornerRadius="0.2mm" solderMaskMarginLeft="0.11mm" solderMaskMarginTop="0.12mm" solderMaskMarginRight="0.13mm" solderMaskMarginBottom="0.14mm" width="1.8mm" height="0.9mm" shape="rect" />
21
21
  <smtpad portHints={["5"]} pcbX="-2.4mm" pcbY="1.6mm" layer="top" coveredWithSolderMask={true} solderMaskMargin="0.07mm" width="2.2mm" height="0.9mm" radius="0.45mm" pcbRotation="30deg" shape="pill" />
22
22
  </footprint>}
@@ -24,19 +24,12 @@ test("test16 support pcb smtpad shapes", async () => {
24
24
  />
25
25
  )"
26
26
  `)
27
- expect(tscircuit).toContain(`pcbRotation="45deg"`)
27
+ expect(tscircuit).toContain(`ccwRotation={45}`)
28
28
  expect(tscircuit).toContain(`shape="rotated_rect"`)
29
29
  expect(tscircuit).toContain(`pcbRotation="30deg"`)
30
30
 
31
- // The generator emits pcbRotation for consistency, but the current smtpad
32
- // runtime still expects ccwRotation for rotated_rect pads.
33
- const executableTscircuit = tscircuit.replace(
34
- /pcbRotation="(-?\d+(?:\.\d+)?)deg"(?=[^>]*shape="rotated_rect")/g,
35
- (_, rotation: string) => `ccwRotation={${rotation}}`,
36
- )
37
-
38
31
  const renderedCircuitJson = (await runTscircuitCode(`
39
- ${executableTscircuit}
32
+ ${tscircuit}
40
33
 
41
34
  circuit.add(
42
35
  <board width="20mm" height="20mm">
@@ -56,6 +49,7 @@ circuit.add(
56
49
  port_hints: ["3"],
57
50
  layer: "bottom",
58
51
  shape: "rotated_rect",
52
+ ccw_rotation: 45,
59
53
  corner_radius: 0.15,
60
54
  is_covered_with_solder_mask: true,
61
55
  soldermask_margin: 0.04,