fix: Build client-side JS bundle for demo page

- Add bun build step to create browser-compatible JS from TypeScript
- Update demo.html to import from /dist/index.js
- Update server to serve /dist/* for bundled modules

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-02-05 16:57:34 +00:00
parent e0b30e52ef
commit c18b84b7c9
3 changed files with 5 additions and 7 deletions

View File

@ -17,8 +17,8 @@ COPY src/encryptid ./src/encryptid
COPY public ./public
COPY tsconfig.json ./
# Build (if needed - Bun can run TS directly)
# RUN bun build ./src/encryptid/server.ts --target=bun --outdir=./dist
# Build client-side modules for browser
RUN bun build ./src/encryptid/index.ts --outdir=./src/encryptid/dist --target=browser --minify
# Production stage
FROM oven/bun:1.1-slim

View File

@ -428,11 +428,7 @@
signData,
verifySignature,
AuthLevel,
} from './index.ts';
// Import UI components (registers custom elements)
import './ui/guardian-setup.ts';
import './ui/login-button.ts';
} from '/dist/index.js';
// ========================================================================
// CAPABILITY DETECTION

View File

@ -432,6 +432,8 @@ async function generateSessionToken(userId: string, username: string): Promise<s
// Serve demo page and static assets
app.get('/demo.html', serveStatic({ path: './src/encryptid/demo.html' }));
// Serve bundled JavaScript modules
app.use('/dist/*', serveStatic({ root: './src/encryptid/' }));
app.use('/demo/*', serveStatic({ root: './src/encryptid/' }));
app.use('/static/*', serveStatic({ root: './public/' }));