Commit ed665b2
authored
fix(vercel-api): send nowConfig and projectSettings to honor vercel.json (#350)
* docs(track): add build-exit-255-20260423
Track for issue #336 (build.sh exits with 255 on v42.2.0). Root cause
confirmed via source comparison of @vercel/client@17.2.65 and
vercel@50.0.0: VercelApiClient does not send nowConfig or
projectSettings in the deployment body, so the server never sees the
user's vercel.json buildCommand and falls back to framework
auto-detection.
Refs #336
* chore(track): build-exit-255-20260423 구현 시작
* feat(project-config): add readVercelJson to load vercel.json from working directory
Reads vercel.json from the resolved working directory, returns parsed
object on success, null when absent, and throws a clear error naming
the file on invalid JSON.
Part of #336 — v42.2.0 API deployment does not send nowConfig, so the
server never sees the user's buildCommand. This is the first building
block toward restoring CLI parity.
* feat(project-config): add readNodeVersion to read engines.node from package.json
Reads package.json from the resolved working directory and returns
engines.node as a string when present, or undefined otherwise. Mirrors
vercel@50.0.0 CLI behavior at packages/cli/src/commands/deploy/index.ts:541-558.
Unreadable or malformed package.json returns undefined rather than
throwing, because the field is an optional hint for projectSettings
and should not fail the whole deployment.
Part of #336.
* feat(project-config): add buildProjectConfig to assemble nowConfig and projectSettings
Produces the { nowConfig, projectSettings } subset the Vercel deployment
API expects. When vercel.json is present, its contents become nowConfig
(with images stripped). For zero-config projects (no 'builds' field) the
function also fills projectSettings.rootDirectory and
sourceFilesOutsideRootDirectory from the action's rootDirectory input.
projectSettings.nodeVersion is populated from package.json engines.node
whenever present.
This mirrors vercel@50.0.0 CLI behavior at
packages/cli/src/commands/deploy/index.ts:494-571.
Part of #336.
* fix(vercel-api): send nowConfig and projectSettings to Vercel API
Closes the CLI-parity gap introduced in v42.2.0. When deploying via the
API path, read vercel.json and package.json from the working directory
and include:
- nowConfig: full vercel.json contents (with images stripped)
- projectSettings.rootDirectory and sourceFilesOutsideRootDirectory
(zero-config projects only)
- projectSettings.nodeVersion (from package.json engines.node)
Without these fields, the Vercel server never sees the user's
buildCommand/installCommand/outputDirectory and falls back to framework
auto-detection, causing projects with custom build scripts (e.g.
./build.sh for Hugo) to fail with exit 255.
Refs vercel@50.0.0 CLI at packages/cli/src/commands/deploy/index.ts:494-571.
Fixes #336
* test(integration): verify nowConfig deployment path with vercel.json
Add two integration tests that exercise the real deploy() code path:
- Deploy a tmp project that ships vercel.json with buildCommand. Asserts
that the filesystem-read path does not crash and does not surface a
vercel.json-related error — regression guard for #336.
- Deploy with malformed vercel.json. Asserts the action fails fast with
a message naming the file (FR-5).
Also add GITHUB_REPOSITORY and GITHUB_ACTOR defaults to the integration
global-setup so the suite runs locally, not only in GitHub Actions CI
(where these are injected automatically).
* build: rebuild dist/index.js with nowConfig/projectSettings fix
Bundles the src changes from #336 into the distribution file that
GitHub Actions actually executes. Verified dist/index.js contains the
new buildProjectConfig / readVercelJson / readNodeVersion symbols.
Part of #336.
* docs(readme): note vercel.json is honored by the API deployment path
Call out the #336 fix under the API Deployment Inputs section so users
upgrading from v42.2.0 know custom buildCommand / installCommand /
outputDirectory values in vercel.json are now sent to the Vercel API.
* docs(track): mark build-exit-255-20260423 implementation tasks complete
* fix(vercel): apply review suggestions from iteration 1
- Extract applyConditionalFlags and applyProjectConfig helpers from
buildDeploymentOptions so each function stays under the 50 LOC limit
per AGENTS.md.
- Sanitize __proto__ / constructor / prototype keys from nowConfig in
addition to the existing 'images' strip. Defense-in-depth against
prototype-pollution via a crafted vercel.json, for any downstream code
that forwards nowConfig via [[Set]] semantics.
- Add regression tests: EISDIR on vercel.json path re-throws (locks the
'only ENOENT is treated as absent' contract) and __proto__ keys are
stripped from nowConfig.
- Rebuild dist/ with the refactor.
- Ignore .claude/agent-memory/ (machine-local agent state).
* chore(track): build-exit-255-20260423 PR 제출 완료
* chore(review): apply AI review suggestions from iteration 2
- README: reword version note to be version-neutral (copilot)
- project-config: guard against non-object JSON at top level of vercel.json (cubic)
- project-config test: drop toHaveProperty(__proto__) check that walks the
prototype chain; the Object.getOwnPropertyNames check covers the invariant
correctly (cubic)
- Add regression tests for array/string/number/boolean/null vercel.json
- Rebuild dist/
* chore: regenerate pnpm-lock.yaml and rebuild dist
The check-dist CI workflow failed with:
ERR_PNPM_BROKEN_LOCKFILE: expected a single document in the stream
Regenerating the lockfile from scratch with pnpm@10.15.0 produced a
slightly shorter (-226 lines) file that installs cleanly on CI. Rebuild
dist/ with the fresh node_modules to keep check-dist in sync.
* chore: trigger CI on 01260ec
* build: rebuild dist1 parent 49bc6f3 commit ed665b2
17 files changed
Lines changed: 4413 additions & 3145 deletions
File tree
- .please/docs
- tracks/completed/build-exit-255-20260423
- dist
- src
- __integration__
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
Lines changed: 147 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments