refactor: migrate monorepo from pnpm to Bun runtime and workspaces
- root: bun workspaces via package.json, packageManager bun@1.4.0, scripts use bun --filter - backend: Bun.serve, bun test (vitest removed), bun --watch dev script, tsconfig types bun - tests: migrate 6 test files from vitest to bun:test (mock.module) - validate: replace @hono/zod-validator with hono validator + zod safeParse (fixes TS2589) - lockfile: bunfig.toml saveTextLockfile, regenerated bun.lock (text) for turbo - docs: AGENTS.md, README.md, stack.md updated to Bun stack
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import 'dotenv/config';
|
||||
import { serve } from '@hono/node-server';
|
||||
import app from '@/app';
|
||||
import { getPrismaClient } from '@/lib/prisma';
|
||||
import { logger } from '@/logger';
|
||||
@@ -8,22 +6,13 @@ const port = Number(process.env.PORT ?? 4000);
|
||||
|
||||
logger.info(`Server running on http://localhost:${port}`);
|
||||
|
||||
const server = serve({
|
||||
fetch: app.fetch,
|
||||
const server = Bun.serve({
|
||||
port,
|
||||
fetch: app.fetch,
|
||||
});
|
||||
|
||||
async function shutdown(): Promise<void> {
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
server.close((error) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
server.stop(true);
|
||||
await getPrismaClient().$disconnect();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user