From b0207842e683849e39bdd709550c057ac0b6daa4 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 22 Oct 2026 04:19:34 +0000 Subject: [PATCH 1/2] Add a Vercel config for importing packages/web as the project root Vercel detects the root Dockerfile and packages/web as two apps and steers the import toward its multi-service mode, which this static demo doesn't need. With Root Directory set to packages/web the project is a single Vite app; its vercel.json runs the demo build from the repo root and rewrites /api/graph to the pre-built graph. The build was run from that directory to confirm dist/ holds the UI and graph.json. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01ENHRK3kgqcVwqwyjswRViM --- docs/DEPLOY.md | 11 +++++++---- packages/web/vercel.json | 8 ++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 packages/web/vercel.json diff --git a/docs/DEPLOY.md b/docs/DEPLOY.md index bcfe58a..4e94827 100644 --- a/docs/DEPLOY.md +++ b/docs/DEPLOY.md @@ -17,12 +17,15 @@ tag. ## Vercel (recommended: static, free) The demo needs no server: `npm run build:demo` builds the UI and indexes the demo repo into a static `graph.json`, -and `vercel.json` routes the UI's `/api/graph` request to it. +and `packages/web/vercel.json` routes the UI's `/api/graph` request to it. (The root `vercel.json` does the same for +an import with Root Directory `.`, which Vercel's multi-service detection can get in the way of.) 1. Sign in at with GitHub. The free Hobby plan is enough. -2. Click **Add New → Project**, import `harsharajkumar-273/CodeGraph` and click **Deploy**. Leave every setting as - it is; `vercel.json` provides the install command, build command and output folder. -3. Vercel prints a `https://.vercel.app` URL. Every push to `main` redeploys it. +2. Click **Add New → Project** and import `harsharajkumar-273/CodeGraph`. +3. Vercel detects two apps (the `Dockerfile` and `packages/web`) and offers a multi-service import. Don't use it. + Set **Root Directory** to `packages/web` instead, so it is imported as one Vite project. Its `vercel.json` + supplies the install command, build command and output folder, so leave those alone, and click **Deploy**. +4. Vercel prints a `https://.vercel.app` URL. Every push to `main` redeploys it. To show a different repo, set `DEMO_REPO` (a git URL) and `DEMO_REF` (a branch or tag) under **Settings → Environment Variables**, then redeploy. To try the static build locally, run `npm run build:demo` and serve diff --git a/packages/web/vercel.json b/packages/web/vercel.json new file mode 100644 index 0000000..7c77a2e --- /dev/null +++ b/packages/web/vercel.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://openapi.vercel.sh/vercel.json", + "framework": null, + "installCommand": "cd ../.. && npm ci", + "buildCommand": "cd ../.. && npm run build:demo", + "outputDirectory": "dist", + "rewrites": [{ "source": "/api/graph", "destination": "/graph.json" }] +} From 04c6987ae4e9b43238167a24b18529e79fbf5cc3 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 22 Oct 2026 04:25:48 +0000 Subject: [PATCH 2/2] Make the Vercel build work from packages/web Vercel ran the root vercel.json's `npm run build:demo` with the working directory at packages/web, where that script didn't exist. Remove the root vercel.json so packages/web/vercel.json is the only Vercel config, and add a build:demo script to packages/web that delegates to the root one, so the command works from either directory. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01ENHRK3kgqcVwqwyjswRViM --- docs/DEPLOY.md | 4 ++-- packages/web/package.json | 2 +- vercel.json | 8 -------- 3 files changed, 3 insertions(+), 11 deletions(-) delete mode 100644 vercel.json diff --git a/docs/DEPLOY.md b/docs/DEPLOY.md index 4e94827..fab68e1 100644 --- a/docs/DEPLOY.md +++ b/docs/DEPLOY.md @@ -17,8 +17,8 @@ tag. ## Vercel (recommended: static, free) The demo needs no server: `npm run build:demo` builds the UI and indexes the demo repo into a static `graph.json`, -and `packages/web/vercel.json` routes the UI's `/api/graph` request to it. (The root `vercel.json` does the same for -an import with Root Directory `.`, which Vercel's multi-service detection can get in the way of.) +and `packages/web/vercel.json` routes the UI's `/api/graph` request to it. This is the only Vercel config, so +Root Directory must be `packages/web`. 1. Sign in at with GitHub. The free Hobby plan is enough. 2. Click **Add New → Project** and import `harsharajkumar-273/CodeGraph`. diff --git a/packages/web/package.json b/packages/web/package.json index 7701eab..c8bcb9c 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "type": "module", "private": true, - "scripts": { "dev": "vite", "build": "vite build", "preview": "vite preview" }, + "scripts": { "dev": "vite", "build": "vite build", "preview": "vite preview", "build:demo": "cd ../.. && npm run build:demo" }, "dependencies": { "@codegraph/analysis": "*", "@codegraph/core": "*", diff --git a/vercel.json b/vercel.json deleted file mode 100644 index e7a1e47..0000000 --- a/vercel.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "$schema": "https://openapi.vercel.sh/vercel.json", - "framework": null, - "installCommand": "npm ci", - "buildCommand": "npm run build:demo", - "outputDirectory": "packages/web/dist", - "rewrites": [{ "source": "/api/graph", "destination": "/graph.json" }] -}