fix startup

This commit is contained in:
Corey Johnson 2025-06-16 10:34:19 -07:00
parent 8cf11f6613
commit 49cce47f4c
5 changed files with 8 additions and 5 deletions

View File

@ -3,4 +3,4 @@ import { spawn } from "bun"
const run = (cmd: string[]) => spawn(cmd, { stdout: "inherit", stderr: "inherit" }).exited
await Promise.all([run(["bun", "http"]), run(["bun", "bot:discord"])])
await Promise.all([run(["bun", "bot:discord"]), run(["bun", "http"])])

View File

@ -9,7 +9,7 @@
"semi": false
},
"scripts": {
"http": "bun run --filter=@the-rabbit-hole/http dev",
"http": "bun run --filter=@the-rabbit-hole/http start",
"bot:cli": "bun run --filter=@the-rabbit-hole/spike bot:cli",
"bot:discord": "bun run --filter=@the-rabbit-hole/spike bot:discord",
"start": "bun run main.ts"

View File

@ -4,7 +4,8 @@
"type": "module",
"private": true,
"scripts": {
"dev": "bun run --hot src/server"
"dev": "bun run --hot src/server",
"start": "bun run src/server"
},
"prettier": {
"printWidth": 110,

View File

@ -2,7 +2,7 @@ import { serve } from "bun"
import { nanoRemix } from "@the-rabbit-hole/nano-remix"
import { join } from "node:path"
serve({
const server = serve({
routes: {
"/*": (req) => nanoRemix(req, { routesDir: join(import.meta.dir, "routes") }),
},
@ -12,3 +12,5 @@ serve({
console: true,
},
})
console.log(`🤖 Server running at ${server.url}`)

View File

@ -82,7 +82,7 @@ const writeStore = (store: Record<string, any>): void => {
}
const getStorePath = (): string => {
const rootDir = join(import.meta.dir, "..")
const rootDir = process.env.DATA_DIR ?? join(import.meta.dir, "..")
const store = join(rootDir, "data/kv.json")
return store
}