@base44-preview/cli 0.1.7-pr.586.b1716a1 → 0.1.7-pr.587.a413284

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
@@ -256640,14 +256640,8 @@ function getFunctionsCommand() {
256640
256640
  return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand()).addCommand(getDeleteCommand()).addCommand(getListCommand()).addCommand(getPullCommand());
256641
256641
  }
256642
256642
 
256643
- // src/cli/commands/project/build.ts
256644
- async function buildAction(ctx) {
256645
- const { app } = ctx;
256646
- if (!app?.projectRoot) {
256647
- throw new ConfigInvalidError("base44 build requires a linked local project. Run it from a project with base44/.app.jsonc.");
256648
- }
256649
- const { project: project2 } = await readProjectConfig(app.projectRoot);
256650
- const buildCommand = project2.site?.buildCommand;
256643
+ // src/cli/commands/project/site-build.ts
256644
+ async function runSiteBuild({ runTask: runTask2 }, { root, buildCommand, appId }) {
256651
256645
  if (!buildCommand) {
256652
256646
  throw new ConfigNotFoundError("No site build command found.", {
256653
256647
  hints: [
@@ -256657,14 +256651,47 @@ async function buildAction(ctx) {
256657
256651
  ]
256658
256652
  });
256659
256653
  }
256660
- await ctx.runTask("Building site...", () => execa({
256661
- cwd: project2.root,
256654
+ await runTask2("Building site...", () => execa({
256655
+ cwd: root,
256662
256656
  shell: true,
256663
- env: { VITE_BASE44_APP_ID: app.id }
256657
+ env: { VITE_BASE44_APP_ID: appId }
256664
256658
  })`${buildCommand}`, {
256665
256659
  successMessage: "Site built successfully",
256666
256660
  errorMessage: "Build failed"
256667
256661
  });
256662
+ }
256663
+ async function shouldBuildBeforeDeploy({
256664
+ build,
256665
+ isNonInteractive,
256666
+ buildCommand
256667
+ }) {
256668
+ if (!buildCommand) {
256669
+ return false;
256670
+ }
256671
+ if (build !== undefined) {
256672
+ return build;
256673
+ }
256674
+ if (isNonInteractive) {
256675
+ return false;
256676
+ }
256677
+ const answer = await Re({
256678
+ message: `Build the site first? (runs '${buildCommand}' with your app id)`
256679
+ });
256680
+ return !Ct(answer) && answer;
256681
+ }
256682
+
256683
+ // src/cli/commands/project/build.ts
256684
+ async function buildAction(ctx) {
256685
+ const { app } = ctx;
256686
+ if (!app?.projectRoot) {
256687
+ throw new ConfigInvalidError("base44 build requires a linked local project. Run it from a project with base44/.app.jsonc.");
256688
+ }
256689
+ const { project: project2 } = await readProjectConfig(app.projectRoot);
256690
+ await runSiteBuild(ctx, {
256691
+ root: project2.root,
256692
+ buildCommand: project2.site?.buildCommand,
256693
+ appId: app.id
256694
+ });
256668
256695
  return {
256669
256696
  outroMessage: `Site built with app id ${theme.styles.bold(app.id)}`
256670
256697
  };
@@ -256941,7 +256968,8 @@ Examples:
256941
256968
  }
256942
256969
 
256943
256970
  // src/cli/commands/project/deploy.ts
256944
- async function deployAction({ isNonInteractive, log }, options = {}) {
256971
+ async function deployAction(ctx, options = {}) {
256972
+ const { isNonInteractive, log } = ctx;
256945
256973
  if (isNonInteractive && !options.yes) {
256946
256974
  throw new InvalidInputError("--yes is required in non-interactive mode");
256947
256975
  }
@@ -256989,6 +257017,20 @@ ${summaryLines.join(`
256989
257017
  ${summaryLines.join(`
256990
257018
  `)}`);
256991
257019
  }
257020
+ if (ctx.app && project2.site?.outputDirectory) {
257021
+ const shouldBuild = await shouldBuildBeforeDeploy({
257022
+ build: options.build,
257023
+ isNonInteractive,
257024
+ buildCommand: project2.site.buildCommand
257025
+ });
257026
+ if (shouldBuild) {
257027
+ await runSiteBuild(ctx, {
257028
+ root: project2.root,
257029
+ buildCommand: project2.site.buildCommand,
257030
+ appId: ctx.app.id
257031
+ });
257032
+ }
257033
+ }
256992
257034
  let functionCompleted = 0;
256993
257035
  const functionTotal = functions.length;
256994
257036
  const result = await deployAll(projectData, {
@@ -257017,7 +257059,7 @@ ${summaryLines.join(`
257017
257059
  return { outroMessage: "App deployed successfully" };
257018
257060
  }
257019
257061
  function getDeployCommand2() {
257020
- return new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(deployAction);
257062
+ 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);
257021
257063
  }
257022
257064
  async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
257023
257065
  const needsOAuth = filterPendingOAuth(connectorResults);
@@ -257883,7 +257925,8 @@ function getSecretsCommand() {
257883
257925
 
257884
257926
  // src/cli/commands/site/deploy.ts
257885
257927
  import { resolve as resolve11 } from "node:path";
257886
- async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
257928
+ async function deployAction2(ctx, options) {
257929
+ const { isNonInteractive, runTask: runTask2 } = ctx;
257887
257930
  if (isNonInteractive && !options.yes) {
257888
257931
  throw new InvalidInputError("--yes is required in non-interactive mode");
257889
257932
  }
@@ -257906,6 +257949,20 @@ async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
257906
257949
  return { outroMessage: "Deployment cancelled" };
257907
257950
  }
257908
257951
  }
257952
+ if (ctx.app && project2.site?.outputDirectory) {
257953
+ const shouldBuild = await shouldBuildBeforeDeploy({
257954
+ build: options.build,
257955
+ isNonInteractive,
257956
+ buildCommand: project2.site.buildCommand
257957
+ });
257958
+ if (shouldBuild) {
257959
+ await runSiteBuild(ctx, {
257960
+ root: project2.root,
257961
+ buildCommand: project2.site.buildCommand,
257962
+ appId: ctx.app.id
257963
+ });
257964
+ }
257965
+ }
257909
257966
  const result = await runTask2("Creating archive and deploying site...", async () => {
257910
257967
  return await deploySite(outputDir);
257911
257968
  }, {
@@ -257915,7 +257972,7 @@ async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
257915
257972
  return { outroMessage: `Visit your site at: ${result.appUrl}` };
257916
257973
  }
257917
257974
  function getSiteDeployCommand() {
257918
- return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").action(deployAction2);
257975
+ 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);
257919
257976
  }
257920
257977
 
257921
257978
  // src/cli/commands/site/open.ts
@@ -262410,7 +262467,11 @@ async function eject(ctx, options8, command2) {
262410
262467
  successMessage: theme.colors.base44Orange("Project built successfully"),
262411
262468
  errorMessage: "Failed to build project"
262412
262469
  });
262413
- await deployAction(ctx, { yes: true, projectRoot: resolvedPath });
262470
+ await deployAction(ctx, {
262471
+ yes: true,
262472
+ build: false,
262473
+ projectRoot: resolvedPath
262474
+ });
262414
262475
  }
262415
262476
  }
262416
262477
  return { outroMessage: "Your new project is set and ready to use" };
@@ -266705,4 +266766,4 @@ export {
266705
266766
  CLIExitError
266706
266767
  };
266707
266768
 
266708
- //# debugId=0FE91AF90CCD2CC164756E2164756E21
266769
+ //# debugId=1FB40B1345DFA60B64756E2164756E21