Skip to content

feat(deploy): opt-in build step — --build / --no-build / interactive ask - #587

Merged
davidsu merged 3 commits into
mainfrom
feat/deploy-build
Aug 3, 2026
Merged

feat(deploy): opt-in build step — --build / --no-build / interactive ask#587
davidsu merged 3 commits into
mainfrom
feat/deploy-build

Conversation

@davidsu

@davidsu davidsu commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Note

Description

base44 deploy and base44 site deploy can now run the site's buildCommand before uploading, so a deploy no longer silently ships a stale bundle. Interactive runs ask "Build the site first?", and the new --build / --no-build flags pre-answer that prompt (--build is the only way to opt in non-interactively). The build reuses the same runSiteBuild helper as base44 build, so VITE_BASE44_APP_ID is injected, a failing build aborts the deploy, and an explicit --build errors out instead of silently doing nothing when no site.buildCommand is configured.

Related Issue

None — follow-up to base44 build (#586).

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Other (please describe):

Changes Made

  • Added maybeBuildBeforeDeploy() to cli/commands/project/site-build.ts — a single entry point both deploy commands call. It no-ops when no app is linked; an explicit --build always delegates to runSiteBuild (which throws ConfigNotFoundError with a hint when site.buildCommand is missing, so the flag is never silently ignored); otherwise it only considers building when site.outputDirectory is configured and asks via shouldAskToBuild() (no prompt, and no build, when there is no buildCommand, when non-interactive, or when the prompt is cancelled).
  • Wired the step into project/deploy.ts (after the deploy summary) and site/deploy.ts (before the archive/upload task).
  • Registered --build / --no-build on both commands. Commander folds these into one build option, so an absent flag stays undefined and keeps the interactive prompt.
  • Both deploy actions now receive the full CLIContext instead of destructuring it, since the helper needs ctx.app, ctx.runTask, and ctx.isNonInteractive.
  • eject.ts passes build: false to its internal auto-deploy so ejecting never prompts or rebuilds.
  • Tests: new deploy --build suite in tests/cli/build.spec.ts covering --build, --no-build, flag-absent-in-non-interactive, site deploy --build, a failing build aborting the deploy, and --build failing on projects with no buildCommand / no site config.
  • Fixtures: with-buildable-site and with-failing-build gained an outputDirectory plus a site-output/index.html so the deploy path is reachable.
  • CHANGELOG entry under Added.

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (npm test)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have updated docs/ (AGENTS.md) if I made architectural changes

Additional Notes

The build decision lives in the CLI layer because it owns the prompt, matching the existing rule that core/ stays UI-free. Two behaviours worth a reviewer's eye: in non-interactive mode a missing flag means no build, so CI pipelines must pass --build explicitly to get one; and --build is deliberately strict — it fails the deploy when there is nothing to build, rather than falling through to the upload.


🤖 Generated by Claude | 2026-08-03 12:23 UTC | 7ed9b75

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.1.7-pr.587.7ed9b75

Prefer not to change any import paths? Install using npm alias so your code still imports base44:

npm i "base44@npm:@base44-preview/cli@0.1.7-pr.587.7ed9b75"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.1.7-pr.587.7ed9b75"
  }
}

Preview published to npm registry — try new features instantly!

@davidsu
davidsu force-pushed the feat/deploy-build branch from 7d4258a to 3d2b3d9 Compare August 3, 2026 07:43
@davidsu
davidsu changed the base branch from feat/base44-build-command to main August 3, 2026 07:56
base44 deploy and base44 site deploy can build the site before uploading:
an interactive run asks, --build / --no-build pre-answer, and
non-interactive runs default to upload-only so CI behavior is unchanged.
The build logic moves from build.ts into site-build.ts, shared by the
command and both deploy call sites (same gate shape in both). eject
opts out explicitly — its deploy already follows a fresh build.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@davidsu
davidsu force-pushed the feat/deploy-build branch from 3d2b3d9 to 1e137fd Compare August 3, 2026 11:29
Comment thread packages/cli/src/cli/commands/project/site-build.ts Outdated
Comment thread packages/cli/src/cli/commands/project/deploy.ts Outdated
yardend-wix
yardend-wix previously approved these changes Aug 3, 2026
Both deploy call sites carried the identical gate → ask → build block;
maybeBuildBeforeDeploy(ctx, project, build) is now the one copy.
Review feedback from #587.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…build

--build states intent; silently uploading without building betrays it.
The flag is now honored before any site-config gate, so a missing
site.buildCommand (or a project with no site at all) fails with the
existing ConfigNotFoundError instead of no-opping. The silent paths —
no flag, --no-build, non-interactive — are unchanged, and the ask still
only appears when a buildCommand exists. Review feedback from #587.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@davidsu
davidsu merged commit 6bbdf4e into main Aug 3, 2026
16 checks passed
@davidsu
davidsu deleted the feat/deploy-build branch August 3, 2026 12:34
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