@@ -7,20 +7,33 @@ set -euo pipefail
77# - api/[[...route]].js is committed to the repo (Vercel detects it pre-build)
88# - esbuild bundles server/index.ts → api/_handler.js (self-contained bundle)
99# - The committed .js wrapper re-exports from _handler.js at runtime
10+ # - Studio SPA is built and copied to public/ for serving the UI
1011#
1112# Steps:
12- # 1. Build the project with turbo
13+ # 1. Build the project with turbo (includes studio)
1314# 2. Bundle the API serverless function (→ api/_handler.js)
14- # 3. Copy native/external modules into local node_modules for Vercel packaging
15+ # 3. Copy studio dist files to public/ for UI serving
1516
1617echo " [build-vercel] Starting app-host build..."
1718
1819# 1. Build the project with turbo (from monorepo root)
20+ # This builds both app-host and studio
1921cd ../..
20- pnpm turbo run build --filter=@example/app-host
22+ pnpm turbo run build --filter=@example/app-host --filter=@objectstack/studio
2123cd examples/app-host
2224
2325# 2. Bundle API serverless function
2426node scripts/bundle-api.mjs
2527
26- echo " [build-vercel] Done. Serverless function in api/[[...route]].js → api/_handler.js"
28+ # 3. Copy studio dist files to public/ for UI serving
29+ echo " [build-vercel] Copying studio dist to public/..."
30+ rm -rf public
31+ mkdir -p public
32+ if [ -d " ../../apps/studio/dist" ]; then
33+ cp -r ../../apps/studio/dist/* public/
34+ echo " [build-vercel] ✓ Copied studio dist to public/"
35+ else
36+ echo " [build-vercel] ⚠ Studio dist not found (skipped)"
37+ fi
38+
39+ echo " [build-vercel] Done. Static files in public/, serverless function in api/[[...route]].js → api/_handler.js"
0 commit comments