Repository navigation
feat(cli): vercel output directory override and relaxed output validator - #695
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
blove
temporarily deployed
to
vercel-preview
September 17, 2026 05:37 — with
GitHub Actions
Inactive
blove
enabled auto-merge (squash)
September 17, 2026 15:19
blove
force-pushed
the
blove/sharp-morse-002d21
branch
from
September 17, 2026 16:26
251fdbd to
b2807f5
Compare
blove
temporarily deployed
to
vercel-preview
September 17, 2026 16:30 — with
GitHub Actions
Inactive
blove
force-pushed
the
blove/sharp-morse-002d21
branch
from
September 17, 2026 16:41
b2807f5 to
e2bab84
Compare
blove
temporarily deployed
to
vercel-preview
September 17, 2026 17:14 — with
GitHub Actions
Inactive
The vercel target always published to <appRoot>/.vercel/output, and validateVercelOutput rejected any config.json that was not the exact catch-all the build writes, so composing the runtime function with static assets or further functions meant mutating the published tree after the build without the validator's help. - `b4 build --out-dir <dir>` and `build.vercel.outDir` choose where the Build Output tree is published, resolved relative to the app root, flag over config. A directory that contains the app root is rejected before anything is written, and `--out-dir` without a configured vercel target is an error. - The generated runtime still stages inside the app root so its imports resolve, while the output tree stages beside its destination so publication stays a same-device rename. - validateVercelOutput now asserts config.json is version 3 and contains a route whose dest is /index, accepting extra routes and top-level keys. Closes #680 Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
…olver `build.vercel` gained a second option on main (reconcileVercelJson) with a resolver that rejects unknown keys, so an `outDir` read straight off the config would have been refused as an authoring error. Route it through the same resolver instead: it validates the value and `b4 build` honors what the resolver returned, so the validated shape and the honored value cannot diverge — the property that resolver exists to hold. Rejects a non-string outDir, a blank one that would resolve to the app root, and the key misplaced directly on `build`. `b4 check` applies the same gate. Co-Authored-By: Claude Opus 5 <[email protected]>
blove
force-pushed
the
blove/sharp-morse-002d21
branch
from
September 17, 2026 17:29
e2bab84 to
0328779
Compare
blove
temporarily deployed
to
vercel-preview
September 17, 2026 17:36 — with
GitHub Actions
Inactive
blove
added a commit
that referenced
this pull request
Sep 17, 2026
Integrates #695 (vercel outDir + relaxed output validator), which landed on the same files: - functionName joins outDir and reconcileVercelJson in the shared build.vercel resolver. - The relaxed validator asserted a route reaching a hardcoded /index; it now takes the resolved function name, so a composed config.json is still checked against the function the build actually wrote. - The emitter derives both the staged and published function directories from the name, on top of #695's outDir staging. - Docs and the config path inventory carry all three options. Co-Authored-By: Claude Opus 5 <[email protected]>
14 of 16 tasks
blove
added a commit
that referenced
this pull request
Sep 17, 2026
#695 landed two things this guide needed: - `build.vercel.outDir` / `b4 build --out-dir <dir>`, with the flag winning over the config value, app-root-relative resolution, the rejection of a directory containing the app root, and the error when vercel is not a configured target; - a relaxed output validator. `config.json` now needs version 3 and a route reaching `/index` rather than the exact catch-all, and extra routes and top-level keys are accepted. Together those turn the frontend-composition section from a list of workarounds into a supported flow: stage the runtime tree elsewhere, assemble into `.vercel/output`, and a composed config still validates. The section now says so, and says plainly that the validator runs on what the target stages rather than on what an assembler produces, and that renaming the function off `dest: "/index"` makes the final config the author's responsibility. Also records that the generated stores import `@b4run/postgres-storage/node`, which reaches `pg` through that package's own dependency so an app never declares `pg` itself — the one real gap raised by the session that owns #698. cli.mdx conflicted and takes main's bullet, which covers outDir and the relaxed validator, with a link to this page appended. Co-Authored-By: Claude Opus 5 <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #680. Sibling of #679 (composition of static assets, extra functions and routes), which this does not attempt; it only makes room for it.
What changed
Output directory override.
b4 build --out-dir <dir>andbuild.vercel.outDirinb4.config.tschoose where theverceltarget publishes its Build Output tree. Both resolve relative to the app root; the flag wins over config for one run. Default is unchanged (.vercel/output), and the vercel-native lane's expectations are untouched..,.., the root itself, or an ancestor) is rejected before typegen or any target emits, because publication replaces the directory wholesale.--out-dirwithout"vercel"inbuild.targetsis an error rather than a silent no-op.<appRoot>/.vercel/.b4-vercel-<id>/so its imports resolve from the app'snode_modules; only the output tree stages beside its destination, so publication stays a same-device rename. For the default location both share one invocation directory, as before. Cleanup removes both and reports whichever failed.publishVercelOutputnow takes the explicitoutputDirand parks the prior output beside it.Relaxed validator.
validateVercelOutputasserts thatconfig.jsonis version 3 and thatroutesis an array of objects containing a route whosedestis/index, instead of requiring the exact single catch-all. Extra routes ({ handle: "filesystem" }, static fallbacks, other functions) and extra top-level keys (overrides,images, …) are accepted. The function directory checks (.vc-config.jsonexact match, self-contained bundle, no escaping symlinks or dependencies) are unchanged.Tests
packages/cli/test/vercel-target.test.ts:Vercel output directory overrideblock: config override, flag-over-config with prior output replaced, absolute directory outside the app root with no staging left behind,--out-dirwithout the target, and the three app-root-containing rejectionsconfig.json(static route, filesystem handle, api function route,check,overrides,images) validates; missing runtime route, routes without any function destination, non-arrayroutes, and a non-object route entry each fail at the precise location; the two "extra property" rejections are gone by designDocs:
b4 buildreference gains the flag and averceltarget bullet;configuration.mdxdocumentsbuild.vercel.outDirand the docs schema inventory inscripts/check-docs.mjsregisters the new paths. Changeset: patch for@b4run/cliand@b4run/core.Verified locally:
pnpm build, CLItypecheck(covers tests),lintfor cli and core,node scripts/check-docs.mjs,vercel-target+vercel-native-lane+build-targetstest files (525 tests), and the full CLI suite.🤖 Generated with Claude Code