Skip to content

Commit

Permalink
Core Update, manual editing working again (#149)
Browse files Browse the repository at this point in the history
* Core Update, manual editing working again

* fix type issue

* add timeout to tests

* turn core on by default, skip builder test

* formatbot: Automatically format code

---------

Co-authored-by: tscircuitbot <[email protected]>
  • Loading branch information
seveibar and tscircuitbot authored Sep 4, 2024
1 parent 573c937 commit a751ebc
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
jobs:
tests:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Checkout code
Expand All @@ -24,7 +25,7 @@ jobs:
- name: Install dependencies
run: bun install

- name: Install dependencies
- name: Build
run: bun run build

- name: Run tests
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dist
# tests/example-init
.npmrc
*.__tmp_entrypoint.tsx
*.__tmp_output.json
*.zip

.vscode
Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion cli/lib/cmd-fns/dev/soupify-and-upload-example-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const soupifyAndUploadExampleFile = async (
{
filePath: examplePath,
exportName,
useCore: ctx.params.core,
useCore: ctx.params.noCore,
},
ctx,
)
Expand Down
4 changes: 2 additions & 2 deletions cli/lib/cmd-fns/soupify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ export const soupifyCmd = async (ctx: AppContext, args: any) => {
file: z.string(),
export: z.string().optional(),
output: z.string().optional(),
core: z.boolean().optional(),
noCore: z.boolean().optional(),
})
.parse(args)

const soup = await soupify(
{
filePath: params.file,
exportName: params.export,
useCore: params.core,
useCore: !params.noCore,
},
ctx,
)
Expand Down
4 changes: 2 additions & 2 deletions cli/lib/get-program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const getProgram = (ctx: AppContext) => {
.description("Run development server in current directory")
.option("--cwd <cwd>", "Current working directory")
.option("--port <port>", "Port to run dev server on")
.option("--core", "Use @tscircuit/core beta")
.option("--no-core", "Use @tscircuit/core beta", false)
.option("--no-cleanup", "Don't cleanup temporary files (for debugging)")
.action((args) => CMDFN.dev(ctx, args))

Expand Down Expand Up @@ -294,7 +294,7 @@ export const getProgram = (ctx: AppContext) => {
.description("Convert an example file to tscircuit soup")
.requiredOption("--file <file>", "Input example files")
.option("--output <output.json>", "Output file")
.option("--core", "Use @tscircuit/core to build (future version)")
.option("--no-core", "Use @tscircuit/core to build (future version)", false)
.option(
"--export <export_name>",
"Name of export to soupify, if not specified, soupify the default/only export",
Expand Down
6 changes: 3 additions & 3 deletions cli/tests/soupify-builder.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { test, expect, describe } from "bun:test"
import { $ } from "bun"

test("soupify (builder)", async () => {
test.skip("soupify (builder)", async () => {
const result =
await $`bun cli/cli.ts soupify -y --file ./example-project/examples/basic-chip.tsx`.text()
await $`bun cli/cli.ts soupify -y --no-core --file ./example-project/examples/basic-chip.tsx`.text()

expect(result).toContain("10kohm")
expect(result).toContain("10000")
})
2 changes: 1 addition & 1 deletion cli/tests/soupify-core.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { $ } from "bun"

test("soupify (core)", async () => {
const result =
await $`bun cli/cli.ts soupify --core -y --file ./example-project/examples/basic-chip.tsx`.text()
await $`bun cli/cli.ts soupify -y --file ./example-project/examples/basic-chip.tsx`.text()

expect(result).toContain("10000") // R1 resistor value
})
3 changes: 2 additions & 1 deletion example-project/examples/basic-chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { layout } from "@tscircuit/layout"
import manual_edits from "../src/manual-edits"

export const BasicChip = () => (
<board pcbCenterX={0} pcbCenterY={0} width="20mm" height="20mm">
<board pcbX={0} pcbY={0} width="20mm" height="20mm">
<group
subcircuit
layout={layout()
.autoLayoutSchematic()
.manualPcbPlacement(manual_edits.pcb_placements)}
Expand Down
4 changes: 2 additions & 2 deletions example-project/src/MyCircuit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export const MyCircuit = () => (
<board
width="40mm"
height="40mm"
pcbCenterX={0}
pcbCenterY={0}
pcbX={0}
pcbY={0}
layout={layout().manualEdits(manual_edits)}
>
<resistor
Expand Down
8 changes: 4 additions & 4 deletions example-project/src/manual-edits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ export default {
_edit_event_id: "0.6668756126702717",
selector: ".U2",
center: {
x: -5.004250626566417,
y: 0.13319298245614064,
x: -5.830346475507767,
y: -1.3620071684587813,
},
relative_to: "group_center",
},
{
_edit_event_id: "0.867524742177592",
selector: ".R1",
center: {
x: 2.8351077694235585,
y: 0,
x: 3.679808841099163,
y: 3.6320191158900847,
},
relative_to: "group_center",
},
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"start": "bun cli/cli.ts",
"dev": "bun run build:dev-server && concurrently 'bun run dev:frontend' 'bun run dev:test-project'",
"dev:frontend": "vite dev --config frontend/vite.config.ts",
"dev:test-project": "bun --hot cli/cli.ts dev --core --cwd ./example-project",
"dev:test-project": "bun --hot cli/cli.ts dev --no-cleanup --core --cwd ./example-project",
"start:dev-server": "bun build:dev-server && bun cli/cli.ts dev -y --cwd ./example-project",
"build": "bun build:dev-server && npm run build:cli",
"build:cli": "bun scripts/build-cli.ts",
Expand All @@ -36,6 +36,7 @@
"@edge-runtime/primitives": "^4.1.0",
"@hono/node-server": "^1.8.2",
"@tscircuit/builder": "*",
"@tscircuit/props": "^0.0.52",
"@tscircuit/core": "0.0.29",
"@tscircuit/react-fiber": "*",
"archiver": "^7.0.1",
Expand Down

0 comments on commit a751ebc

Please sign in to comment.