diff --git a/bun.lockb b/bun.lockb index 962f859..380842b 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/elysia-0.7.0-exp.0.tgz b/elysia-0.7.0-exp.0.tgz index 32e937f..980bc26 100644 Binary files a/elysia-0.7.0-exp.0.tgz and b/elysia-0.7.0-exp.0.tgz differ diff --git a/package.json b/package.json index 243ccc6..caa1c05 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "type": "module", "scripts": { "dev": "concurrently \"bun run --hot src/main.ts\" \"bun run uno:dev\" \"bun run liveReload\"", - "liveReload": "bun run src/beth/liveReload.ts", + "liveReload": "bunx beth-stack", "start": "bun run uno && bun run src/main.ts", "db:push": "bunx drizzle-kit push:sqlite", "db:studio": "bunx drizzle-kit studio", @@ -12,7 +12,8 @@ "uno": "bunx unocss", "uno:dev": "bunx unocss --watch", "typecheck": "bunx --bun tsc", - "cli": "bunx beth-stack foo bar" + "cli": "bunx beth-stack foo bar", + "reset-cache": "rm -rf /home/whatplan/.bun/install/cache && rm -rf node_modules && bun i" }, "devDependencies": { "@kitajs/ts-html-plugin": "^1.0.1", @@ -30,12 +31,12 @@ "@libsql/client": "0.3.5-pre.4", "@lucia-auth/adapter-sqlite": "^2.0.0", "@t3-oss/env-core": "^0.6.1", + "beth-stack": "0.0.13", "drizzle-orm": "^0.28.6", "drizzle-typebox": "^0.1.1", "elysia": "./elysia-0.7.0-exp.0.tgz", "lucia": "^2.6.0", "pino-pretty": "^10.2.0", - "zod": "^3.22.2", - "beth-stack": "0.0.3" + "zod": "^3.22.2" } } diff --git a/src/beth/liveReload.ts b/src/beth/liveReload.ts deleted file mode 100644 index 454faed..0000000 --- a/src/beth/liveReload.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Elysia } from "elysia"; -import { type ElysiaWS } from "elysia/ws"; - -let wsConnections = new Set>(); - -function dispatch() { - wsConnections.forEach((connection) => { - console.log("sending refresh"); - connection.send("refresh"); - }); -} - -const app = new Elysia() - .ws("/ws", { - open(ws) { - // console.log("open"); - wsConnections.add(ws); - }, - close(ws) { - // console.log("close"); - wsConnections.delete(ws); - }, - message(ws, message) { - // console.log("message", message); - }, - }) - .get("/restart", () => { - // console.log("recieved restart"); - dispatch(); - }) - .listen(3001); - -console.log( - `🦊 Livereload running ${app.server?.hostname}:${app.server?.port}` -); diff --git a/src/components/base.tsx b/src/components/base.tsx index 17484ed..660adaf 100644 --- a/src/components/base.tsx +++ b/src/components/base.tsx @@ -1,6 +1,11 @@ import { type PropsWithChildren } from "beth-stack/jsx"; +import { liveReloadScript } from "beth-stack/dev"; +import { htmxExtensionScript } from "beth-stack"; import { config } from "../config"; +const safeScript = + config.env.NODE_ENV === "development" ? liveReloadScript() : ""; + export const BaseHtml = ({ children }: PropsWithChildren) => ( @@ -8,58 +13,14 @@ export const BaseHtml = ({ children }: PropsWithChildren) => ( THE BETH STACK - + - + {children}