@tscircuit/cli 0.0.117 → 0.0.120
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/release.yml +1 -1
- package/.github/workflows/server-tests.yml +31 -0
- package/.github/workflows/test.yml +4 -1
- package/README.md +1 -2
- package/bun.lockb +0 -0
- package/dev-server-api/bun.lockb +0 -0
- package/dev-server-api/package.json +2 -4
- package/dev-server-api/routes/api/db/download.ts +25 -0
- package/dev-server-api/routes/api/dev_package_examples/create.ts +15 -25
- package/dev-server-api/routes/api/dev_package_examples/get.ts +12 -21
- package/dev-server-api/routes/api/dev_package_examples/list.ts +17 -22
- package/dev-server-api/routes/api/dev_package_examples/update.ts +39 -37
- package/dev-server-api/routes/api/dev_server/reset.ts +6 -8
- package/dev-server-api/routes/api/export_files/create.ts +10 -13
- package/dev-server-api/routes/api/export_files/download.ts +10 -7
- package/dev-server-api/routes/api/export_requests/create.ts +11 -15
- package/dev-server-api/routes/api/export_requests/get.ts +24 -15
- package/dev-server-api/routes/api/export_requests/list.ts +9 -10
- package/dev-server-api/routes/api/export_requests/update.ts +18 -18
- package/dev-server-api/routes/api/package_info/create.ts +9 -11
- package/dev-server-api/routes/api/package_info/get.ts +5 -8
- package/dev-server-api/routes/index.ts +16 -0
- package/dev-server-api/server.ts +1 -1
- package/dev-server-api/src/db/get-db.ts +11 -102
- package/dev-server-api/src/db/schema.ts +65 -0
- package/dev-server-api/src/db/zod-level-db.ts +146 -0
- package/dev-server-api/src/middlewares/with-db.ts +7 -3
- package/dev-server-api/static-routes.ts +3 -1
- package/dev-server-api/tests/fixtures/get-test-server.ts +30 -0
- package/dev-server-api/tests/fixtures/start-server.ts +20 -0
- package/dev-server-api/tests/routes/dev_package_examples/create.test.ts +19 -0
- package/dev-server-api/tests/routes/dev_package_examples/get.test.ts +25 -0
- package/dev-server-api/tests/routes/dev_package_examples/list.test.ts +32 -0
- package/dev-server-api/tests/routes/dev_package_examples/update.test.ts +28 -0
- package/dev-server-api/tests/routes/export_files/create.test.ts +18 -0
- package/dev-server-api/tests/routes/export_files/download.test.ts +29 -0
- package/dev-server-api/tests/routes/export_requests/create.test.ts +24 -0
- package/dev-server-api/tests/routes/export_requests/get.test.ts +41 -0
- package/dev-server-api/tests/routes/export_requests/list.test.ts +35 -0
- package/dev-server-api/tests/routes/export_requests/update.test.ts +50 -0
- package/dev-server-api/tests/routes/health.test.ts +10 -0
- package/dist/cli.js +488 -368
- package/lib/cmd-fns/dev/index.ts +14 -11
- package/package.json +7 -8
- package/tests/open.test.ts +1 -2
- package/tests/soupify.test.ts +1 -1
- package/dev-server-api/src/lib/zod/export_file.ts +0 -8
- package/dev-server-api/src/lib/zod/export_package_info.ts +0 -5
- package/dev-server-api/src/lib/zod/export_request.ts +0 -21
- /package/{tests/assets/example-project → example-project}/README.md +0 -0
- /package/{tests/assets/example-project → example-project}/examples/basic-bug.tsx +0 -0
- /package/{tests/assets/example-project → example-project}/examples/basic-capacitor.tsx +0 -0
- /package/{tests/assets/example-project → example-project}/examples/basic-resistor.tsx +0 -0
- /package/{tests/assets/example-project → example-project}/index.ts +0 -0
- /package/{tests/assets/example-project → example-project}/package-lock.json +0 -0
- /package/{tests/assets/example-project → example-project}/package.json +0 -0
- /package/{tests/assets/example-project → example-project}/src/MyCircuit.tsx +0 -0
- /package/{tests/assets/example-project → example-project}/src/manual-edits.ts +0 -0
package/lib/cmd-fns/dev/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import $ from "dax-sh"
|
|
2
|
-
import fs from
|
|
2
|
+
import fs from "fs"
|
|
3
3
|
import { unlink } from "fs/promises"
|
|
4
4
|
import kleur from "kleur"
|
|
5
5
|
import open from "open"
|
|
@@ -58,7 +58,7 @@ export const devCmd = async (ctx: AppContext, args: any) => {
|
|
|
58
58
|
// TODO
|
|
59
59
|
|
|
60
60
|
// Delete old .tscircuit/dev-server.sqlite
|
|
61
|
-
unlink(Path.join(cwd, ".tscircuit/dev-server.sqlite")).catch(() => { })
|
|
61
|
+
// unlink(Path.join(cwd, ".tscircuit/dev-server.sqlite")).catch(() => { })
|
|
62
62
|
|
|
63
63
|
console.log(
|
|
64
64
|
kleur.green(
|
|
@@ -71,20 +71,23 @@ export const devCmd = async (ctx: AppContext, args: any) => {
|
|
|
71
71
|
const server = await startDevServer({ port, devServerAxios })
|
|
72
72
|
|
|
73
73
|
// Reset the database, allows migration to re-run
|
|
74
|
-
await devServerAxios.post("/api/dev_server/reset")
|
|
75
|
-
.
|
|
76
|
-
|
|
77
|
-
})
|
|
74
|
+
await devServerAxios.post("/api/dev_server/reset").catch((e) => {
|
|
75
|
+
console.log("Failed to reset database, continuing anyway...")
|
|
76
|
+
})
|
|
78
77
|
|
|
79
78
|
// Add package name to the package_info table
|
|
80
|
-
const packageJsonPath = Path.resolve(cwd,
|
|
81
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath,
|
|
79
|
+
const packageJsonPath = Path.resolve(cwd, "package.json")
|
|
80
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"))
|
|
82
81
|
const packageName = packageJson.name
|
|
83
82
|
|
|
84
83
|
console.log(`Adding package info...`)
|
|
85
|
-
await devServerAxios.post(
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
await devServerAxios.post(
|
|
85
|
+
"/api/package_info/create",
|
|
86
|
+
{
|
|
87
|
+
package_name: packageName,
|
|
88
|
+
},
|
|
89
|
+
ctx
|
|
90
|
+
)
|
|
88
91
|
|
|
89
92
|
// Soupify all examples
|
|
90
93
|
console.log(`Loading examples...`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.120",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Command line tool for developing, publishing and installing tscircuit circuits",
|
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
"bootstrap": "bun i && cd dev-server-api && bun i && cd ../dev-server-frontend && bun i",
|
|
10
10
|
"bootstrap:ci": "bun i --frozen-lockfile && cd dev-server-api && bun i --frozen-lockfile && cd ../dev-server-frontend && bun i --frozen-lockfile",
|
|
11
11
|
"start": "bun cli.ts",
|
|
12
|
-
"dev": "TSCI_DEV_SERVER_DB=$(pwd)/.tscircuit/
|
|
12
|
+
"dev": "TSCI_DEV_SERVER_DB=$(pwd)/.tscircuit/devdb concurrently 'cd dev-server-api && bun run build && bun start' 'cd dev-server-frontend && bun start' 'bun run dev-with-test-project'",
|
|
13
13
|
"clear": "rm -rf .tscircuit ./dev-server-api/.edgespec",
|
|
14
|
-
"start:dev-server": "bun build:dev-server && bun cli.ts dev -y --cwd ./
|
|
14
|
+
"start:dev-server": "bun build:dev-server && bun cli.ts dev -y --cwd ./example-project",
|
|
15
15
|
"build:dev-server": "cd dev-server-api && bun run build && cd ../dev-server-frontend && bun run build",
|
|
16
16
|
"build:dev-server:api": "cd dev-server-api && bun run build",
|
|
17
17
|
"build:cli": "bun build-cli.ts",
|
|
18
18
|
"build": "bun build:dev-server && npm run build:cli",
|
|
19
|
-
"dev-with-test-project": "bun cli.ts dev --cwd ./
|
|
19
|
+
"dev-with-test-project": "bun cli.ts dev --cwd ./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 ../
|
|
21
|
+
"update-deps": "bun add @tscircuit/builder@latest @tscircuit/react-fiber@latest && cd dev-server-frontend && bun run update-deps && cd ../example-project && bun run update-deps"
|
|
22
22
|
},
|
|
23
23
|
"bin": {
|
|
24
24
|
"tsci": "./dist/cli.js"
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
"@hono/node-server": "^1.8.2",
|
|
38
38
|
"archiver": "^7.0.1",
|
|
39
39
|
"axios": "^1.6.7",
|
|
40
|
-
"better-sqlite3": "^11.1.2",
|
|
41
40
|
"chokidar": "^3.6.0",
|
|
42
41
|
"commander": "^12.0.0",
|
|
43
42
|
"configstore": "^6.0.0",
|
|
@@ -53,7 +52,7 @@
|
|
|
53
52
|
"ignore": "^5.3.1",
|
|
54
53
|
"json5": "^2.2.3",
|
|
55
54
|
"kleur": "^4.1.5",
|
|
56
|
-
"
|
|
55
|
+
"level": "^8.0.1",
|
|
57
56
|
"lodash": "^4.17.21",
|
|
58
57
|
"mime-types": "^2.1.35",
|
|
59
58
|
"minimist": "^1.2.8",
|
|
@@ -79,7 +78,7 @@
|
|
|
79
78
|
"@tscircuit/builder": "*",
|
|
80
79
|
"@tscircuit/layout": "^0.0.24",
|
|
81
80
|
"@tscircuit/react-fiber": "*",
|
|
82
|
-
"@tscircuit/soup-util": "^0.0.
|
|
81
|
+
"@tscircuit/soup-util": "^0.0.11",
|
|
83
82
|
"@tscircuit/manual-edit-events": "^0.0.4",
|
|
84
83
|
"@types/archiver": "^6.0.2",
|
|
85
84
|
"@types/bun": "^1.0.8",
|
package/tests/open.test.ts
CHANGED
|
@@ -2,8 +2,7 @@ import { test, expect } from "bun:test"
|
|
|
2
2
|
import { $ } from "bun"
|
|
3
3
|
|
|
4
4
|
test("tsci open", async () => {
|
|
5
|
-
const result =
|
|
6
|
-
await $`bun cli.ts open -y --cwd ./tests/assets/example-project`.text()
|
|
5
|
+
const result = await $`bun cli.ts open -y --cwd ./example-project`.text()
|
|
7
6
|
expect(result).toContain("http")
|
|
8
7
|
expect(result).toContain("example-project")
|
|
9
8
|
})
|
package/tests/soupify.test.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { $ } from "bun"
|
|
|
3
3
|
|
|
4
4
|
test("soupify", async () => {
|
|
5
5
|
const result =
|
|
6
|
-
await $`bun cli.ts soupify -y --file ./
|
|
6
|
+
await $`bun cli.ts soupify -y --file ./example-project/examples/basic-bug.tsx`.text()
|
|
7
7
|
|
|
8
8
|
expect(result).toContain("10kohm")
|
|
9
9
|
})
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { z } from "zod"
|
|
2
|
-
import { export_parameters } from "./export_parameters"
|
|
3
|
-
|
|
4
|
-
export const export_request = z.object({
|
|
5
|
-
export_request_id: z.coerce.number(),
|
|
6
|
-
is_complete: z.boolean(),
|
|
7
|
-
created_at: z.string(),
|
|
8
|
-
export_name: z.string(),
|
|
9
|
-
example_file_path: z.string(),
|
|
10
|
-
export_parameters,
|
|
11
|
-
file_summary: z
|
|
12
|
-
.array(
|
|
13
|
-
z.object({
|
|
14
|
-
file_name: z.string(),
|
|
15
|
-
export_file_id: z.number().int(),
|
|
16
|
-
})
|
|
17
|
-
)
|
|
18
|
-
.optional(),
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
export type ExportRequest = z.infer<typeof export_request>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|