@base44-preview/cli 0.1.7-pr.588.5b5ab4e → 0.1.7-pr.588.7702fbb

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -256660,6 +256660,39 @@ async function runSiteBuild({ runTask: runTask2 }, { root, buildCommand, appId }
256660
256660
  errorMessage: "Build failed"
256661
256661
  });
256662
256662
  }
256663
+ async function maybeBuildBeforeDeploy(ctx, project2, build) {
256664
+ if (!ctx.app) {
256665
+ return;
256666
+ }
256667
+ if (build === true) {
256668
+ await runSiteBuild(ctx, {
256669
+ root: project2.root,
256670
+ buildCommand: project2.site?.buildCommand,
256671
+ appId: ctx.app.id
256672
+ });
256673
+ return;
256674
+ }
256675
+ if (build === false || !project2.site?.outputDirectory) {
256676
+ return;
256677
+ }
256678
+ const shouldBuild = await shouldAskToBuild(ctx.isNonInteractive, project2.site.buildCommand);
256679
+ if (shouldBuild) {
256680
+ await runSiteBuild(ctx, {
256681
+ root: project2.root,
256682
+ buildCommand: project2.site.buildCommand,
256683
+ appId: ctx.app.id
256684
+ });
256685
+ }
256686
+ }
256687
+ async function shouldAskToBuild(isNonInteractive, buildCommand) {
256688
+ if (!buildCommand || isNonInteractive) {
256689
+ return false;
256690
+ }
256691
+ const answer = await Re({
256692
+ message: `Build the site first? (runs '${buildCommand}' with your app id)`
256693
+ });
256694
+ return !Ct(answer) && answer;
256695
+ }
256663
256696
 
256664
256697
  // src/cli/commands/project/build.ts
256665
256698
  async function buildAction(ctx) {
@@ -256949,7 +256982,8 @@ Examples:
256949
256982
  }
256950
256983
 
256951
256984
  // src/cli/commands/project/deploy.ts
256952
- async function deployAction({ isNonInteractive, log }, options = {}) {
256985
+ async function deployAction(ctx, options = {}) {
256986
+ const { isNonInteractive, log } = ctx;
256953
256987
  if (isNonInteractive && !options.yes) {
256954
256988
  throw new InvalidInputError("--yes is required in non-interactive mode");
256955
256989
  }
@@ -256997,6 +257031,7 @@ ${summaryLines.join(`
256997
257031
  ${summaryLines.join(`
256998
257032
  `)}`);
256999
257033
  }
257034
+ await maybeBuildBeforeDeploy(ctx, project2, options.build);
257000
257035
  let functionCompleted = 0;
257001
257036
  const functionTotal = functions.length;
257002
257037
  const result = await deployAll(projectData, {
@@ -257025,7 +257060,7 @@ ${summaryLines.join(`
257025
257060
  return { outroMessage: "App deployed successfully" };
257026
257061
  }
257027
257062
  function getDeployCommand2() {
257028
- return new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(deployAction);
257063
+ return new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)").action(deployAction);
257029
257064
  }
257030
257065
  async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
257031
257066
  const needsOAuth = filterPendingOAuth(connectorResults);
@@ -257891,7 +257926,8 @@ function getSecretsCommand() {
257891
257926
 
257892
257927
  // src/cli/commands/site/deploy.ts
257893
257928
  import { resolve as resolve11 } from "node:path";
257894
- async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
257929
+ async function deployAction2(ctx, options) {
257930
+ const { isNonInteractive, runTask: runTask2 } = ctx;
257895
257931
  if (isNonInteractive && !options.yes) {
257896
257932
  throw new InvalidInputError("--yes is required in non-interactive mode");
257897
257933
  }
@@ -257914,6 +257950,7 @@ async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
257914
257950
  return { outroMessage: "Deployment cancelled" };
257915
257951
  }
257916
257952
  }
257953
+ await maybeBuildBeforeDeploy(ctx, project2, options.build);
257917
257954
  const result = await runTask2("Creating archive and deploying site...", async () => {
257918
257955
  return await deploySite(outputDir);
257919
257956
  }, {
@@ -257923,7 +257960,7 @@ async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
257923
257960
  return { outroMessage: `Visit your site at: ${result.appUrl}` };
257924
257961
  }
257925
257962
  function getSiteDeployCommand() {
257926
- return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").action(deployAction2);
257963
+ return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)").action(deployAction2);
257927
257964
  }
257928
257965
 
257929
257966
  // src/cli/commands/site/open.ts
@@ -262443,7 +262480,11 @@ async function eject(ctx, options8, command2) {
262443
262480
  successMessage: theme.colors.base44Orange("Project built successfully"),
262444
262481
  errorMessage: "Failed to build project"
262445
262482
  });
262446
- await deployAction(ctx, { yes: true, projectRoot: resolvedPath });
262483
+ await deployAction(ctx, {
262484
+ yes: true,
262485
+ build: false,
262486
+ projectRoot: resolvedPath
262487
+ });
262447
262488
  }
262448
262489
  }
262449
262490
  return { outroMessage: "Your new project is set and ready to use" };
@@ -266738,4 +266779,4 @@ export {
266738
266779
  CLIExitError
266739
266780
  };
266740
266781
 
266741
- //# debugId=E288D289EECEB6CA64756E2164756E21
266782
+ //# debugId=244E76C64D91558B64756E2164756E21