diff --git a/dev-server-api/routes/api/dev_package_examples/create.ts b/dev-server-api/routes/api/dev_package_examples/create.ts index f7200444..5bca998a 100644 --- a/dev-server-api/routes/api/dev_package_examples/create.ts +++ b/dev-server-api/routes/api/dev_package_examples/create.ts @@ -9,6 +9,7 @@ export default withEdgeSpec({ export_name: z.string().default("default"), tscircuit_soup: z.any(), error: z.string().nullable().optional().default(null), + is_loading: z.boolean().optional(), }), jsonResponse: z.object({ dev_package_example: z.object({ @@ -31,6 +32,7 @@ export default withEdgeSpec({ export_name: req.jsonBody.export_name, error: req.jsonBody.error, tscircuit_soup, + is_loading: req.jsonBody.is_loading ? 1 : 0, last_updated_at: new Date().toISOString(), }) .onConflict((oc) => @@ -38,6 +40,7 @@ export default withEdgeSpec({ export_name: req.jsonBody.export_name, error: req.jsonBody.error, tscircuit_soup, + is_loading: req.jsonBody.is_loading ? 1 : 0, last_updated_at: new Date().toISOString(), }) ) diff --git a/dev-server-api/routes/api/dev_package_examples/list.ts b/dev-server-api/routes/api/dev_package_examples/list.ts index d927a204..a2758e19 100644 --- a/dev-server-api/routes/api/dev_package_examples/list.ts +++ b/dev-server-api/routes/api/dev_package_examples/list.ts @@ -1,3 +1,4 @@ +import { sql } from "kysely" import { withEdgeSpec } from "src/with-edge-spec" import { z } from "zod" @@ -9,21 +10,24 @@ export default withEdgeSpec({ dev_package_example_id: z.coerce.number(), file_path: z.string(), export_name: z.string(), + is_loading: z.coerce.boolean(), last_updated_at: z.string().datetime(), }) ), }), auth: "none", })(async (req, ctx) => { + const dev_package_examples = await ctx.db + .selectFrom("dev_package_example") + .select([ + "dev_package_example_id", + "file_path", + "export_name", + "last_updated_at", + sql`(is_loading = 1)`.$castTo().as("is_loading"), + ]) + .execute() return ctx.json({ - dev_package_examples: await ctx.db - .selectFrom("dev_package_example") - .select([ - "dev_package_example_id", - "file_path", - "export_name", - "last_updated_at", - ]) - .execute(), + dev_package_examples, }) }) diff --git a/dev-server-api/routes/api/dev_server/reset.ts b/dev-server-api/routes/api/dev_server/reset.ts new file mode 100644 index 00000000..72d06360 --- /dev/null +++ b/dev-server-api/routes/api/dev_server/reset.ts @@ -0,0 +1,15 @@ +import { sql } from "kysely" +import { withEdgeSpec } from "src/with-edge-spec" +import { z } from "zod" +import { unlinkSync } from "fs" +import { getDbFilePath } from "src/db/get-db" + +export default (req: Request) => { + unlinkSync(getDbFilePath()) + + return new Response(JSON.stringify({}), { + headers: { + "content-type": "application/json", + }, + }) +} diff --git a/dev-server-api/src/db/create-schema.ts b/dev-server-api/src/db/create-schema.ts index 17087c66..aa08cea0 100644 --- a/dev-server-api/src/db/create-schema.ts +++ b/dev-server-api/src/db/create-schema.ts @@ -10,6 +10,7 @@ export const createSchema = async (db: DbClient) => { .addColumn("export_name", "text") .addColumn("tscircuit_soup", "json") .addColumn("error", "text") + .addColumn("is_loading", "boolean", (cb) => cb.defaultTo(0).notNull()) .addColumn("last_updated_at", "text") .execute() } diff --git a/dev-server-api/src/db/get-db.ts b/dev-server-api/src/db/get-db.ts index 73587d8d..e9e373e5 100644 --- a/dev-server-api/src/db/get-db.ts +++ b/dev-server-api/src/db/get-db.ts @@ -9,6 +9,7 @@ interface DevPackageExample { file_path: string export_name: string error: string | null + is_loading: 1 | 0 last_updated_at: string } @@ -22,11 +23,13 @@ export type DbClient = Kysely let globalDb: Kysely | undefined +export const getDbFilePath = () => + process.env.TSCI_DEV_SERVER_DB ?? "./.tscircuit/dev-server.db" + export const getDb = async (): Promise> => { if (globalDb) return globalDb - const devServerDbPath = - process.env.TSCI_DEV_SERVER_DB ?? "./.tscircuit/dev-server.db" + const devServerDbPath = getDbFilePath() mkdirSync(Path.dirname(devServerDbPath), { recursive: true }) diff --git a/dev-server-api/src/middlewares/with-error-response.ts b/dev-server-api/src/middlewares/with-error-response.ts index b8d90d41..4a85d93b 100644 --- a/dev-server-api/src/middlewares/with-error-response.ts +++ b/dev-server-api/src/middlewares/with-error-response.ts @@ -1,15 +1,28 @@ -import type { Middleware } from "edgespec/middleware" +import { NotFoundError, type Middleware } from "edgespec/middleware" import kleur from "kleur" export const withErrorResponse: Middleware<{}, {}> = async (req, ctx, next) => { try { return await next(req, ctx) } catch (error: any) { - console.error(kleur.red("Intercepted error:"), error) // If error is a Response, return it if (error instanceof Response) { return error } + if (error instanceof NotFoundError) { + return (ctx as any).json( + { + ok: false, + error: { + message: error?.message, + error_code: "not_found", + }, + }, + { status: error?.status || 404 } + ) + } + + console.error(kleur.red("Intercepted unhandled error:"), error) return (ctx as any).json( { ok: false, diff --git a/dev-server-frontend/src/ExampleContentView.tsx b/dev-server-frontend/src/ExampleContentView.tsx index db377fd1..cc92d145 100644 --- a/dev-server-frontend/src/ExampleContentView.tsx +++ b/dev-server-frontend/src/ExampleContentView.tsx @@ -10,7 +10,12 @@ export const ExampleContentView = () => { (s) => s.active_dev_example_package_id ) - const { data: pkg } = useQuery( + const { + data: pkg, + error, + isError, + isLoading, + } = useQuery( ["dev_package_example", devExamplePackageId], async () => axios @@ -20,9 +25,12 @@ export const ExampleContentView = () => { .then((r) => r.data.dev_package_example), { refetchIntervalInBackground: true, + retry: false, } ) + const notFound = (error as any)?.response?.status === 404 + const viewMode = useGlobalStore((s) => s.view_mode) const splitMode = useGlobalStore((s) => s.split_mode) @@ -44,6 +52,20 @@ export const ExampleContentView = () => { viewMode === "split" && splitMode === "vertical" && "grid grid-rows-2" )} > + {notFound && ( +
+
+ Select an example from the menu above +
+
+ )} + {isLoading && !isError && ( +
+
+ Loading... +
+
+ )} {pkg && (viewMode === "schematic" || viewMode === "split") && ( { const [open, setOpen] = useState(false) @@ -19,23 +21,28 @@ export const CommandK = () => { e.preventDefault() setOpen((open) => !open) } + if (e.key === "Escape") { + setOpen(false) + } } document.addEventListener("keydown", down) return () => document.removeEventListener("keydown", down) }, []) + const { data: examples } = useDevPackageExamples() + const close = () => { setOpen(false) return true } return ( - + setOpen(open)}> - - + + close() && store.setViewMode("schematic")} > @@ -54,8 +61,25 @@ export const CommandK = () => { Vertical Split - - + + + + {examples?.map((ex) => ( + + close() && + store.setActiveDevExamplePackageId( + ex.dev_package_example_id.toString() + ) + } + > + {ex.expath} + + ))} + + ) diff --git a/lib/cmd-fns/config-set-runtime.ts b/lib/cmd-fns/config-set-runtime.ts new file mode 100644 index 00000000..b59f319d --- /dev/null +++ b/lib/cmd-fns/config-set-runtime.ts @@ -0,0 +1,7 @@ +import { AppContext } from "../util/app-context" +import { z } from "zod" + +export const configSetRuntime = async (ctx: AppContext, args: any) => { + const params = z.object({ runtime: z.enum(["bun", "node"]) }).parse(args) + ctx.global_config.set("runtime", params.runtime) +} diff --git a/lib/cmd-fns/dev-server-upload.ts b/lib/cmd-fns/dev-server-upload.ts index e4c9b2b4..5dafe3bf 100644 --- a/lib/cmd-fns/dev-server-upload.ts +++ b/lib/cmd-fns/dev-server-upload.ts @@ -17,10 +17,10 @@ export const devServerUpload = async (ctx: AppContext, args: any) => { const devServerAxios = getDevServerAxios({ serverUrl }) console.log(`Loading examples...`) - await uploadExamplesFromDirectory({ devServerAxios, cwd: params.dir }) + await uploadExamplesFromDirectory({ devServerAxios, cwd: params.dir }, ctx) if (params.watch) { // Start watcher - const watcher = await startWatcher({ cwd: params.dir, devServerAxios }) + const watcher = await startWatcher({ cwd: params.dir, devServerAxios }, ctx) } } diff --git a/lib/cmd-fns/dev/index.ts b/lib/cmd-fns/dev/index.ts index e3b01bbf..27f58653 100644 --- a/lib/cmd-fns/dev/index.ts +++ b/lib/cmd-fns/dev/index.ts @@ -16,12 +16,12 @@ import { initCmd } from "../init" export const devCmd = async (ctx: AppContext, args: any) => { const params = z .object({ - cwd: z.string().optional().default(process.cwd()), port: z.coerce.number().optional().default(3020), }) .parse(args) - const { cwd, port } = params + const { port } = params + const { cwd } = ctx // In the future we should automatically run "tsci init" if the directory // isn't properly initialized, for now we're just going to do a spot check @@ -66,12 +66,15 @@ export const devCmd = async (ctx: AppContext, args: any) => { const server = await startDevServer({ port, devServerAxios }) + // Reset the database, allows migration to re-run + await devServerAxios.post("/api/dev_server/reset") + // Soupify all examples console.log(`Loading examples...`) - await uploadExamplesFromDirectory({ devServerAxios, cwd }) + await uploadExamplesFromDirectory({ devServerAxios, cwd }, ctx) // Start watcher - const watcher = await startWatcher({ cwd, devServerAxios }) + const watcher = await startWatcher({ cwd, devServerAxios }, ctx) while (true) { const { action } = await prompts({ diff --git a/lib/cmd-fns/dev/mark-all-examples-loading.ts b/lib/cmd-fns/dev/mark-all-examples-loading.ts new file mode 100644 index 00000000..ba9df120 --- /dev/null +++ b/lib/cmd-fns/dev/mark-all-examples-loading.ts @@ -0,0 +1,18 @@ +import { AxiosInstance } from "axios" + +export const markAllExamplesLoading = async ({ + devServerAxios, +}: { + devServerAxios: AxiosInstance +}) => { + const examples = await devServerAxios + .post("/api/dev_package_examples/list") + .then((r) => r.data.dev_package_examples) + + for (const example of examples) { + await devServerAxios.post("/api/dev_package_examples/update", { + dev_package_example_id: example.dev_package_example_id, + is_loading: true, + }) + } +} diff --git a/lib/cmd-fns/dev/soupify-and-upload-example-file.ts b/lib/cmd-fns/dev/soupify-and-upload-example-file.ts index 2898c06f..d9bf574e 100644 --- a/lib/cmd-fns/dev/soupify-and-upload-example-file.ts +++ b/lib/cmd-fns/dev/soupify-and-upload-example-file.ts @@ -5,26 +5,33 @@ import { readdirSync, readFileSync } from "fs" import { soupify } from "lib/soupify" import { inferExportNameFromSource } from "./infer-export-name-from-source" -export const soupifyAndUploadExampleFile = async ({ - examplesDir, - exampleFileName, - devServerAxios, -}: { - examplesDir: string - exampleFileName: string - devServerAxios: AxiosInstance -}) => { +export const soupifyAndUploadExampleFile = async ( + { + examplesDir, + exampleFileName, + devServerAxios, + }: { + examplesDir: string + exampleFileName: string + devServerAxios: AxiosInstance + }, + ctx: { runtime: "node" | "bun" } +) => { try { + const startTime = Date.now() const examplePath = joinPath(examplesDir, exampleFileName) const exampleContent = readFileSync(examplePath).toString() const exportName = inferExportNameFromSource(exampleContent) console.log(kleur.gray(`[soupifying] ${exampleFileName}...`)) - const { soup, error } = await soupify({ - filePath: examplePath, - exportName, - }) + const { soup, error } = await soupify( + { + filePath: examplePath, + exportName, + }, + ctx + ) .then((soup) => ({ soup, error: null })) .catch((e) => ({ error: e, soup: undefined })) @@ -38,8 +45,16 @@ export const soupifyAndUploadExampleFile = async ({ error: error?.toString() || null, file_path: examplePath, export_name: exportName, + is_loading: false, }) - console.log(kleur.gray(`[ done ] ${exampleFileName}!`)) + const timeTaken = Date.now() - startTime + console.log( + kleur.gray( + `[ done ] [ ${Math.round(timeTaken) + .toString() + .padStart(5, " ")}ms ] ${exampleFileName}!` + ) + ) } catch (e: any) { console.log(kleur.red(`[ error ] ${e.toString()}`)) } diff --git a/lib/cmd-fns/dev/start-watcher.ts b/lib/cmd-fns/dev/start-watcher.ts index 8e6859a0..8ae62b3a 100644 --- a/lib/cmd-fns/dev/start-watcher.ts +++ b/lib/cmd-fns/dev/start-watcher.ts @@ -3,13 +3,16 @@ import chokidar from "chokidar" import { uploadExamplesFromDirectory } from "./upload-examples-from-directory" import kleur from "kleur" -export const startWatcher = async ({ - cwd, - devServerAxios, -}: { - cwd: string - devServerAxios: AxiosInstance -}) => { +export const startWatcher = async ( + { + cwd, + devServerAxios, + }: { + cwd: string + devServerAxios: AxiosInstance + }, + ctx: { runtime: "node" | "bun" } +) => { const watcher = chokidar.watch(`${cwd}/**/*.tsx`, { ignored: /node_modules/, persistent: true, @@ -31,7 +34,7 @@ export const startWatcher = async ({ if (upload_queue_state.dirty) { console.log(kleur.yellow("Changes detected, re-uploading examples...")) upload_queue_state.dirty = false - await uploadExamplesFromDirectory({ cwd, devServerAxios }) + await uploadExamplesFromDirectory({ cwd, devServerAxios }, ctx) } await new Promise((resolve) => setTimeout(resolve, 100)) } diff --git a/lib/cmd-fns/dev/upload-examples-from-directory.ts b/lib/cmd-fns/dev/upload-examples-from-directory.ts index d3b7db65..25cedcbb 100644 --- a/lib/cmd-fns/dev/upload-examples-from-directory.ts +++ b/lib/cmd-fns/dev/upload-examples-from-directory.ts @@ -4,23 +4,34 @@ import { AxiosInstance } from "axios" import { readdirSync, readFileSync } from "fs" import { soupify } from "lib/soupify" import { soupifyAndUploadExampleFile } from "./soupify-and-upload-example-file" +import { markAllExamplesLoading } from "./mark-all-examples-loading" -export const uploadExamplesFromDirectory = async ({ - cwd, - devServerAxios, -}: { - cwd: string - devServerAxios: AxiosInstance -}) => { +export const uploadExamplesFromDirectory = async ( + { + cwd, + devServerAxios, + }: { + cwd: string + devServerAxios: AxiosInstance + }, + ctx: { runtime: "node" | "bun" } +) => { const examplesDir = joinPath(cwd, "examples") const exampleFileNames = readdirSync(examplesDir) + + // Mark all examples as being "reloaded" in the database + await markAllExamplesLoading({ devServerAxios }) + for (const exampleFileName of exampleFileNames) { if (exampleFileName.endsWith(".__tmp_entrypoint.tsx")) continue if (!exampleFileName.endsWith(".tsx")) continue - await soupifyAndUploadExampleFile({ - devServerAxios, - examplesDir, - exampleFileName, - }) + await soupifyAndUploadExampleFile( + { + devServerAxios, + examplesDir, + exampleFileName, + }, + ctx + ) } } diff --git a/lib/cmd-fns/index.ts b/lib/cmd-fns/index.ts index 1e0da7b5..c36f48c6 100644 --- a/lib/cmd-fns/index.ts +++ b/lib/cmd-fns/index.ts @@ -1,6 +1,7 @@ export { configRevealLocation } from "./config-reveal-location" export { configSetRegistry } from "./config-set-registry" export { configSetSession } from "./config-set-session" +export { configSetRuntime } from "./config-set-runtime" export { configSetLogRequests } from "./config-set-log-requests" export { configPrintConfig } from "./config-print-config" export { authLogin } from "./auth-login" diff --git a/lib/cmd-fns/package-examples-create.ts b/lib/cmd-fns/package-examples-create.ts index 8a6e7141..0033e388 100644 --- a/lib/cmd-fns/package-examples-create.ts +++ b/lib/cmd-fns/package-examples-create.ts @@ -12,10 +12,13 @@ export const packageExamplesCreate = async (ctx: AppContext, args: any) => { }) .parse(args) - const tscircuit_soup = await soupify({ - filePath: params.file, - exportName: params.export, - }) + const tscircuit_soup = await soupify( + { + filePath: params.file, + exportName: params.export, + }, + ctx + ) const fileContent = await fs.promises.readFile(params.file, "utf8") diff --git a/lib/cmd-fns/publish/index.ts b/lib/cmd-fns/publish/index.ts index 912c12f8..bb79af44 100644 --- a/lib/cmd-fns/publish/index.ts +++ b/lib/cmd-fns/publish/index.ts @@ -218,10 +218,13 @@ export const publish = async (ctx: AppContext, args: any) => { const exportName = inferExportNameFromSource(fileContent) - const tscircuit_soup = await soupify({ - filePath, - exportName, - }).catch((e) => e) + const tscircuit_soup = await soupify( + { + filePath, + exportName, + }, + ctx + ).catch((e) => e) if (tscircuit_soup instanceof Error) { console.log( diff --git a/lib/cmd-fns/soupify.ts b/lib/cmd-fns/soupify.ts index 283254b9..b09517fe 100644 --- a/lib/cmd-fns/soupify.ts +++ b/lib/cmd-fns/soupify.ts @@ -14,10 +14,13 @@ export const soupifyCmd = async (ctx: AppContext, args: any) => { }) .parse(args) - const soup = await soupify({ - filePath: params.file, - exportName: params.export, - }) + const soup = await soupify( + { + filePath: params.file, + exportName: params.export, + }, + ctx + ) if (params.output) { await writeFileSync(params.output, JSON.stringify(soup, null, 2)) diff --git a/lib/create-config-manager.ts b/lib/create-config-manager.ts index d87ffee0..8f8c3879 100644 --- a/lib/create-config-manager.ts +++ b/lib/create-config-manager.ts @@ -8,6 +8,7 @@ interface ProfileConfigProps { interface GlobalConfigProps { current_profile?: string log_requests?: boolean + runtime?: "bun" | "node" } interface TypedConfigstore> { diff --git a/lib/get-program.ts b/lib/get-program.ts index 85e3f9b8..21045969 100644 --- a/lib/get-program.ts +++ b/lib/get-program.ts @@ -40,6 +40,13 @@ export const getProgram = (ctx: AppContext) => { .command("set-session") .requiredOption("--session-token ", "Session Token") .action((args) => CMDFN.configSetSession(ctx, args)) + configCmd + .command("set-runtime") + .requiredOption( + "--runtime ", + "Bun or node. Setting to bun generally doubles soupification speed." + ) + .action((args) => CMDFN.configSetRuntime(ctx, args)) configCmd .command("set-log-requests") .requiredOption("--log-requests", "Should log requests to registry") diff --git a/lib/param-handlers/index.ts b/lib/param-handlers/index.ts index f6302249..4362e442 100644 --- a/lib/param-handlers/index.ts +++ b/lib/param-handlers/index.ts @@ -5,6 +5,7 @@ import { interactForPackageName } from "./interact-for-package-name" import { interactForPackageNameWithVersion } from "./interact-for-package-name-with-version" import { interactForPackageReleaseId } from "./interact-for-package-release-id" import { interactForRegistryUrl } from "./interact-for-registry-url" +import { interactForRuntime } from "./interact-for-runtime" import { ParamHandler } from "./param-handler-type" export const PARAM_HANDLERS_BY_PARAM_NAME: Record = { @@ -12,6 +13,7 @@ export const PARAM_HANDLERS_BY_PARAM_NAME: Record = { cwd: interactForLocalDirectory, dir: interactForLocalDirectory, registry_url: interactForRegistryUrl, + runtime: interactForRuntime, package_release_id: interactForPackageReleaseId, package_name: interactForPackageName, package_name_with_version: interactForPackageNameWithVersion, diff --git a/lib/param-handlers/interact-for-runtime.ts b/lib/param-handlers/interact-for-runtime.ts new file mode 100644 index 00000000..ddf0735d --- /dev/null +++ b/lib/param-handlers/interact-for-runtime.ts @@ -0,0 +1,33 @@ +import kleur from "kleur" +import { ParamHandler } from "./param-handler-type" +import $ from "dax-sh" + +export const interactForRuntime: ParamHandler = async (params) => { + const { prompts, ctx } = params + + const bunVersion = await $`bun --version`.text().catch((e) => null) + + if (!bunVersion) { + console.log( + kleur.red(`BUN IS NOT INSTALLED! Install bun first https://bun.sh/`) + ) + } + + const { runtime } = await prompts({ + type: "select", + name: "runtime", + message: "Select a runtime", + choices: [ + { + title: "bun", + value: "bun", + description: bunVersion + ? `bun version: ${bunVersion}` + : "NOTE: bun not installed, install bun first!", + }, + { title: "node", value: "node" }, + ], + }) + + return runtime +} diff --git a/lib/soupify.ts b/lib/soupify.ts index 54d89443..3b192f9e 100644 --- a/lib/soupify.ts +++ b/lib/soupify.ts @@ -6,13 +6,16 @@ import { unlink } from "node:fs/promises" import kleur from "kleur" import { writeFileSync } from "fs" -export const soupify = async ({ - filePath, - exportName, -}: { - filePath: string - exportName?: string -}) => { +export const soupify = async ( + { + filePath, + exportName, + }: { + filePath: string + exportName?: string + }, + ctx: { runtime: "node" | "bun" } +) => { const tmpFilePath = Path.join( Path.dirname(filePath), Path.basename(filePath).replace(/\.[^\.]+$/, "") + ".__tmp_entrypoint.tsx" @@ -44,7 +47,9 @@ console.log(JSON.stringify(elements)) `.trim() ) - const processResult = await $`npx tsx ${tmpFilePath}` + const runtime = ctx.runtime === "node" ? "npx tsx" : "bun" + + const processResult = await $`${runtime} ${tmpFilePath}` .stdout("piped") .stderr("piped") .noThrow() diff --git a/lib/util/app-context.ts b/lib/util/app-context.ts index 3f0ae299..f0d105c7 100644 --- a/lib/util/app-context.ts +++ b/lib/util/app-context.ts @@ -10,4 +10,5 @@ export type AppContext = { registry_url: string axios: AxiosInstance current_profile: string + runtime: "node" | "bun" } & ContextConfigProps diff --git a/lib/util/create-context-and-run-program.ts b/lib/util/create-context-and-run-program.ts index 3d989b87..17673b40 100644 --- a/lib/util/create-context-and-run-program.ts +++ b/lib/util/create-context-and-run-program.ts @@ -103,6 +103,7 @@ export const createContextAndRunProgram = async (process_args: any) => { axios, global_config, profile_config, + runtime: global_config.get("runtime") ?? "node", args: { cmd: args._, yes: args.y ?? args.yes, diff --git a/package-lock.json b/package-lock.json index 919af464..91761d8f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,18 +1,18 @@ { "name": "@tscircuit/cli", - "version": "0.0.24", + "version": "0.0.35", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@tscircuit/cli", - "version": "0.0.24", + "version": "0.0.35", "license": "ISC", "dependencies": { "@edge-runtime/primitives": "^4.1.0", "@hono/node-server": "^1.8.2", - "@tscircuit/builder": "^1.5.4", - "@tscircuit/react-fiber": "^1.0.6", + "@tscircuit/builder": "^1.5.9", + "@tscircuit/react-fiber": "^1.0.9", "axios": "^1.6.7", "better-sqlite3": "^9.4.3", "chokidar": "^3.6.0", @@ -33,7 +33,7 @@ "minimist": "^1.2.8", "node-persist": "^4.0.1", "open": "^10.1.0", - "perfect-cli": "^1.0.16", + "perfect-cli": "^1.0.19", "prompts": "^2.4.2", "react": "^18.2.0", "semver": "^7.6.0", @@ -693,13 +693,13 @@ } }, "node_modules/@tscircuit/builder": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/@tscircuit/builder/-/builder-1.5.5.tgz", - "integrity": "sha512-e7hfRFCX0jOK+Sk5irjF/L+6j++NuALR2333eipKBALjrxI7IAa0Lf3RvWjyUXVHaRYEWBYb7JaBS5luVRxtNw==", + "version": "1.5.11", + "resolved": "https://registry.npmjs.org/@tscircuit/builder/-/builder-1.5.11.tgz", + "integrity": "sha512-cj7foHXP2pz2G7zOwqQcIS8AJDVwLvebqA9jzLRWkk4T0opoMHQNYdjz4wKMLJO5/itDFeusrIPi5HmBD38d7A==", "dependencies": { "@lume/kiwi": "^0.1.0", "@tscircuit/eagle-xml-converter": "^0.0.7", - "@tscircuit/routing": "^1.3.0", + "@tscircuit/routing": "^1.3.1", "@tscircuit/sparkfun-packages": "^1.0.3", "convert-units": "^2.3.4", "minisearch": "^6.1.0", @@ -719,9 +719,9 @@ } }, "node_modules/@tscircuit/react-fiber": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@tscircuit/react-fiber/-/react-fiber-1.0.6.tgz", - "integrity": "sha512-wfoOpCiom2xfTpiYrIALRer9lxHfTLuH0eW2CFA4Yv3UuJHEkvAo9YH+mUYfXH6j77jX5lwRelpWff9DVF2VhQ==", + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tscircuit/react-fiber/-/react-fiber-1.0.11.tgz", + "integrity": "sha512-gba9mtp4qiDo7gtX/o9hXaYEC+Rfnbl/Gbc7DJSAHRLTJ7pwqpCkkSxVe8mD7qSPhBDhNPzsmEnfN7wMWN/rtQ==", "dependencies": { "lodash": "^4.17.21", "react-reconciler": "^0.29.0" @@ -732,9 +732,9 @@ } }, "node_modules/@tscircuit/routing": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@tscircuit/routing/-/routing-1.3.0.tgz", - "integrity": "sha512-XK10xNyTEr18S4kYpZrWPyPI1oqnmFbyfhWqY7nmoRwV/FKaxk7k+rc0lPyunXa5L6wp2ZbGlHuUoovOcgzvUw==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@tscircuit/routing/-/routing-1.3.1.tgz", + "integrity": "sha512-DQRAFvk3uikRMbeOTWnNAdoSVdStx9o8UZhvh6pcoqxJsx4RKWg8d9ssycm2v7wzyg8rjjUPJUpymgkJQtBPpA==", "dependencies": { "pathfinding": "^0.4.18", "react-error-boundary": "^4.0.11" @@ -4334,9 +4334,9 @@ } }, "node_modules/perfect-cli": { - "version": "1.0.16", - "resolved": "https://registry.npmjs.org/perfect-cli/-/perfect-cli-1.0.16.tgz", - "integrity": "sha512-sId5YotMMaFgp7H4gZTqf2jG4+uaTtCZYkq2J1cfRLtK4c+TdUtEBs/+OcTCd4aXMZyetdG8Xd8CkgDZDhmzhQ==", + "version": "1.0.19", + "resolved": "https://registry.npmjs.org/perfect-cli/-/perfect-cli-1.0.19.tgz", + "integrity": "sha512-KvVgrMCFaUC9V95xJjywb/P85SZmO6GEIEZnw96XK75b1nv6s1C2D4SXeZLw7a+Gb7UuGQ6P2o3zrpKneWAaEQ==", "dependencies": { "commander": "^12.0.0", "minimist": "^1.2.8", diff --git a/package.json b/package.json index 25f54da8..c3233f9f 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,10 @@ "start:dev-server:dev": "TSCI_DEV_SERVER_DB=$(pwd)/.tscircuit/dev-server.db concurrently 'cd dev-server-api && bun start' 'cd dev-server-frontend && bun start'", "start:dev-server": "bun build:dev-server && bun cli.ts dev -y --cwd ./tests/assets/example-project", "build:dev-server": "cd dev-server-api && bun run build && cd ../dev-server-frontend && bun run build", + "build:dev-server:api": "cd dev-server-api && bun run build", "build:cli": "bun build-cli.ts", "build": "bun build:dev-server && npm run build:cli", + "dev-with-test-project": "bun cli.ts dev --cwd ./tests/assets/example-project", "test:init": "bun cli.ts init --dir ./tmp/test --name test" }, "bin": { @@ -54,7 +56,7 @@ "minimist": "^1.2.8", "node-persist": "^4.0.1", "open": "^10.1.0", - "perfect-cli": "^1.0.16", + "perfect-cli": "^1.0.19", "prompts": "^2.4.2", "react": "^18.2.0", "semver": "^7.6.0",