diff --git a/.github/workflows/bun-formatcheck.yml b/.github/workflows/bun-formatcheck.yml new file mode 100644 index 0000000..2d36363 --- /dev/null +++ b/.github/workflows/bun-formatcheck.yml @@ -0,0 +1,26 @@ +# Created using @tscircuit/plop (npm install -g @tscircuit/plop) +name: Format Check + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + format-check: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup bun + uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + + - name: Install dependencies + run: bun install + + - name: Run format check + run: bun run format:check diff --git a/biome.json b/biome.json index d400c1d..a36ffa9 100644 --- a/biome.json +++ b/biome.json @@ -8,7 +8,15 @@ "indentStyle": "space" }, "files": { - "ignore": ["cosmos-export", "dist", "package.json"] + "ignore": [ + "cosmos-export", + "dist", + "package.json", + "static-server", + "frontend-dist", + ".vercel", + ".vscode" + ] }, "javascript": { "formatter": { diff --git a/module/lib/solver-utils/getObstaclesFromCircuitJson.ts b/module/lib/solver-utils/getObstaclesFromCircuitJson.ts index f4d95c2..41564ba 100644 --- a/module/lib/solver-utils/getObstaclesFromCircuitJson.ts +++ b/module/lib/solver-utils/getObstaclesFromCircuitJson.ts @@ -55,8 +55,7 @@ export const getObstaclesFromCircuitJson = (soup: AnySoupElement[]) => { connectedTo: [], }) } - } - else if (element.type === "pcb_hole") { + } else if (element.type === "pcb_hole") { if (element.hole_shape === "oval") { obstacles.push({ // @ts-ignore @@ -80,6 +79,17 @@ export const getObstaclesFromCircuitJson = (soup: AnySoupElement[]) => { height: element.hole_diameter, connectedTo: [], }) + } else if (element.hole_shape === "round") { + obstacles.push({ + type: "rect", + center: { + x: element.x, + y: element.y, + }, + width: element.hole_diameter, + height: element.hole_diameter, + connectedTo: [], + }) } } else if (element.type === "pcb_plated_hole") { if (element.shape === "circle") { @@ -108,7 +118,10 @@ export const getObstaclesFromCircuitJson = (soup: AnySoupElement[]) => { }) } } else if (element.type === "pcb_trace") { - const traceObstacles = getObstaclesFromRoute(element.route, element.source_trace_id!) + const traceObstacles = getObstaclesFromRoute( + element.route, + element.source_trace_id!, + ) obstacles.push(...traceObstacles) } } diff --git a/package.json b/package.json index 3504954..12e9b44 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "build:cli": "tsup ./module/cli.ts --dts --sourcemap --out-dir ./dist", "build-and-serve": "npm run build && bun --hot module/cli.ts server start", "format": "biome format --write .", + "format:check": "biome format .", "build:static": "bun run build && bun scripts/build-static.ts", "build:infgrid-ijump-astar": "tsup-node ./algos/infinite-grid-ijump-astar/v2/index.ts -d ./algos/infinite-grid-ijump-astar/dist --format esm --dts --sourcemap" },