Skip to content

[client] Add inlined file deployment for small HTML-only projects#15034

Open
janory wants to merge 4 commits intomainfrom
feat/cli-inline-file-deployment
Open

[client] Add inlined file deployment for small HTML-only projects#15034
janory wants to merge 4 commits intomainfrom
feat/cli-inline-file-deployment

Conversation

@janory
Copy link
Contributor

@janory janory commented Feb 12, 2026

Summary

  • Adds support for inlined file deployments when the source directory contains only HTML files (fewer than 10)
  • Files are sent directly in the deployment API request body instead of being uploaded separately to /v2/files
  • This optimization reduces deployment latency for simple static HTML sites

Changes

  • packages/client/src/utils/index.ts:

    • Extended PreparedFile interface with data and encoding fields
    • Added shouldUseInlineFiles() function to detect when inline deployment should be used
    • Modified prepareFiles() to conditionally include file content
  • packages/client/src/deploy.ts: Added debug logging when using inline deployment

  • packages/client/src/index.ts: Exported shouldUseInlineFiles for external use

  • packages/client/tests/unit.utils.test.ts: Added comprehensive unit tests

Test plan

  • Verify unit tests pass for shouldUseInlineFiles() and prepareFiles()
  • Test deployment with a directory containing < 10 HTML files only
  • Test deployment with mixed file types (should use SHA upload)
  • Test deployment with >= 10 HTML files (should use SHA upload)
  • Verify debug output shows "Using inlined file deployment" when applicable

🤖 Generated with Claude Code

Note

Low Risk Change

This PR adds a performance optimization for small HTML-only deployments by inlining file content in the API request, with no security or authorization changes.

  • New shouldUseInlineFiles() function checks for <10 HTML-only files
  • Modified prepareFiles() to conditionally include file data with utf-8 encoding
  • Comprehensive unit tests added for inline file detection and preparation

Risk assessment for commit 8e5a6ae.

When deploying a directory that contains only HTML files (fewer than 10),
the files are now sent inline with the deployment API request instead of
being uploaded separately. This optimizes deployment for simple static
HTML sites by eliminating separate file upload requests.

Changes:
- Add `data` and `encoding` fields to PreparedFile interface
- Add `shouldUseInlineFiles()` helper to check inline conditions
- Modify `prepareFiles()` to include file content when conditions are met
- Add debug logging for inline file deployments
- Export `shouldUseInlineFiles` from client package
- Add comprehensive unit tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@janory janory requested review from a team as code owners February 12, 2026 19:49
@changeset-bot
Copy link

changeset-bot bot commented Feb 12, 2026

🦋 Changeset detected

Latest commit: 8e5a6ae

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@vercel/client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

📦 CLI Tarball Ready

The Vercel CLI tarball for this PR is now available!

Quick Test

You can test this PR's CLI directly by running:

npx https://vercel-pq6zvnols.vercel.sh/tarballs/vercel.tgz --help

Use in vercel.json

To use this CLI version in your project builds, add to your vercel.json:

{
  "build": {
    "env": {
      "VERCEL_CLI_VERSION": "vercel@https://vercel-pq6zvnols.vercel.sh/tarballs/vercel.tgz"
    }
  }
}

@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

🧪 Unit Test Strategy

Comparing: b4cce9c8e5a6ae (view diff)

Strategy: Affected packages only

✅ Only testing packages that have been modified or depend on modified packages.

Affected packages - 40 (100%)
  1. @vercel-internals/get-package-json
  2. @vercel/backends
  3. @vercel/build-utils
  4. @vercel/cervel
  5. @vercel/cli-auth
  6. @vercel/client
  7. @vercel/config
  8. @vercel/detect-agent
  9. @vercel/edge
  10. @vercel/elysia
  11. @vercel/error-utils
  12. @vercel/express
  13. @vercel/fastify
  14. @vercel/firewall
  15. @vercel/frameworks
  16. @vercel/fs-detectors
  17. @vercel/functions
  18. @vercel/gatsby-plugin-vercel-builder
  19. @vercel/go
  20. @vercel/h3
  21. @vercel/hono
  22. @vercel/hydrogen
  23. @vercel/koa
  24. @vercel/nestjs
  25. @vercel/next
  26. @vercel/node
  27. @vercel/oidc
  28. @vercel/oidc-aws-credentials-provider
  29. @vercel/python
  30. @vercel/python-analysis
  31. @vercel/redwood
  32. @vercel/related-projects
  33. @vercel/remix-builder
  34. @vercel/routing-utils
  35. @vercel/ruby
  36. @vercel/rust
  37. @vercel/static-build
  38. @vercel/static-config
  39. examples
  40. vercel

Results

  • Unit tests: Only affected packages will run unit tests
  • E2E tests: Running in parallel via E2E Tests workflow
  • Type checks: Only affected packages will run type checks

This comment is automatically generated based on the affected testing strategy

janory and others added 2 commits February 12, 2026 20:53
The Vercel API rejects additional properties on inlined files.
Inlined files should only have: file, data, encoding.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add inlined file deployment for small HTML-only projects.
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.

2 participants