patties build
Produce a production artifact in outDir (default .patties/ → dist/ for the deploy adapter), tailored to the configured target.
Purpose
Produce a production artifact in outDir (default .patties/ → dist/ for the deploy adapter), tailored to the configured target.
Usage
patties build [--target bun|edge] [--out <dir>] [--cwd <path>] [--config <path>]
Behavior
- Load config (06).
--targetoverridesconfig.target. Allowed values:bun,edge.cloudflare/vercel/ etc. are deploy plugin concerns, not build targets. - Invoke the framework
build()(04) withmode: "production". - Run the target's adapter
emitstep (12). Foredge, this produces a portabledist/worker.js. Any installed deploy plugin'sonBuildEndhook then emits vendor-specific config (wrangler.toml,vercel.json, etc.). - Generate
AGENTS.md(11) at the project root. - Print a build summary:
- Time taken.
- Output dir.
- Bundle sizes per chunk (gzipped, computed via
Bun.gzipSync). - Number of routes, islands, agents, tools, jobs.
- List of deploy-plugin artifacts emitted (if any).
- Exit 0 on success, 1 on any build error.
Determinism
- Same source tree → identical core outputs. Vendor-specific config files emitted by deploy plugins may include timestamps (
compatibility_dateetc.); the coredist/worker.jsis byte-identical across re-runs. AGENTS.mdmust be byte-identical across re-runs with no source change.
Acceptance criteria
patties build --target edgeproducesdist/worker.js,dist/assets/, andAGENTS.md.- With
@patties/deploy-cloudflareinstalled, the same command also producesdist/wrangler.toml. - A failed user route compile yields a non-zero exit and a diagnostic naming the file and line.
- The summary always prints, even on partial failure (best-effort).
patties build --target nodeis rejected at config-validation time (Node is not a target).