diff --git a/.github/workflows/formatbot.yml b/.github/workflows/formatbot.yml index 1e5facd1..d386d246 100644 --- a/.github/workflows/formatbot.yml +++ b/.github/workflows/formatbot.yml @@ -25,25 +25,25 @@ jobs: with: token: ${{ steps.check_fork.outputs.is_fork == 'true' && secrets.GITHUB_TOKEN || secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }} - - name: Setup Node.js - uses: actions/setup-node@v3 + - name: Setup bun + uses: oven-sh/setup-bun@v1 with: - node-version: '20' + bun-version: latest - name: Get @biomejs/biome version id: get-biome-version run: echo "BIOME_VERSION=$(node -p "require('./package.json').devDependencies['@biomejs/biome']")" >> $GITHUB_OUTPUT - name: Install @biomejs/biome - run: npm install @biomejs/biome@${{ steps.get-biome-version.outputs.BIOME_VERSION }} + run: bun install - name: Run Formatter and autofix if: steps.check_fork.outputs.is_fork == 'false' - run: npx @biomejs/biome format . --write + run: bunx biome format . --write - name: Format Check (cannot autofix against forks) if: steps.check_fork.outputs.is_fork == 'true' - run: npx @biomejs/biome format . + run: bunx biome format . - name: Restore lock files if: steps.check_fork.outputs.is_fork == 'false' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e6166d75..51a746f7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,4 +29,4 @@ jobs: run: bun run build - name: Run tests - run: bun test + run: bun test --timeout 15000 diff --git a/bun.lockb b/bun.lockb index ece2b58e..a846aed2 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/cli/lib/cmd-fns/dev/derive-selector-from-pcb-component-id.ts b/cli/lib/cmd-fns/dev/derive-selector-from-pcb-component-id.ts index 95567dbd..884eef3e 100644 --- a/cli/lib/cmd-fns/dev/derive-selector-from-pcb-component-id.ts +++ b/cli/lib/cmd-fns/dev/derive-selector-from-pcb-component-id.ts @@ -1,4 +1,4 @@ -import type { AnySoupElement } from "@tscircuit/builder" +import type { AnySoupElement } from "@tscircuit/soup" import { su } from "@tscircuit/soup-util" export const deriveSelectorFromPcbComponentId = ({ @@ -8,7 +8,7 @@ export const deriveSelectorFromPcbComponentId = ({ soup: AnySoupElement[] pcb_component_id: string }) => { - const source_component = su(soup).source_component.getUsing({ + const source_component = su(soup as any).source_component.getUsing({ pcb_component_id, }) if (!source_component) { diff --git a/cli/lib/soupify/get-tmp-entrpoint-filepath.ts b/cli/lib/soupify/get-tmp-entrpoint-filepath.ts index 77792549..4911c49d 100644 --- a/cli/lib/soupify/get-tmp-entrpoint-filepath.ts +++ b/cli/lib/soupify/get-tmp-entrpoint-filepath.ts @@ -1,6 +1,7 @@ import Path from "node:path" +import fs from "fs/promises" -export const getTmpEntrypointFilePath = (filePath: string) => { +export const getTmpEntrypointFilePath = async (filePath: string) => { const tmpEntrypointPath = Path.resolve( Path.dirname(filePath), Path.basename(filePath).replace(/\.[^\.]+$/, "") + ".__tmp_entrypoint.tsx", @@ -9,5 +10,6 @@ export const getTmpEntrypointFilePath = (filePath: string) => { Path.dirname(filePath), Path.basename(filePath).replace(/\.[^\.]+$/, "") + ".__tmp_output.json", ) + return { tmpEntrypointPath, tmpOutputPath } } diff --git a/cli/lib/soupify/soupify-with-core.ts b/cli/lib/soupify/soupify-with-core.ts index 9a14ad0b..e06e6f37 100644 --- a/cli/lib/soupify/soupify-with-core.ts +++ b/cli/lib/soupify/soupify-with-core.ts @@ -10,6 +10,7 @@ import Debug from "debug" import { getExportNameFromFile } from "./get-export-name-from-file" import { getTmpEntrypointFilePath } from "./get-tmp-entrpoint-filepath" import { runEntrypointFile } from "./run-entrypoint-file" +import fs from "node:fs/promises" const debug = Debug("tscircuit:soupify") @@ -25,7 +26,11 @@ export const soupifyWithCore = async ( exportName ??= await getExportNameFromFile(filePath) const { tmpEntrypointPath, tmpOutputPath } = - getTmpEntrypointFilePath(filePath) + await getTmpEntrypointFilePath(filePath) + + // Remove existing entrypoint or tmp output files + await fs.unlink(tmpEntrypointPath).catch(() => {}) + await fs.unlink(tmpOutputPath).catch(() => {}) debug(`writing to ${tmpEntrypointPath}`) writeFileSync( diff --git a/cli/lib/soupify/soupify.ts b/cli/lib/soupify/soupify.ts index 6d925738..b557c32a 100644 --- a/cli/lib/soupify/soupify.ts +++ b/cli/lib/soupify/soupify.ts @@ -32,7 +32,7 @@ export const soupifyWithBuilder = async ( exportName ??= await getExportNameFromFile(filePath) const { tmpEntrypointPath, tmpOutputPath } = - getTmpEntrypointFilePath(filePath) + await getTmpEntrypointFilePath(filePath) debug(`writing to ${tmpEntrypointPath}`) writeFileSync( diff --git a/example-project/src/MyCircuit.tsx b/example-project/src/MyCircuit.tsx index 7b70f989..a2878edc 100644 --- a/example-project/src/MyCircuit.tsx +++ b/example-project/src/MyCircuit.tsx @@ -3,13 +3,7 @@ import { layout } from "@tscircuit/layout" import manual_edits from "./manual-edits" export const MyCircuit = () => ( - + .pin2", - offsets: [ - { - x: 38.92169691522466, - y: -2.3377796771400057, - via: false, - }, - { - x: 37.986379705415004, - y: -2.4045880492692646, - via: true, - }, - { - x: 35.04681133172754, - y: -2.5048006074631566, - via: true, - }, - ], - }, - { - pcb_port_selector: ".D8 > .pin2", - offsets: [ - { - x: 39.368100153443855, - y: 11.075329302388642, - via: false, - }, - { - x: 39.0431504551313, - y: -2.4100831775825498, - via: false, - }, - ], - }, - { - pcb_port_selector: ".D6 > .pin2", - offsets: [ - { - x: 27.898990889830188, - y: -7.126105014672912, - via: true, - }, - ], - }, - { - pcb_port_selector: ".D7 > .pin2", - offsets: [ - { - x: -8.911022990918022, - y: 12.104068965358355, - via: true, - }, - { - x: 31.337860341638805, - y: 8.65338014408593, - via: true, - }, - { - x: 40.284252655475, - y: 7.931249822789734, - via: false, - }, - { - x: 39.96330584601003, - y: -2.4995214848219867, - via: false, - }, - ], - }, - { - pcb_port_selector: ".SW6 > .pin1", - offsets: [ - { - x: 14.242563958561936, - y: -0.4071654915144425, - via: false, - }, - ], - }, - ], + manual_trace_hints: [], edit_events: [], } diff --git a/frontend/views/HeaderMenu.tsx b/frontend/views/HeaderMenu.tsx index 94ae76a4..acafeb71 100644 --- a/frontend/views/HeaderMenu.tsx +++ b/frontend/views/HeaderMenu.tsx @@ -294,8 +294,8 @@ export const HeaderMenu = () => { @tscircuit/cli v{cliPackageJson.version} - @tscircuit/builder v - {cliPackageJson.dependencies?.["@tscircuit/builder"]?.replace( + @tscircuit/core v + {cliPackageJson.dependencies?.["@tscircuit/core"]?.replace( /\^/g, "", )} diff --git a/package.json b/package.json index 9146ed03..8df207e1 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,6 @@ "build:dev-server": "bun run build:api && bun run build:frontend", "build:api": "cd api && winterspec bundle-routes -i ./routes -o ./static-routes.ts", "build:frontend": "vite build --config frontend/vite.config.ts && make-vfs --content-format string --dir frontend/dist --outfile ./frontend/dist/bundle.ts", - "test:init": "bun cli/cli.ts init --dir ./tmp/test --name test", - "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", "format": "biome format . --write" }, "bin": { @@ -38,11 +36,13 @@ "@edge-runtime/primitives": "^4.1.0", "@hono/node-server": "^1.8.2", "@tscircuit/builder": "*", - "@tscircuit/core": "^0.0.62", + "@tscircuit/core": "^0.0.69", "@tscircuit/props": "^0.0.62", + "@tscircuit/soup": "^0.0.71", "archiver": "^7.0.1", "axios": "^1.6.7", "chokidar": "^3.6.0", + "circuit-json-to-connectivity-map": "^0.0.16", "circuit-json-to-gerber": "^0.0.4", "circuit-to-png": "^0.0.3", "circuit-to-svg": "^0.0.22", @@ -58,7 +58,7 @@ "hono": "^4.1.0", "ignore": "^5.3.1", "json5": "^2.2.3", - "kicad-converter": "^0.0.4", + "kicad-converter": "^0.0.7", "kleur": "^4.1.5", "lodash": "^4.17.21", "memory-level": "^1.0.0", @@ -67,6 +67,7 @@ "node-persist": "^4.0.1", "open": "^10.1.0", "perfect-cli": "^1.0.20", + "performance-now": "^2.1.0", "posthog-node": "^4.0.1", "prompts": "^2.4.2", "redaxios": "^0.5.1", @@ -84,7 +85,7 @@ "@tscircuit/soup-util": "*" }, "devDependencies": { - "@biomejs/biome": "^1.9.1", + "@biomejs/biome": "^1.9.2", "@headlessui/react": "^1.7.18", "@radix-ui/react-alert-dialog": "^1.0.5", "@radix-ui/react-context-menu": "^2.1.5",