Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
Change Start Script for api server to use bun (#61)
Browse files Browse the repository at this point in the history
* change start script but broke api server (now having json errors)

* upgrade winterspec, fixing the compat serving issue

* update bun lockfiles
  • Loading branch information
seveibar authored Jul 4, 2024
1 parent 9d0614b commit 9092d3a
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 11 deletions.
Binary file modified bun.lockb
Binary file not shown.
Binary file modified dev-server-api/bun.lockb
Binary file not shown.
6 changes: 3 additions & 3 deletions dev-server-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"main": "dist/bundle.ts",
"type": "module",
"scripts": {
"start": "edgespec dev --port 3021",
"build": "edgespec bundle -o dist/bundle.ts"
"start": "bun server.ts",
"build": "echo 'nothing to do'"
},
"devDependencies": {
"@types/better-sqlite3": "^7.6.9",
Expand All @@ -18,7 +18,7 @@
"better-sqlite3": "^11.0.0",
"kysely": "^0.27.3",
"kysely-bun-sqlite": "^0.3.2",
"winterspec": "0.0.79",
"winterspec": "^0.0.80",
"zod": "^3.22.4"
}
}
10 changes: 9 additions & 1 deletion dev-server-api/server.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import { createFetchHandlerFromDir } from "winterspec/adapters/node"
import { Request as EdgeRuntimeRequest } from "@edge-runtime/primitives"

const serverFetch = await createFetchHandlerFromDir("./routes")

console.log("starting dev-server-api on localhost:3021")
Bun.serve({
fetch: (req) => serverFetch(req),
fetch: (bunReq) => {
const req = new EdgeRuntimeRequest(bunReq.url, {
headers: bunReq.headers,
method: bunReq.method,
body: bunReq.body,
})
return serverFetch(req as any)
},
port: 3021,
})
Binary file modified dev-server-frontend/bun.lockb
Binary file not shown.
5 changes: 3 additions & 2 deletions dev-server-frontend/src/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ export const Header = () => {
<TabsTrigger value="3d">3D</TabsTrigger>
</TabsList>
</Tabs>
<Button
{/* Button is only relevant when the "Split" button is available */}
{/* <Button
variant="outline"
disabled={viewMode !== "split"}
className="ml-1 group"
Expand All @@ -47,7 +48,7 @@ export const Header = () => {
}}
>
<RotateCounterClockwiseIcon className="scale-x-[-1] group-hover:rotate-[30deg] transition-transform" />
</Button>
</Button> */}
</div>
</div>
)
Expand Down
6 changes: 3 additions & 3 deletions dev-server-frontend/src/hooks/use-global-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { persist } from "zustand/middleware"
export interface GlobalState {
active_dev_example_package_id: string | null

view_mode: "schematic" | "pcb" | "split" | "soup"
view_mode: "schematic" | "pcb" | "split" | "soup" | "3d"
split_mode: "horizontal" | "vertical"
in_debug_mode: boolean

Expand Down Expand Up @@ -37,6 +37,6 @@ export const useGlobalStore = create<GlobalState>()(
}),
{
name: "global-store",
}
)
},
),
)
4 changes: 2 additions & 2 deletions tests/assets/example-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"update-deps": "bun add -f @tscircuit/builder@latest @tscircuit/react-fiber@latest @tscircuit/layout@latest"
},
"dependencies": {
"@tscircuit/builder": "1.5.134",
"@tscircuit/layout": "^0.0.21",
"@tscircuit/builder": "^1.5.134",
"@tscircuit/layout": "^0.0.24",
"@tscircuit/react-fiber": "^1.1.29"
}
}

0 comments on commit 9092d3a

Please sign in to comment.