refactor: migrate example configs from vercel.json to vercel.ts - #300
Conversation
- Replace deprecated vercel.json with vercel.ts using @vercel/config/v1 in all 4 examples - Update README.md to recommend vercel.ts alongside vercel.json - Replace deprecated github.enabled with git.deploymentEnabled - Update documentation links to current Vercel docs
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request modernizes the Vercel configuration across several example projects by transitioning from the older Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
Deploy preview for express-basic-auth ready! ✅ Preview Built with commit 210caa4. |
There was a problem hiding this comment.
Code Review
This pull request updates the Vercel configuration documentation in README.md to use the git.deploymentEnabled property instead of the deprecated github.enabled, and introduces vercel.ts as the recommended configuration method. It also migrates several example projects from vercel.json to vercel.ts. The review highlights critical issues in the example/angular/vercel.ts file's rewrites configuration, which could lead to broken static asset loading and an infinite loop. A high-severity issue was also found in the headers configuration order in the same file, causing incorrect cache control. A medium-severity suggestion was made to improve consistency in the README.md's vercel.json example.
There was a problem hiding this comment.
Pull request overview
Migrates the example projects’ Vercel project configuration from deprecated vercel.json files to vercel.ts (using @vercel/config/v1), and updates the README to recommend vercel.ts plus the new git.deploymentEnabled setting.
Changes:
- Added
vercel.tsprogrammatic config files for the Angular, Express basic-auth, Next.js, and static examples. - Removed legacy
vercel.jsonconfigs from those examples. - Updated README documentation and links, including replacing deprecated
github.enabledwithgit.deploymentEnabled.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| example/static/vercel.ts | New TS config for static example (replaces removed JSON). |
| example/static/vercel.json | Removed legacy JSON config for static example. |
| example/nextjs/vercel.ts | New TS config for Next.js example (includes git.deploymentEnabled). |
| example/nextjs/vercel.json | Removed legacy JSON config using deprecated github.enabled. |
| example/express-basic-auth/vercel.ts | New TS config for basic-auth example using functions/rewrites helpers. |
| example/express-basic-auth/vercel.json | Removed legacy JSON config with builds/routes. |
| example/angular/vercel.ts | New TS config for Angular example with headers/rewrites helpers. |
| example/angular/src/vercel.json | Removed legacy JSON config from Angular example. |
| README.md | Documents vercel.ts alongside vercel.json, updates settings and links. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
6 issues found across 9 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="example/express-basic-auth/vercel.ts">
<violation number="1" location="example/express-basic-auth/vercel.ts:3">
P2: Missing `git: { deploymentEnabled: false }` — the angular and nextjs examples include it, and the README documents it as required to prevent Vercel from auto-deploying alongside this GitHub Action. Without it, this example will trigger duplicate deployments.</violation>
</file>
<file name="example/static/vercel.ts">
<violation number="1" location="example/static/vercel.ts:3">
P1: Missing `git: { deploymentEnabled: false }` — the old `vercel.json` had `github.enabled: false` which was supposed to be migrated (per the PR description and the pattern used in the angular/nextjs examples). Without it, the static example will have Vercel's automatic GitHub deployments enabled, conflicting with the GitHub Action workflow.</violation>
</file>
<file name="README.md">
<violation number="1" location="README.md:97">
P2: The `vercel.json` example is missing `"public": false`, which the equivalent `vercel.ts` example above includes. Since both are presented as interchangeable options for the same configuration, they should set the same properties.</violation>
</file>
<file name="example/angular/vercel.ts">
<violation number="1" location="example/angular/vercel.ts:16">
P2: Header rule ordering issue: the catch-all `/(.**)` rule is listed last and will override the asset-specific `Cache-Control` for paths like `/assets/style.css`. When multiple header rules match the same path, Vercel uses the value from the **last** matching rule for conflicting keys. Move the catch-all rule to the top so that more-specific rules listed after it take precedence.</violation>
<violation number="2" location="example/angular/vercel.ts:21">
P2: `routes.rewrite('/robots.txt', '/robots.txt')` maps the source to the same destination, making it a no-op. Since Vercel checks the filesystem before applying rewrites, a static `robots.txt` file will be served directly without needing this rule. Remove this rewrite to avoid confusion.</violation>
<violation number="3" location="example/angular/vercel.ts:22">
P2: `/favicon.ico` is rewritten to `/favicon.txt`, which looks like a typo carried over from the original `vercel.json`. Browsers expect an image file for the favicon, and no `favicon.txt` exists in this project. This should likely rewrite to `/favicon.ico` (identity, like the robots.txt rule) or be removed entirely.</violation>
</file>
Architecture diagram
sequenceDiagram
participant Dev as Developer
participant VercelTS as vercel.ts (Config)
participant VercelLib as @vercel/config/v1
participant VercelEngine as Vercel Build Engine
participant Git as GitHub Integration
Note over Dev,VercelLib: Configuration Phase
Dev->>VercelTS: NEW: Define programmatic configuration
VercelTS->>VercelLib: NEW: Import VercelConfig types
VercelTS->>VercelLib: NEW: Use routes.rewrite() / routes.header() helpers
VercelLib-->>VercelTS: Return structured config objects
Note over VercelTS,VercelEngine: Deployment/Runtime Phase
VercelEngine->>VercelTS: CHANGED: Load configuration (replaces vercel.json)
VercelTS-->>VercelEngine: Return exported 'config' object
alt NEW: git.deploymentEnabled is false
Git->>VercelEngine: Webhook: Push event
VercelEngine->>VercelEngine: Check git.deploymentEnabled flag
VercelEngine-->>Git: Ignore event (Skip automatic deployment)
else git.deploymentEnabled is true
Git->>VercelEngine: Webhook: Push event
VercelEngine->>VercelEngine: Trigger build/deployment
end
Note over VercelEngine: Request Handling
VercelEngine->>VercelEngine: Apply rewrites & headers from config
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
Deploy preview for team-scope-test ready! ✅ Preview Built with commit 210caa4. |
- Fix header rule ordering in angular vercel.ts (catch-all first, specific last) - Remove no-op robots.txt rewrite rule - Fix favicon.ico rewrite destination typo (txt -> ico) - Add "public": false to vercel.json example in README
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="example/angular/vercel.ts">
<violation number="1" location="example/angular/vercel.ts:21">
P2: Removing the `/robots.txt` identity rewrite means requests for `robots.txt` will now fall through to the catch-all `/(.*) → /index.html` rewrite, serving the Angular SPA instead of the actual robots file. This breaks SEO crawlability. The original identity rewrite existed to short-circuit the catch-all for this specific file.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
…rride Without the identity rewrite, requests for robots.txt fall through to the catch-all rewrite and serve index.html instead of the static file, breaking SEO crawlability.
…r config placement - Remove runtime `routes` import from express-basic-auth/vercel.ts; use plain rewrite object - Remove `import type VercelConfig` from nextjs and static vercel.ts files for consistency - Replace example/angular/vercel.ts (root) with src/vercel.json so Angular copies it to dist/angular/ during build (the deployed directory) - Update angular.json assets from stale src/now.json to src/vercel.json Co-authored-by: amondnet <1964421+amondnet@users.noreply.github.com> Agent-Logs-Url: https://github.com/amondnet/vercel-action/sessions/8059a005-9fad-4cfe-b31f-59bf1b0ab64f
…r config placement - Remove runtime 'routes' import from express-basic-auth/vercel.ts; use plain rewrite objects - Remove 'import type VercelConfig' from nextjs and static vercel.ts for consistency - Replace example/angular/vercel.ts with src/vercel.json so Angular copies it to dist/angular/ - Update angular.json assets from stale src/now.json to src/vercel.json - Incorporate robots.txt identity rewrite from upstream fix
There was a problem hiding this comment.
3 issues found across 3 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="example/express-basic-auth/package.json">
<violation number="1" location="example/express-basic-auth/package.json:17">
P2: Unnecessary `@vercel/config` dependency — it is never imported in `vercel.ts` (which uses plain objects with no type annotations). If the intent is to get type-checking via `import type`, the import should be added to `vercel.ts`; otherwise remove this dependency.
Additionally, `"latest"` is an unpinned version specifier that can break builds non-deterministically. If the package is kept, pin it to a specific version.</violation>
</file>
<file name="example/nextjs/package.json">
<violation number="1" location="example/nextjs/package.json:18">
P2: `@vercel/config` is added as a dependency but is never imported anywhere in this example project. The `vercel.ts` file exports a plain object with no imports. This adds a needless install and contradicts the PR description ("uses plain objects, no `@vercel/config` dependency"). Additionally, `"latest"` as a version specifier makes the dependency non-reproducible.
Remove this unused dependency.</violation>
</file>
<file name="example/angular/package.json">
<violation number="1" location="example/angular/package.json:46">
P2: `@vercel/config` is an unused dependency here. The Angular example uses `src/vercel.json` (plain JSON), not `vercel.ts`, and no file in the example imports from `@vercel/config`. It also uses the `"latest"` version tag, which makes builds non-reproducible. Remove this dependency.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
- express-basic-auth: vercel.ts uses plain objects, no imports needed - nextjs: vercel.ts uses plain objects, no imports needed - angular: now uses src/vercel.json (plain JSON), no vercel.ts imports
|



Summary
vercel.jsonfiles withvercel.tsusing plain objects (no external imports) in 3 example projects (express-basic-auth, nextjs, static)vercel.tswithsrc/vercel.jsonso Angular's build system copies it intodist/angular/(the deployed directory); updatedangular.jsonassets accordinglygithub.enabled: falsewithgit.deploymentEnabled: falseREADME.mdto documentvercel.tsas the recommended approach alongsidevercel.jsonChanges
example/angular/src/vercel.json(new, replaces root-levelvercel.ts; listed inangular.jsonassets so it is copied todist/angular/on build)example/angular/angular.jsonupdated: assets reference changed from stalesrc/now.jsontosrc/vercel.jsonexample/express-basic-auth/vercel.ts(new, replacesvercel.json; uses plain objects, no@vercel/configdependency)example/nextjs/vercel.ts(new, replacesvercel.json; uses plain objects)example/static/vercel.ts(new, replacesvercel.json; uses plain objects)README.mdupdated withvercel.tsexamples and current API referencesTest Plan
src/vercel.jsonintodist/angular/github.enabledreferences are fully removed⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.