@tscircuit/cli 0.0.206 → 0.0.208
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/.github/workflows/formatbot.yml +6 -6
- package/.github/workflows/test.yml +1 -1
- package/api/lib/zod/export_parameters.ts +6 -0
- package/bun.lockb +0 -0
- package/cli/lib/cmd-fns/dev/derive-selector-from-pcb-component-id.ts +2 -2
- package/cli/lib/cmd-fns/dev/fulfill-export-requests.ts +19 -0
- package/cli/lib/cmd-fns/export-kicad-pcb.ts +36 -0
- package/cli/lib/cmd-fns/index.ts +1 -0
- package/cli/lib/export-fns/export-kicad-pcb.ts +32 -0
- package/cli/lib/get-program.ts +11 -0
- package/cli/lib/soupify/get-tmp-entrpoint-filepath.ts +3 -1
- package/cli/lib/soupify/soupify-with-core.ts +6 -1
- package/cli/lib/soupify/soupify.ts +1 -1
- package/cli/tests/export-kicad-pcb.test.ts +23 -0
- package/dist/cli.js +280 -213
- package/example-project/src/MyCircuit.tsx +1 -7
- package/example-project/src/manual-edits.ts +1 -72
- package/frontend/components/dialogs/generic-export-dialog.tsx +3 -1
- package/frontend/views/HeaderMenu.tsx +17 -2
- package/package.json +7 -5
|
@@ -3,13 +3,7 @@ import { layout } from "@tscircuit/layout"
|
|
|
3
3
|
import manual_edits from "./manual-edits"
|
|
4
4
|
|
|
5
5
|
export const MyCircuit = () => (
|
|
6
|
-
<board
|
|
7
|
-
width="40mm"
|
|
8
|
-
height="40mm"
|
|
9
|
-
pcbX={0}
|
|
10
|
-
pcbY={0}
|
|
11
|
-
layout={layout().manualEdits(manual_edits)}
|
|
12
|
-
>
|
|
6
|
+
<board width="40mm" height="40mm" pcbX={0} pcbY={0}>
|
|
13
7
|
<resistor
|
|
14
8
|
name="R1"
|
|
15
9
|
resistance="20kohm"
|
|
@@ -52,77 +52,6 @@ export default {
|
|
|
52
52
|
relative_to: "group_center",
|
|
53
53
|
},
|
|
54
54
|
],
|
|
55
|
-
manual_trace_hints: [
|
|
56
|
-
{
|
|
57
|
-
pcb_port_selector: ".D9 > .pin2",
|
|
58
|
-
offsets: [
|
|
59
|
-
{
|
|
60
|
-
x: 38.92169691522466,
|
|
61
|
-
y: -2.3377796771400057,
|
|
62
|
-
via: false,
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
x: 37.986379705415004,
|
|
66
|
-
y: -2.4045880492692646,
|
|
67
|
-
via: true,
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
x: 35.04681133172754,
|
|
71
|
-
y: -2.5048006074631566,
|
|
72
|
-
via: true,
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
pcb_port_selector: ".D8 > .pin2",
|
|
78
|
-
offsets: [
|
|
79
|
-
{
|
|
80
|
-
x: 39.368100153443855,
|
|
81
|
-
y: 11.075329302388642,
|
|
82
|
-
via: false,
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
x: 39.0431504551313,
|
|
86
|
-
y: -2.4100831775825498,
|
|
87
|
-
via: false,
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
pcb_port_selector: ".D6 > .pin2",
|
|
93
|
-
offsets: [
|
|
94
|
-
{
|
|
95
|
-
x: 27.898990889830188,
|
|
96
|
-
y: -7.126105014672912,
|
|
97
|
-
via: true,
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
pcb_port_selector: ".D7 > .pin2",
|
|
103
|
-
offsets: [
|
|
104
|
-
{
|
|
105
|
-
x: -8.911022990918022,
|
|
106
|
-
y: 12.104068965358355,
|
|
107
|
-
via: true,
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
x: 31.337860341638805,
|
|
111
|
-
y: 8.65338014408593,
|
|
112
|
-
via: true,
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
x: 40.284252655475,
|
|
116
|
-
y: 7.931249822789734,
|
|
117
|
-
via: false,
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
x: 39.96330584601003,
|
|
121
|
-
y: -2.4995214848219867,
|
|
122
|
-
via: false,
|
|
123
|
-
},
|
|
124
|
-
],
|
|
125
|
-
},
|
|
126
|
-
],
|
|
55
|
+
manual_trace_hints: [],
|
|
127
56
|
edit_events: [],
|
|
128
57
|
}
|
|
@@ -11,11 +11,13 @@ export const useGenericExportDialog = ({
|
|
|
11
11
|
dialogTitle,
|
|
12
12
|
dialogDescription,
|
|
13
13
|
exportParameters,
|
|
14
|
+
fileExtension = "",
|
|
14
15
|
}: {
|
|
15
16
|
exportFileName: string
|
|
16
17
|
dialogTitle: string
|
|
17
18
|
dialogDescription: string
|
|
18
19
|
exportParameters: ExportParametersInput
|
|
20
|
+
fileExtension?: string
|
|
19
21
|
}) => {
|
|
20
22
|
const [open, setIsOpen] = useState(false)
|
|
21
23
|
const activeDevExamplePackage = useActiveDevPackageExampleLite()
|
|
@@ -40,7 +42,7 @@ export const useGenericExportDialog = ({
|
|
|
40
42
|
activeDevExamplePackage
|
|
41
43
|
const outputName = `${
|
|
42
44
|
inputFilePath.split("/").pop()?.split(".")[0]
|
|
43
|
-
}-${exampleExportName}-${exportFileName}`
|
|
45
|
+
}-${exampleExportName}-${exportFileName}${fileExtension}`
|
|
44
46
|
|
|
45
47
|
return {
|
|
46
48
|
openDialog,
|
|
@@ -77,6 +77,17 @@ export const HeaderMenu = () => {
|
|
|
77
77
|
},
|
|
78
78
|
})
|
|
79
79
|
|
|
80
|
+
const kicadPcbExportDialog = useGenericExportDialog({
|
|
81
|
+
dialogTitle: "Export KiCad PCB",
|
|
82
|
+
dialogDescription:
|
|
83
|
+
"Export the circuit as a KiCad PCB file. This can be opened and edited in KiCad.",
|
|
84
|
+
exportFileName: "kicad_pcb",
|
|
85
|
+
fileExtension: ".kicad_pcb",
|
|
86
|
+
exportParameters: {
|
|
87
|
+
should_export_kicad_pcb: true,
|
|
88
|
+
},
|
|
89
|
+
})
|
|
90
|
+
|
|
80
91
|
const handleDebugClick = async () => {
|
|
81
92
|
const soupData = await axios
|
|
82
93
|
.post("/api/dev_package_examples/get", {
|
|
@@ -156,6 +167,9 @@ export const HeaderMenu = () => {
|
|
|
156
167
|
<MenubarItem onSelect={() => soupExportDialog.openDialog()}>
|
|
157
168
|
Circuit JSON
|
|
158
169
|
</MenubarItem>
|
|
170
|
+
<MenubarItem onSelect={() => kicadPcbExportDialog.openDialog()}>
|
|
171
|
+
KiCad PCB
|
|
172
|
+
</MenubarItem>
|
|
159
173
|
</MenubarSubContent>
|
|
160
174
|
</MenubarSub>
|
|
161
175
|
</MenubarContent>
|
|
@@ -280,8 +294,8 @@ export const HeaderMenu = () => {
|
|
|
280
294
|
@tscircuit/cli v{cliPackageJson.version}
|
|
281
295
|
</MenubarItem>
|
|
282
296
|
<MenubarItem disabled>
|
|
283
|
-
@tscircuit/
|
|
284
|
-
{cliPackageJson.dependencies?.["@tscircuit/
|
|
297
|
+
@tscircuit/core v
|
|
298
|
+
{cliPackageJson.dependencies?.["@tscircuit/core"]?.replace(
|
|
285
299
|
/\^/g,
|
|
286
300
|
"",
|
|
287
301
|
)}
|
|
@@ -306,6 +320,7 @@ export const HeaderMenu = () => {
|
|
|
306
320
|
<pnpExportDialog.Component />
|
|
307
321
|
<bomExportDialog.Component />
|
|
308
322
|
<soupExportDialog.Component />
|
|
323
|
+
<kicadPcbExportDialog.Component />
|
|
309
324
|
</>
|
|
310
325
|
)
|
|
311
326
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.208",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Command line tool for developing, publishing and installing tscircuit circuits",
|
|
@@ -18,8 +18,6 @@
|
|
|
18
18
|
"build:dev-server": "bun run build:api && bun run build:frontend",
|
|
19
19
|
"build:api": "cd api && winterspec bundle-routes -i ./routes -o ./static-routes.ts",
|
|
20
20
|
"build:frontend": "vite build --config frontend/vite.config.ts && make-vfs --content-format string --dir frontend/dist --outfile ./frontend/dist/bundle.ts",
|
|
21
|
-
"test:init": "bun cli/cli.ts init --dir ./tmp/test --name test",
|
|
22
|
-
"update-deps": "bun add @tscircuit/builder@latest @tscircuit/react-fiber@latest @tscircuit/schematic-viewer@latest @tscircuit/pcb-viewer@latest @tscircuit/table-viewer@latest @tscircuit/3d-viewer@latest",
|
|
23
21
|
"format": "biome format . --write"
|
|
24
22
|
},
|
|
25
23
|
"bin": {
|
|
@@ -38,11 +36,13 @@
|
|
|
38
36
|
"@edge-runtime/primitives": "^4.1.0",
|
|
39
37
|
"@hono/node-server": "^1.8.2",
|
|
40
38
|
"@tscircuit/builder": "*",
|
|
41
|
-
"@tscircuit/core": "^0.0.
|
|
39
|
+
"@tscircuit/core": "^0.0.69",
|
|
42
40
|
"@tscircuit/props": "^0.0.62",
|
|
41
|
+
"@tscircuit/soup": "^0.0.71",
|
|
43
42
|
"archiver": "^7.0.1",
|
|
44
43
|
"axios": "^1.6.7",
|
|
45
44
|
"chokidar": "^3.6.0",
|
|
45
|
+
"circuit-json-to-connectivity-map": "^0.0.16",
|
|
46
46
|
"circuit-json-to-gerber": "^0.0.4",
|
|
47
47
|
"circuit-to-png": "^0.0.3",
|
|
48
48
|
"circuit-to-svg": "^0.0.22",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"hono": "^4.1.0",
|
|
59
59
|
"ignore": "^5.3.1",
|
|
60
60
|
"json5": "^2.2.3",
|
|
61
|
+
"kicad-converter": "^0.0.7",
|
|
61
62
|
"kleur": "^4.1.5",
|
|
62
63
|
"lodash": "^4.17.21",
|
|
63
64
|
"memory-level": "^1.0.0",
|
|
@@ -66,6 +67,7 @@
|
|
|
66
67
|
"node-persist": "^4.0.1",
|
|
67
68
|
"open": "^10.1.0",
|
|
68
69
|
"perfect-cli": "^1.0.20",
|
|
70
|
+
"performance-now": "^2.1.0",
|
|
69
71
|
"posthog-node": "^4.0.1",
|
|
70
72
|
"prompts": "^2.4.2",
|
|
71
73
|
"redaxios": "^0.5.1",
|
|
@@ -83,7 +85,7 @@
|
|
|
83
85
|
"@tscircuit/soup-util": "*"
|
|
84
86
|
},
|
|
85
87
|
"devDependencies": {
|
|
86
|
-
"@biomejs/biome": "^1.9.
|
|
88
|
+
"@biomejs/biome": "^1.9.2",
|
|
87
89
|
"@headlessui/react": "^1.7.18",
|
|
88
90
|
"@radix-ui/react-alert-dialog": "^1.0.5",
|
|
89
91
|
"@radix-ui/react-context-menu": "^2.1.5",
|