-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from tscircuit/schematic-traces
checkpoint schematic traces, v0.0.1, publishing and test workflows
- Loading branch information
Showing
17 changed files
with
220 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Created using @tscircuit/plop (npm install -g @tscircuit/plop) | ||
name: Publish to npm | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup bun | ||
uses: oven-sh/setup-bun@v1 | ||
with: | ||
bun-version: latest | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
registry-url: https://registry.npmjs.org/ | ||
- run: npm install -g pver | ||
- run: bun install --frozen-lockfile | ||
- run: bun run build | ||
- run: pver release | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Created using @tscircuit/plop (npm install -g @tscircuit/plop) | ||
name: Bun Test | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup bun | ||
uses: oven-sh/setup-bun@v1 | ||
with: | ||
bun-version: latest | ||
|
||
- name: Install dependencies | ||
run: bun install | ||
|
||
- name: Run tests | ||
run: bun test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
export { Board } from "./lib/components/normal-components/Board" | ||
export { Project } from "./lib/Project" | ||
export { Resistor } from "./lib/components/normal-components/Resistor" | ||
export * from "./lib/index" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
export type SimplifiedPcbTrace = { | ||
type: "pcb_trace" | ||
pcb_trace_id: string | ||
route: Array<{ | ||
route_type: "wire" | "via" | ||
x: number | ||
y: number | ||
width: number | ||
layer: string | ||
}> | ||
} | ||
export type Obstacle = { | ||
// TODO include ovals | ||
type: "rect" // NOTE: most datasets do not contain ovals | ||
center: { x: number; y: number } | ||
width: number | ||
height: number | ||
connectedTo: string[] | ||
} | ||
|
||
export interface SimpleRouteConnection { | ||
name: string | ||
pointsToConnect: Array<{ x: number; y: number }> | ||
} | ||
|
||
export interface SimpleRouteJson { | ||
layerCount: number | ||
obstacles: Obstacle[] | ||
connections: Array<SimpleRouteConnection> | ||
bounds: { minX: number; maxX: number; minY: number; maxY: number } | ||
} | ||
|
||
// declare module "autorouting-dataset" { | ||
// export type Obstacle = SimpleRouteJson["obstacles"][number] | ||
// export type SimpleRouteConnection = SimpleRouteJson["connections"][number] | ||
// export type SimplifiedPcbTrace = SimpleRouteJson["connections"][number] | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import type { Obstacle } from "./SimpleRouteJson" | ||
|
||
export const computeObstacleBounds = (obstacles: Array<Obstacle>) => { | ||
const minX = Math.min(...obstacles.map((o) => o.center.x)) | ||
const maxX = Math.max(...obstacles.map((o) => o.center.x)) | ||
const minY = Math.min(...obstacles.map((o) => o.center.y)) | ||
const maxY = Math.max(...obstacles.map((o) => o.center.y)) | ||
|
||
return { minX, maxX, minY, maxY } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export const projectPointInDirection = ( | ||
point: { x: number; y: number }, | ||
direction: "up" | "down" | "left" | "right", | ||
distance: number, | ||
) => { | ||
switch (direction) { | ||
case "up": | ||
return { x: point.x, y: point.y - distance } | ||
case "down": | ||
return { x: point.x, y: point.y + distance } | ||
case "left": | ||
return { x: point.x - distance, y: point.y } | ||
case "right": | ||
return { x: point.x + distance, y: point.y } | ||
default: | ||
throw new Error(`Unknown direction "${direction}"`) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters