fix: bundle UI dist into server package for npm publishing

The server's static-ui mode resolves the UI dist path relative to its
own directory. In the monorepo it finds ../../ui/dist, but when published
to npm the UI package isn't available.

- server/src/app.ts: try ../ui-dist (published) then ../../ui/dist (dev),
  gracefully degrade to API-only if neither exists
- server/package.json: include ui-dist/ in published files
- scripts/release.sh: build UI and copy dist to server/ui-dist before
  publishing, clean up in restore step

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dotta
2026-03-03 15:45:45 -06:00
parent 28bf5e9e9b
commit d18312d6de
3 changed files with 26 additions and 9 deletions

View File

@@ -125,7 +125,7 @@ echo ""
echo "==> Step 4/7: Building all packages..."
cd "$REPO_ROOT"
# Build packages in dependency order (excluding UI and CLI)
# Build packages in dependency order (excluding CLI)
pnpm --filter @paperclipai/shared build
pnpm --filter @paperclipai/adapter-utils build
pnpm --filter @paperclipai/db build
@@ -133,7 +133,12 @@ pnpm --filter @paperclipai/adapter-claude-local build
pnpm --filter @paperclipai/adapter-codex-local build
pnpm --filter @paperclipai/adapter-openclaw build
pnpm --filter @paperclipai/server build
echo " ✓ All packages built"
# Build UI and bundle into server package for static serving
pnpm --filter @paperclipai/ui build
rm -rf "$REPO_ROOT/server/ui-dist"
cp -r "$REPO_ROOT/ui/dist" "$REPO_ROOT/server/ui-dist"
echo " ✓ All packages built (including UI)"
# ── Step 5: Build CLI bundle ─────────────────────────────────────────────────
@@ -183,6 +188,9 @@ if [ -f "$CLI_DIR/README.md" ]; then
rm "$CLI_DIR/README.md"
fi
# Remove UI dist bundled into server for publishing
rm -rf "$REPO_ROOT/server/ui-dist"
# Commit all changes
git add -A
git commit -m "chore: release v$NEW_VERSION"