Skip to content

feat(ud): Deploy to Vercel#1832

Open
Tobbe wants to merge 11 commits into
mainfrom
tobbe-feat-ud-vercel
Open

feat(ud): Deploy to Vercel#1832
Tobbe wants to merge 11 commits into
mainfrom
tobbe-feat-ud-vercel

Conversation

@Tobbe
Copy link
Copy Markdown
Member

@Tobbe Tobbe commented May 27, 2026

All the crazy workarounds needed for Vercel

@netlify
Copy link
Copy Markdown

netlify Bot commented May 27, 2026

Deploy Preview for cedarjs canceled.

Name Link
🔨 Latest commit 677b709
🔍 Latest deploy log https://app.netlify.com/projects/cedarjs/deploys/6a196103618e880008ccaacf

@github-actions github-actions Bot added this to the next-release milestone May 27, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 27, 2026

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 677b709

Command Status Duration Result
nx run-many -t build:pack --exclude create-ceda... ✅ Succeeded 2s View ↗
nx run-many -t test --minWorkers=1 --maxWorkers=4 ✅ Succeeded 1m 36s View ↗
nx run-many -t test:types ✅ Succeeded 10s View ↗
nx run-many -t build ✅ Succeeded 5s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-29 10:07:08 UTC

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 27, 2026

Greptile Summary

This PR adds Vercel deployment support for the Universal Deploy (UD) build path, working around several Vite 7 / vite-plugin-vercel integration quirks: output-directory misplacement, provider cleanup hooks wiping prior build artifacts, and environment-build ordering in the builder API.

  • buildHandler.ts: after buildCedarApp completes, the .vercel/output tree is relocated from web/.vercel/output to the project root, and web static files are manually copied as a fallback for when vite-plugin-vercel's own generateBundle hook fails to do so.
  • buildUDApiServer.ts: a backup/restore mechanism saves .vercel/output before the UD API server build and restores it afterward, preventing provider buildStart cleanup hooks from deleting the Vercel artifacts produced in the previous step.
  • buildApp.ts: an explicit pre-order buildApp hook ensures Cedar's client and api environments are built even when a third-party plugin has already marked some environments as built; a new cedar-optional-peer-deps plugin silences UNRESOLVED_IMPORT warnings for optional peer dependencies inside node_modules.
  • vite-plugin-cedar-universal-deploy.ts: entry registration is moved out of the SSR-only guard; virtual-module resolution and loading are now gated on a SSR_ENVIRONMENT_NAMES set (ssr, vercel_node, vercel_edge).
  • New tasks/vercel-tests/ e2e suite mirrors the Netlify test structure and is wired into CI.

Confidence Score: 5/5

Safe to merge; the workarounds are well-commented and isolated to the UD+Vercel build path, leaving non-Vercel and non-UD builds unaffected.

All changes are additive and guarded by existence checks. The most invasive pieces run in finally blocks and are no-ops when no Vercel plugin is present.

packages/vite/src/buildApp.ts — the cedar-optional-peer-deps plugin deserves a second look to confirm it cannot fire for browser-client builds in real projects.

Important Files Changed

Filename Overview
.github/workflows/e2e-vercel.yml New E2E workflow for Vercel deploys; creates projects but has no teardown step, and mixes stderr into the captured deploy output.
packages/cli/src/commands/build/buildHandler.ts Adds Vercel output directory relocation and static-file copy workaround after buildCedarApp; CEDAR_API_ROOT_PATH is set without a matching cleanup in this finally block.
packages/vite/src/buildApp.ts Adds an explicit pre-order buildApp hook to ensure client/api environments are built before provider plugins; also adds a global cedar-optional-peer-deps plugin that applies to all environments including the browser client.
packages/vite/src/buildUDApiServer.ts Adds backup/restore of provider output directories to prevent vite-plugin-vercel from wiping .vercel/output during the UD API server build; restore runs in finally for safety.
packages/vite/src/plugins/vite-plugin-cedar-universal-deploy.ts Refactors environment filtering to use SSR_ENVIRONMENT_NAMES set and unconditionally registers entries in the config hook so Vercel provider plugins can read them; logic is correct.
tasks/vercel-tests/vercel.test.mts New e2e tests for Vercel deployment; covers API functions, legacy handlers, and SPA shell; GraphQL test is intentionally skipped; no per-test timeouts set.
tasks/vercel-tests/vitest.config.mts Minimal Vitest config; no global testTimeout override, leaving default 5 s for all network tests.
tasks/vercel-tests/vitest.setup.mts Validates VERCEL_DEPLOY_URL and propagates it to DEPLOY_URL before tests run.
tasks/netlify-tests/netlify.test.mts Adds a 15 s timeout to the legacyHello test to prevent flakiness on slow network responses.
.github/workflows/ci.yml Wires the new e2e-vercel job into the CI pipeline and adds it to the ci-status-check dependency list.

Reviews (8): Last reviewed commit: "Merge branch 'main' into tobbe-feat-ud-v..." | Re-trigger Greptile

Comment thread .github/workflows/e2e-vercel.yml Outdated
Comment thread tasks/vercel-tests/vercel.test.mts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant