circuit-json-to-tscircuit 0.0.46 → 0.0.47

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.
package/dist/cli/main.js CHANGED
@@ -16,7 +16,7 @@ var package_default = {
16
16
  "./cli": "./dist/cli/main.js"
17
17
  },
18
18
  type: "module",
19
- version: "0.0.45",
19
+ version: "0.0.46",
20
20
  repository: {
21
21
  type: "git",
22
22
  url: "https://github.com/tscircuit/circuit-json-to-tscircuit.git"
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "./cli": "./dist/cli/main.js"
7
7
  },
8
8
  "type": "module",
9
- "version": "0.0.46",
9
+ "version": "0.0.47",
10
10
  "repository": {
11
11
  "type": "git",
12
12
  "url": "https://github.com/tscircuit/circuit-json-to-tscircuit.git"
@@ -0,0 +1,57 @@
1
+ import { expect, test } from "bun:test"
2
+ import { convertCircuitJsonToTscircuit } from "lib"
3
+
4
+ test.failing("test21 silkscreen path props tsx", async () => {
5
+ const tscircuit = convertCircuitJsonToTscircuit(circuitJson, {
6
+ componentName: "Test21Component",
7
+ })
8
+
9
+ expect(tscircuit).toContain('layer="bottom"')
10
+ expect(tscircuit).toContain("strokeWidth={0.2}")
11
+ })
12
+
13
+ const circuitJson: any = [
14
+ {
15
+ type: "source_component",
16
+ source_component_id: "generic_0",
17
+ supplier_part_numbers: {},
18
+ },
19
+ {
20
+ type: "schematic_component",
21
+ schematic_component_id: "schematic_generic_component_0",
22
+ source_component_id: "generic_0",
23
+ center: {
24
+ x: 0,
25
+ y: 0,
26
+ },
27
+ rotation: 0,
28
+ size: {
29
+ width: 0,
30
+ height: 0,
31
+ },
32
+ },
33
+ {
34
+ type: "pcb_component",
35
+ source_component_id: "generic_0",
36
+ pcb_component_id: "pcb_generic_component_0",
37
+ layer: "top",
38
+ center: {
39
+ x: 0,
40
+ y: 0,
41
+ },
42
+ rotation: 0,
43
+ width: 2,
44
+ height: 1,
45
+ },
46
+ {
47
+ type: "pcb_silkscreen_path",
48
+ pcb_silkscreen_path_id: "pcb_silkscreen_path_0",
49
+ pcb_component_id: "pcb_generic_component_0",
50
+ layer: "bottom",
51
+ route: [
52
+ { x: -1, y: 1.8 },
53
+ { x: 1, y: 1.8 },
54
+ ],
55
+ stroke_width: 0.2,
56
+ },
57
+ ]
@@ -0,0 +1,78 @@
1
+ import { expect, test } from "bun:test"
2
+ import type { AnyCircuitElement } from "circuit-json"
3
+ import { convertCircuitJsonToTscircuit } from "lib"
4
+ import { runTscircuitCode } from "tscircuit"
5
+
6
+ test.failing(
7
+ "test22 silkscreen path props roundtrip",
8
+ async () => {
9
+ const tscircuit = convertCircuitJsonToTscircuit(circuitJson, {
10
+ componentName: "Test22Component",
11
+ })
12
+
13
+ const renderedCircuitJson = (await runTscircuitCode(`
14
+ ${tscircuit}
15
+
16
+ circuit.add(
17
+ <board width="20mm" height="20mm">
18
+ <Test22Component />
19
+ </board>,
20
+ )
21
+ `)) as AnyCircuitElement[]
22
+
23
+ const silkscreenPath = renderedCircuitJson.find(
24
+ (el) => el.type === "pcb_silkscreen_path",
25
+ ) as any
26
+
27
+ expect(silkscreenPath).toBeDefined()
28
+ expect(silkscreenPath.layer).toBe("bottom")
29
+ expect(silkscreenPath.stroke_width).toBe(0.2)
30
+ },
31
+ 15000,
32
+ )
33
+
34
+ const circuitJson: any = [
35
+ {
36
+ type: "source_component",
37
+ source_component_id: "generic_0",
38
+ supplier_part_numbers: {},
39
+ },
40
+ {
41
+ type: "schematic_component",
42
+ schematic_component_id: "schematic_generic_component_0",
43
+ source_component_id: "generic_0",
44
+ center: {
45
+ x: 0,
46
+ y: 0,
47
+ },
48
+ rotation: 0,
49
+ size: {
50
+ width: 0,
51
+ height: 0,
52
+ },
53
+ },
54
+ {
55
+ type: "pcb_component",
56
+ source_component_id: "generic_0",
57
+ pcb_component_id: "pcb_generic_component_0",
58
+ layer: "top",
59
+ center: {
60
+ x: 0,
61
+ y: 0,
62
+ },
63
+ rotation: 0,
64
+ width: 2,
65
+ height: 1,
66
+ },
67
+ {
68
+ type: "pcb_silkscreen_path",
69
+ pcb_silkscreen_path_id: "pcb_silkscreen_path_0",
70
+ pcb_component_id: "pcb_generic_component_0",
71
+ layer: "bottom",
72
+ route: [
73
+ { x: -1, y: 1.8 },
74
+ { x: 1, y: 1.8 },
75
+ ],
76
+ stroke_width: 0.2,
77
+ },
78
+ ]