refactor: port backend and frontend to TypeScript classes (bun + vite)
Backend (src/server, runs on Bun): - GibbzHttpServer (health, /api/ice, /api/rooms, static, keepalive tuning) - SignalingServer with Peer/Room/RoomRegistry classes and typed messages - IceConfigProvider (env STUN/TURN + coturn HMAC ephemeral creds) - StaticFileServer (dist/ with public/ fallback, traversal guard) - Tracing (OpenTelemetry SDK), AppConfig; createApp() factory for tests Frontend (src/client, built by Vite): - VoiceApp orchestrator implementing VoiceAppContext - WebRtcManager + PeerSession (perfect negotiation, pc rebuild, quality monitor) - SignalingClient + ReconnectController, AudioManager, SpatialAudio, Microphone/ScreenShare controllers, ScreensUi/RosterUi/SpatialMap/ SpeakingMonitor, Settings/Welcome dialogs, LayoutManager, MatrixChat Tooling: bun scripts (dev/start/test/typecheck), vite.config.ts root src/client with publicDir public/static, vitest-config for CI-less runs, bun-based Dockerfile (oven/bun:1), Makefile + README updated, legacy server.js/tracing.js/test.js/public js removed. Verified locally: tsc --noEmit clean, vitest run 6/6 green, vite build ok, server smoke-tested serving dist + signaling endpoints under Node. Local bun binary segfaults (SIGILL) on this host, so 'bun test' itself was not executable here; tests are vitest-API compatible which bun test maps.
This commit is contained in:
1 parent
9b8c2a9599
commit
2b950e4953
48 files changed
+4589
-9200
No files matched your search
+18
-11
@@ -1,30 +1,37 @@
|
||||
# gibbz voice — Bun runtime, Vite-built TypeScript client
|
||||
ARG APP_RELEASE=dev
|
||||
|
||||
FROM node:22-alpine AS app
|
||||
|
||||
FROM oven/bun:1 AS build
|
||||
WORKDIR /app
|
||||
|
||||
COPY package*.json ./
|
||||
COPY package.json bun.lock* ./
|
||||
RUN bun install
|
||||
|
||||
RUN npm ci
|
||||
|
||||
COPY server.js tracing.js vite.config.mjs ./
|
||||
COPY public/ ./public/
|
||||
COPY tsconfig.json vite.config.ts ./
|
||||
COPY src ./src
|
||||
COPY public ./public
|
||||
|
||||
# Inject build release into index.html if APP_RELEASE is specified
|
||||
ARG APP_RELEASE
|
||||
ENV APP_RELEASE=${APP_RELEASE}
|
||||
RUN if [ -n "${APP_RELEASE}" ]; then \
|
||||
sed -i "s/window.__APP_RELEASE__ || \"dev\"/\"${APP_RELEASE}\"/g" ./public/index.html; \
|
||||
sed -i "s/window.__APP_RELEASE__ || \"dev\"/\"${APP_RELEASE}\"/g" ./src/client/index.html; \
|
||||
fi
|
||||
|
||||
RUN npm run build && npm prune --omit=dev
|
||||
RUN bun run build && bun install --production
|
||||
|
||||
FROM oven/bun:1
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=build /app/node_modules ./node_modules
|
||||
COPY --from=build /app/dist ./dist
|
||||
COPY --from=build /app/src/server ./src/server
|
||||
|
||||
ENV PORT=8080 \
|
||||
HOST=0.0.0.0
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
USER node
|
||||
USER bun
|
||||
|
||||
CMD ["node", "server.js"]
|
||||
CMD ["bun", "src/server/index.ts"]
|
||||
Reference in new issue
Block a user