@tscircuit/cli 0.0.27 → 0.0.29
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/dev-server-api/routes/api/dev_package_examples/create.ts +9 -2
- package/dev-server-api/routes/api/dev_package_examples/get.ts +1 -0
- package/dev-server-api/routes/api/dev_package_examples/update.ts +4 -1
- package/dev-server-api/src/db/create-schema.ts +1 -0
- package/dev-server-api/src/db/get-db.ts +1 -0
- package/dev-server-frontend/src/ExampleContentView.tsx +9 -0
- package/dev-server-frontend/src/HeaderMenu.tsx +16 -0
- package/dist/cli.js +81 -63
- package/lib/cmd-fns/dev/soupify-and-upload-example-file.ts +10 -2
- package/lib/cmd-fns/dev/start-watcher.ts +1 -0
- package/lib/soupify.ts +7 -4
- package/package.json +1 -1
|
@@ -8,29 +8,36 @@ export default withEdgeSpec({
|
|
|
8
8
|
file_path: z.string(),
|
|
9
9
|
export_name: z.string().default("default"),
|
|
10
10
|
tscircuit_soup: z.any(),
|
|
11
|
+
error: z.string().nullable().optional().default(null),
|
|
11
12
|
}),
|
|
12
13
|
jsonResponse: z.object({
|
|
13
14
|
dev_package_example: z.object({
|
|
14
15
|
dev_package_example_id: z.coerce.number(),
|
|
15
16
|
file_path: z.string(),
|
|
16
17
|
tscircuit_soup: z.any(),
|
|
18
|
+
error: z.string().nullable().optional(),
|
|
17
19
|
last_updated_at: z.string().datetime(),
|
|
18
20
|
}),
|
|
19
21
|
}),
|
|
20
22
|
auth: "none",
|
|
21
23
|
})(async (req, ctx) => {
|
|
24
|
+
const tscircuit_soup = req.jsonBody.tscircuit_soup
|
|
25
|
+
? JSON.stringify(req.jsonBody.tscircuit_soup)
|
|
26
|
+
: undefined
|
|
22
27
|
const dev_package_example = await ctx.db
|
|
23
28
|
.insertInto("dev_package_example")
|
|
24
29
|
.values({
|
|
25
30
|
file_path: req.jsonBody.file_path,
|
|
26
31
|
export_name: req.jsonBody.export_name,
|
|
27
|
-
|
|
32
|
+
error: req.jsonBody.error,
|
|
33
|
+
tscircuit_soup,
|
|
28
34
|
last_updated_at: new Date().toISOString(),
|
|
29
35
|
})
|
|
30
36
|
.onConflict((oc) =>
|
|
31
37
|
oc.columns(["file_path"]).doUpdateSet({
|
|
32
38
|
export_name: req.jsonBody.export_name,
|
|
33
|
-
|
|
39
|
+
error: req.jsonBody.error,
|
|
40
|
+
tscircuit_soup,
|
|
34
41
|
last_updated_at: new Date().toISOString(),
|
|
35
42
|
})
|
|
36
43
|
)
|
|
@@ -6,12 +6,14 @@ export default withEdgeSpec({
|
|
|
6
6
|
methods: ["POST"],
|
|
7
7
|
jsonBody: z.object({
|
|
8
8
|
dev_package_example_id: z.coerce.number(),
|
|
9
|
-
tscircuit_soup: z.any(),
|
|
9
|
+
tscircuit_soup: z.any().optional(),
|
|
10
|
+
error: z.string().nullable().optional().default(null),
|
|
10
11
|
}),
|
|
11
12
|
jsonResponse: z.object({
|
|
12
13
|
dev_package_example: z.object({
|
|
13
14
|
dev_package_example_id: z.coerce.number(),
|
|
14
15
|
tscircuit_soup: z.any(),
|
|
16
|
+
error: z.string().nullable().optional(),
|
|
15
17
|
last_updated_at: z.string().datetime(),
|
|
16
18
|
}),
|
|
17
19
|
}),
|
|
@@ -22,6 +24,7 @@ export default withEdgeSpec({
|
|
|
22
24
|
.updateTable("dev_package_example")
|
|
23
25
|
.set({
|
|
24
26
|
tscircuit_soup: req.jsonBody.tscircuit_soup,
|
|
27
|
+
error: req.jsonBody.error,
|
|
25
28
|
last_updated_at: new Date().toISOString(),
|
|
26
29
|
})
|
|
27
30
|
.returningAll()
|
|
@@ -9,6 +9,7 @@ export const createSchema = async (db: DbClient) => {
|
|
|
9
9
|
.addColumn("file_path", "text", (col) => col.unique())
|
|
10
10
|
.addColumn("export_name", "text")
|
|
11
11
|
.addColumn("tscircuit_soup", "json")
|
|
12
|
+
.addColumn("error", "text")
|
|
12
13
|
.addColumn("last_updated_at", "text")
|
|
13
14
|
.execute()
|
|
14
15
|
}
|
|
@@ -28,11 +28,13 @@ export const ExampleContentView = () => {
|
|
|
28
28
|
|
|
29
29
|
const itemHeight =
|
|
30
30
|
viewMode === "split" && splitMode === "vertical" ? halfHeight : editorHeight
|
|
31
|
+
console.log(pkg)
|
|
31
32
|
|
|
32
33
|
return (
|
|
33
34
|
<div
|
|
34
35
|
key={pkg?.last_updated_at}
|
|
35
36
|
className={cn(
|
|
37
|
+
"relative",
|
|
36
38
|
`h-[${editorHeight}px]`,
|
|
37
39
|
viewMode === "split" &&
|
|
38
40
|
splitMode === "horizontal" &&
|
|
@@ -55,6 +57,13 @@ export const ExampleContentView = () => {
|
|
|
55
57
|
soup={pkg.tscircuit_soup}
|
|
56
58
|
/>
|
|
57
59
|
)}
|
|
60
|
+
{pkg?.error && (
|
|
61
|
+
<div className="absolute top-0 w-full">
|
|
62
|
+
<div className="bg-red-50 shadow-lg p-4 m-16 border-red-200 border rounded-lg whitespace-pre">
|
|
63
|
+
{pkg?.error}
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
)}
|
|
58
67
|
</div>
|
|
59
68
|
)
|
|
60
69
|
}
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
} from "src/components/ui/menubar"
|
|
16
16
|
import toast from "react-hot-toast"
|
|
17
17
|
import { useGlobalStore } from "./hooks/use-global-store"
|
|
18
|
+
import packageJson from "../package.json"
|
|
18
19
|
|
|
19
20
|
export const HeaderMenu = () => {
|
|
20
21
|
const [viewMode, setViewMode] = useGlobalStore((s) => [
|
|
@@ -181,6 +182,21 @@ export const HeaderMenu = () => {
|
|
|
181
182
|
>
|
|
182
183
|
Changelog
|
|
183
184
|
</MenubarItem>
|
|
185
|
+
<MenubarSeparator />
|
|
186
|
+
<MenubarItem disabled>
|
|
187
|
+
@tscircuit/schematic-viewer v
|
|
188
|
+
{packageJson.dependencies["@tscircuit/schematic-viewer"].replace(
|
|
189
|
+
/\^/g,
|
|
190
|
+
""
|
|
191
|
+
)}
|
|
192
|
+
</MenubarItem>
|
|
193
|
+
<MenubarItem disabled>
|
|
194
|
+
@tscircuit/pcb-viewer v
|
|
195
|
+
{packageJson.dependencies["@tscircuit/pcb-viewer"].replace(
|
|
196
|
+
/\^/g,
|
|
197
|
+
""
|
|
198
|
+
)}
|
|
199
|
+
</MenubarItem>
|
|
184
200
|
</MenubarContent>
|
|
185
201
|
</MenubarMenu>
|
|
186
202
|
</Menubar>
|