Skip to content

refactor: migrate example configs from vercel.json to vercel.ts - #300

Merged
amondnet merged 9 commits into
masterfrom
amondnet/button-front
Mar 26, 2026
Merged

refactor: migrate example configs from vercel.json to vercel.ts#300
amondnet merged 9 commits into
masterfrom
amondnet/button-front

Conversation

@amondnet

@amondnet amondnet commented Mar 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replaced deprecated vercel.json files with vercel.ts using plain objects (no external imports) in 3 example projects (express-basic-auth, nextjs, static)
  • For the Angular example, replaced vercel.ts with src/vercel.json so Angular's build system copies it into dist/angular/ (the deployed directory); updated angular.json assets accordingly
  • Replaced deprecated github.enabled: false with git.deploymentEnabled: false
  • Updated README.md to document vercel.ts as the recommended approach alongside vercel.json
  • Updated documentation links to current Vercel docs

Changes

  • example/angular/src/vercel.json (new, replaces root-level vercel.ts; listed in angular.json assets so it is copied to dist/angular/ on build)
  • example/angular/angular.json updated: assets reference changed from stale src/now.json to src/vercel.json
  • example/express-basic-auth/vercel.ts (new, replaces vercel.json; uses plain objects, no @vercel/config dependency)
  • example/nextjs/vercel.ts (new, replaces vercel.json; uses plain objects)
  • example/static/vercel.ts (new, replaces vercel.json; uses plain objects)
  • README.md updated with vercel.ts examples and current API references

Test Plan

  • Verify example projects still link correctly in README
  • Confirm Angular build copies src/vercel.json into dist/angular/
  • Check that deprecated github.enabled references are fully removed

⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

- 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
Copilot AI review requested due to automatic review settings March 26, 2026 02:31
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 vercel.json format to the recommended vercel.ts TypeScript configuration. This change improves type safety and maintainability, while also updating deprecated settings and ensuring documentation reflects the latest Vercel practices.

Highlights

  • Configuration Migration: Migrated vercel.json files to vercel.ts using @vercel/config/v1 in four example projects (angular, express-basic-auth, nextjs, static).
  • Documentation Update: Updated README.md to document vercel.ts as the recommended approach and reflect current Vercel API references.
  • Deprecated Property Replacement: Replaced the deprecated github.enabled: false with git.deploymentEnabled: false for disabling Vercel for GitHub.

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions

github-actions Bot commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Deploy preview for express-basic-auth ready!

✅ Preview
https://express-basic-auth-7a0ql1vwx-minsu-lees-projects-b1e388b7.vercel.app

Built with commit 210caa4.
This pull request is being automatically deployed with vercel-action

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread example/angular/vercel.ts Outdated
Comment thread example/angular/vercel.ts Outdated
Comment thread README.md

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts programmatic config files for the Angular, Express basic-auth, Next.js, and static examples.
  • Removed legacy vercel.json configs from those examples.
  • Updated README documentation and links, including replacing deprecated github.enabled with git.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.

Comment thread example/express-basic-auth/vercel.ts Outdated
Comment thread example/angular/vercel.ts Outdated
Comment thread example/angular/vercel.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Loading

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread example/static/vercel.ts Outdated
Comment thread example/express-basic-auth/vercel.ts Outdated
Comment thread README.md
Comment thread example/angular/vercel.ts Outdated
Comment thread example/angular/vercel.ts Outdated
Comment thread example/angular/vercel.ts Outdated
@github-actions

github-actions Bot commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Deploy preview for team-scope-test ready!

✅ Preview
https://team-scope-test-jfgniov8g-dietfriends.vercel.app

Built with commit 210caa4.
This pull request is being automatically deployed with vercel-action

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 2 files (changes from recent commits).

Requires human review: Auto-approval blocked by 4 unresolved issues from previous reviews.

- 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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread example/angular/vercel.ts Outdated
amondnet and others added 2 commits March 26, 2026 11:53
…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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 1 file (changes from recent commits).

Auto-approved: This PR is limited to documentation updates and example configuration migrations (JSON to TS) within the examples directory, posing no risk to core logic.

…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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 1 file (changes from recent commits).

Auto-approved: This is a low-risk PR focused on documentation updates and modernizing example project configurations to align with current Vercel standards. It does not touch core business logic.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread example/express-basic-auth/package.json Outdated
Comment thread example/nextjs/package.json Outdated
Comment thread example/angular/package.json Outdated
- 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
@sonarqubecloud

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 3 files (changes from recent commits).

Auto-approved: Documentation and example configuration updates to support modern Vercel standards (vercel.ts). Low risk, only affects examples and docs.

@amondnet
amondnet merged commit 6011ab6 into master Mar 26, 2026
8 of 14 checks passed
@amondnet
amondnet deleted the amondnet/button-front branch March 26, 2026 03:58
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.

3 participants