@tscircuit/cli 0.0.108 → 0.0.110
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/bun.lockb +0 -0
- package/dev-server-api/bun.lockb +0 -0
- package/dev-server-api/package.json +3 -3
- package/dev-server-api/server.ts +9 -1
- package/dev-server-frontend/bun.lockb +0 -0
- package/dev-server-frontend/package.json +4 -3
- package/dev-server-frontend/src/ExampleContentView.tsx +23 -5
- package/dev-server-frontend/src/Header.tsx +5 -3
- package/dev-server-frontend/src/hooks/use-global-store.ts +3 -3
- package/package.json +5 -5
- package/tests/assets/example-project/examples/basic-bug.tsx +24 -22
- package/tests/assets/example-project/package.json +5 -2
- package/tests/assets/example-project/src/manual-edits.ts +20 -1
- package/dist/cli.js +0 -3023
package/bun.lockb
CHANGED
|
Binary file
|
package/dev-server-api/bun.lockb
CHANGED
|
Binary file
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
"main": "dist/bundle.ts",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"start": "
|
|
7
|
-
"build": "
|
|
6
|
+
"start": "bun server.ts",
|
|
7
|
+
"build": "echo 'nothing to do'"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
10
|
"@types/better-sqlite3": "^7.6.9",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"better-sqlite3": "^11.0.0",
|
|
19
19
|
"kysely": "^0.27.3",
|
|
20
20
|
"kysely-bun-sqlite": "^0.3.2",
|
|
21
|
-
"winterspec": "0.0.
|
|
21
|
+
"winterspec": "^0.0.80",
|
|
22
22
|
"zod": "^3.22.4"
|
|
23
23
|
}
|
|
24
24
|
}
|
package/dev-server-api/server.ts
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { createFetchHandlerFromDir } from "winterspec/adapters/node"
|
|
2
|
+
import { Request as EdgeRuntimeRequest } from "@edge-runtime/primitives"
|
|
2
3
|
|
|
3
4
|
const serverFetch = await createFetchHandlerFromDir("./routes")
|
|
4
5
|
|
|
5
6
|
console.log("starting dev-server-api on localhost:3021")
|
|
6
7
|
Bun.serve({
|
|
7
|
-
fetch: (
|
|
8
|
+
fetch: (bunReq) => {
|
|
9
|
+
const req = new EdgeRuntimeRequest(bunReq.url, {
|
|
10
|
+
headers: bunReq.headers,
|
|
11
|
+
method: bunReq.method,
|
|
12
|
+
body: bunReq.body,
|
|
13
|
+
})
|
|
14
|
+
return serverFetch(req as any)
|
|
15
|
+
},
|
|
8
16
|
port: 3021,
|
|
9
17
|
})
|
|
Binary file
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"build": "tsc && vite build --base /preview && rm -f dist/bundle* && make-vfs --dir dist --outfile ./dist/bundle.ts",
|
|
14
14
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 10",
|
|
15
15
|
"preview": "vite preview",
|
|
16
|
-
"update-deps": "bun add @tscircuit/pcb-viewer@latest @tscircuit/builder@latest @tscircuit/schematic-viewer@latest"
|
|
16
|
+
"update-deps": "bun add @tscircuit/pcb-viewer@latest @tscircuit/builder@latest @tscircuit/schematic-viewer@latest @tscircuit/3d-viewer@latest"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@headlessui/react": "^1.7.18",
|
|
@@ -30,8 +30,9 @@
|
|
|
30
30
|
"@radix-ui/react-toggle": "^1.0.3",
|
|
31
31
|
"@radix-ui/react-toggle-group": "^1.0.4",
|
|
32
32
|
"@radix-ui/react-tooltip": "^1.0.7",
|
|
33
|
-
"@tscircuit/
|
|
34
|
-
"@tscircuit/
|
|
33
|
+
"@tscircuit/3d-viewer": "^0.0.6",
|
|
34
|
+
"@tscircuit/builder": "^1.5.134",
|
|
35
|
+
"@tscircuit/pcb-viewer": "^1.4.0",
|
|
35
36
|
"@tscircuit/schematic-viewer": "^1.2.14",
|
|
36
37
|
"@tscircuit/table-viewer": "0.0.8",
|
|
37
38
|
"axios": "^1.6.7",
|
|
@@ -9,10 +9,11 @@ import { SoupTableViewer } from "@tscircuit/table-viewer"
|
|
|
9
9
|
import "react-data-grid/lib/styles.css"
|
|
10
10
|
import { useEffect, useRef, useState } from "react"
|
|
11
11
|
import type { EditEvent } from "@tscircuit/pcb-viewer"
|
|
12
|
+
import { CadViewer } from "@tscircuit/3d-viewer"
|
|
12
13
|
|
|
13
14
|
export const ExampleContentView = () => {
|
|
14
15
|
const devExamplePackageId = useGlobalStore(
|
|
15
|
-
(s) => s.active_dev_example_package_id
|
|
16
|
+
(s) => s.active_dev_example_package_id,
|
|
16
17
|
)
|
|
17
18
|
|
|
18
19
|
const {
|
|
@@ -33,7 +34,7 @@ export const ExampleContentView = () => {
|
|
|
33
34
|
refetchIntervalInBackground: true,
|
|
34
35
|
refetchOnWindowFocus: true,
|
|
35
36
|
retry: false,
|
|
36
|
-
}
|
|
37
|
+
},
|
|
37
38
|
)
|
|
38
39
|
|
|
39
40
|
const sentEditEvents = useRef<Record<string, boolean>>({})
|
|
@@ -46,7 +47,8 @@ export const ExampleContentView = () => {
|
|
|
46
47
|
let [editEvents, setEditEvents] = useState<EditEvent[]>([])
|
|
47
48
|
|
|
48
49
|
editEvents = editEvents.filter(
|
|
49
|
-
(ee) =>
|
|
50
|
+
(ee) =>
|
|
51
|
+
ee.created_at > new Date(pkg?.edit_events_last_applied_at).valueOf(),
|
|
50
52
|
)
|
|
51
53
|
|
|
52
54
|
const editorHeight = window.innerHeight - 52
|
|
@@ -64,7 +66,7 @@ export const ExampleContentView = () => {
|
|
|
64
66
|
viewMode === "split" &&
|
|
65
67
|
splitMode === "horizontal" &&
|
|
66
68
|
"grid grid-cols-2",
|
|
67
|
-
viewMode === "split" && splitMode === "vertical" && "grid grid-rows-2"
|
|
69
|
+
viewMode === "split" && splitMode === "vertical" && "grid grid-rows-2",
|
|
68
70
|
)}
|
|
69
71
|
>
|
|
70
72
|
{pkg && (viewMode === "schematic" || viewMode === "split") && (
|
|
@@ -101,7 +103,7 @@ export const ExampleContentView = () => {
|
|
|
101
103
|
axios.post(`/api/dev_package_examples/update`, {
|
|
102
104
|
dev_package_example_id: devExamplePackageId,
|
|
103
105
|
completed_edit_events: changedEditEvents.filter(
|
|
104
|
-
(ee) => ee.in_progress === false
|
|
106
|
+
(ee) => ee.in_progress === false,
|
|
105
107
|
),
|
|
106
108
|
})
|
|
107
109
|
}
|
|
@@ -111,6 +113,22 @@ export const ExampleContentView = () => {
|
|
|
111
113
|
/>
|
|
112
114
|
</ErrorBoundary>
|
|
113
115
|
)}
|
|
116
|
+
{pkg && viewMode === "3d" && (
|
|
117
|
+
<ErrorBoundary
|
|
118
|
+
fallbackRender={(props) => (
|
|
119
|
+
<div style={{ padding: 20 }}>
|
|
120
|
+
Failed to render 3d view
|
|
121
|
+
<div style={{ marginTop: 20, color: "red" }}>
|
|
122
|
+
{props.error.message}
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
)}
|
|
126
|
+
>
|
|
127
|
+
<div style={{ height: itemHeight }}>
|
|
128
|
+
<CadViewer soup={pkg.tscircuit_soup} />
|
|
129
|
+
</div>
|
|
130
|
+
</ErrorBoundary>
|
|
131
|
+
)}
|
|
114
132
|
{pkg && viewMode === "soup" && (
|
|
115
133
|
<ErrorBoundary fallback={<div>Failed to render Soup</div>}>
|
|
116
134
|
<SoupTableViewer
|
|
@@ -34,10 +34,12 @@ export const Header = () => {
|
|
|
34
34
|
<TabsList>
|
|
35
35
|
<TabsTrigger value="schematic">Schematic</TabsTrigger>
|
|
36
36
|
<TabsTrigger value="pcb">PCB</TabsTrigger>
|
|
37
|
-
<TabsTrigger value="split">Split</TabsTrigger>
|
|
37
|
+
{/* <TabsTrigger value="split">Split</TabsTrigger> */}
|
|
38
|
+
<TabsTrigger value="3d">3D</TabsTrigger>
|
|
38
39
|
</TabsList>
|
|
39
40
|
</Tabs>
|
|
40
|
-
|
|
41
|
+
{/* Button is only relevant when the "Split" button is available */}
|
|
42
|
+
{/* <Button
|
|
41
43
|
variant="outline"
|
|
42
44
|
disabled={viewMode !== "split"}
|
|
43
45
|
className="ml-1 group"
|
|
@@ -46,7 +48,7 @@ export const Header = () => {
|
|
|
46
48
|
}}
|
|
47
49
|
>
|
|
48
50
|
<RotateCounterClockwiseIcon className="scale-x-[-1] group-hover:rotate-[30deg] transition-transform" />
|
|
49
|
-
</Button>
|
|
51
|
+
</Button> */}
|
|
50
52
|
</div>
|
|
51
53
|
</div>
|
|
52
54
|
)
|
|
@@ -4,7 +4,7 @@ import { persist } from "zustand/middleware"
|
|
|
4
4
|
export interface GlobalState {
|
|
5
5
|
active_dev_example_package_id: string | null
|
|
6
6
|
|
|
7
|
-
view_mode: "schematic" | "pcb" | "split" | "soup"
|
|
7
|
+
view_mode: "schematic" | "pcb" | "split" | "soup" | "3d"
|
|
8
8
|
split_mode: "horizontal" | "vertical"
|
|
9
9
|
in_debug_mode: boolean
|
|
10
10
|
|
|
@@ -37,6 +37,6 @@ export const useGlobalStore = create<GlobalState>()(
|
|
|
37
37
|
}),
|
|
38
38
|
{
|
|
39
39
|
name: "global-store",
|
|
40
|
-
}
|
|
41
|
-
)
|
|
40
|
+
},
|
|
41
|
+
),
|
|
42
42
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.110",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Command line tool for developing, publishing and installing tscircuit circuits",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"build": "bun build:dev-server && npm run build:cli",
|
|
19
19
|
"dev-with-test-project": "bun cli.ts dev --cwd ./tests/assets/example-project",
|
|
20
20
|
"test:init": "bun cli.ts init --dir ./tmp/test --name test",
|
|
21
|
-
"update-deps": "bun add @tscircuit/builder@latest @tscircuit/react-fiber@latest && cd dev-server-frontend && bun run update-deps && cd ../tests/assets/example-project && bun
|
|
21
|
+
"update-deps": "bun add @tscircuit/builder@latest @tscircuit/react-fiber@latest && cd dev-server-frontend && bun run update-deps && cd ../tests/assets/example-project && bun run update-deps"
|
|
22
22
|
},
|
|
23
23
|
"bin": {
|
|
24
24
|
"tsci": "./dist/cli.js"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@hono/node-server": "^1.8.2",
|
|
38
38
|
"archiver": "^7.0.1",
|
|
39
39
|
"axios": "^1.6.7",
|
|
40
|
-
"better-sqlite3": "^
|
|
40
|
+
"better-sqlite3": "^11.1.2",
|
|
41
41
|
"chokidar": "^3.6.0",
|
|
42
42
|
"commander": "^12.0.0",
|
|
43
43
|
"configstore": "^6.0.0",
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
"@tscircuit/manual-edit-events": "*"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@tscircuit/builder": "
|
|
78
|
+
"@tscircuit/builder": "*",
|
|
79
79
|
"@tscircuit/layout": "^0.0.20",
|
|
80
|
-
"@tscircuit/react-fiber": "
|
|
80
|
+
"@tscircuit/react-fiber": "*",
|
|
81
81
|
"@tscircuit/soup-util": "^0.0.1",
|
|
82
82
|
"@tscircuit/manual-edit-events": "^0.0.4",
|
|
83
83
|
"@types/archiver": "^6.0.2",
|
|
@@ -2,26 +2,28 @@ import { layout } from "@tscircuit/layout"
|
|
|
2
2
|
import manual_edits from "../src/manual-edits"
|
|
3
3
|
|
|
4
4
|
export const BasicBug = () => (
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
5
|
+
<board pcbCenterX={0} pcbCenterY={0} width="20mm" height="20mm">
|
|
6
|
+
<group
|
|
7
|
+
layout={layout()
|
|
8
|
+
.autoLayoutSchematic()
|
|
9
|
+
.manualPcbPlacement(manual_edits.pcb_placements)}
|
|
10
|
+
>
|
|
11
|
+
<bug
|
|
12
|
+
name="U2"
|
|
13
|
+
schPortArrangement={{
|
|
14
|
+
leftSize: 4,
|
|
15
|
+
rightSize: 4,
|
|
16
|
+
}}
|
|
17
|
+
footprint="ssop16"
|
|
18
|
+
pinLabels={{
|
|
19
|
+
"1": "GND",
|
|
20
|
+
"2": "VBUS",
|
|
21
|
+
"3": "D-",
|
|
22
|
+
"4": "D+",
|
|
23
|
+
}}
|
|
24
|
+
/>
|
|
25
|
+
<resistor name="R1" resistance="10kohm" footprint="0805" />
|
|
26
|
+
<trace from=".U2 > .1" to=".R1 > .left" />
|
|
27
|
+
</group>
|
|
28
|
+
</board>
|
|
27
29
|
)
|
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
"version": "1.2.26",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"update-deps": "bun add -f @tscircuit/builder@latest @tscircuit/react-fiber@latest @tscircuit/layout@latest"
|
|
8
|
+
},
|
|
6
9
|
"dependencies": {
|
|
7
|
-
"@tscircuit/builder": "^1.5.
|
|
8
|
-
"@tscircuit/layout": "^0.0.
|
|
10
|
+
"@tscircuit/builder": "^1.5.134",
|
|
11
|
+
"@tscircuit/layout": "^0.0.24",
|
|
9
12
|
"@tscircuit/react-fiber": "^1.1.29"
|
|
10
13
|
}
|
|
11
14
|
}
|
|
@@ -14,7 +14,26 @@ export default {
|
|
|
14
14
|
manual_edit_id: "abcdef",
|
|
15
15
|
|
|
16
16
|
// Manual pcb placements, added when you drag a footprint
|
|
17
|
-
pcb_placements: [
|
|
17
|
+
pcb_placements: [
|
|
18
|
+
{
|
|
19
|
+
"_edit_event_id": "0.6668756126702717",
|
|
20
|
+
"selector": ".U2",
|
|
21
|
+
"center": {
|
|
22
|
+
"x": -5.004250626566417,
|
|
23
|
+
"y": 0.13319298245614064
|
|
24
|
+
},
|
|
25
|
+
"relative_to": "group_center"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"_edit_event_id": "0.867524742177592",
|
|
29
|
+
"selector": ".R1",
|
|
30
|
+
"center": {
|
|
31
|
+
"x": 2.8351077694235585,
|
|
32
|
+
"y": 0
|
|
33
|
+
},
|
|
34
|
+
"relative_to": "group_center"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
18
37
|
manual_trace_hints: [],
|
|
19
38
|
edit_events: [],
|
|
20
39
|
}
|