@base44-preview/cli 0.1.7-pr.586.b1716a1 → 0.1.7-pr.587.7ed9b75

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,61 @@ 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 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
+ }
256696
+
256697
+ // src/cli/commands/project/build.ts
256698
+ async function buildAction(ctx) {
256699
+ const { app } = ctx;
256700
+ if (!app?.projectRoot) {
256701
+ throw new ConfigInvalidError("base44 build requires a linked local project. Run it from a project with base44/.app.jsonc.");
256702
+ }
256703
+ const { project: project2 } = await readProjectConfig(app.projectRoot);
256704
+ await runSiteBuild(ctx, {
256705
+ root: project2.root,
256706
+ buildCommand: project2.site?.buildCommand,
256707
+ appId: app.id
256708
+ });
256668
256709
  return {
256669
256710
  outroMessage: `Site built with app id ${theme.styles.bold(app.id)}`
256670
256711
  };
@@ -256941,7 +256982,8 @@ Examples:
256941
256982
  }
256942
256983
 
256943
256984
  // src/cli/commands/project/deploy.ts
256944
- async function deployAction({ isNonInteractive, log }, options = {}) {
256985
+ async function deployAction(ctx, options = {}) {
256986
+ const { isNonInteractive, log } = ctx;
256945
256987
  if (isNonInteractive && !options.yes) {
256946
256988
  throw new InvalidInputError("--yes is required in non-interactive mode");
256947
256989
  }
@@ -256989,6 +257031,7 @@ ${summaryLines.join(`
256989
257031
  ${summaryLines.join(`
256990
257032
  `)}`);
256991
257033
  }
257034
+ await maybeBuildBeforeDeploy(ctx, project2, options.build);
256992
257035
  let functionCompleted = 0;
256993
257036
  const functionTotal = functions.length;
256994
257037
  const result = await deployAll(projectData, {
@@ -257017,7 +257060,7 @@ ${summaryLines.join(`
257017
257060
  return { outroMessage: "App deployed successfully" };
257018
257061
  }
257019
257062
  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);
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);
257021
257064
  }
257022
257065
  async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
257023
257066
  const needsOAuth = filterPendingOAuth(connectorResults);
@@ -257883,7 +257926,8 @@ function getSecretsCommand() {
257883
257926
 
257884
257927
  // src/cli/commands/site/deploy.ts
257885
257928
  import { resolve as resolve11 } from "node:path";
257886
- async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
257929
+ async function deployAction2(ctx, options) {
257930
+ const { isNonInteractive, runTask: runTask2 } = ctx;
257887
257931
  if (isNonInteractive && !options.yes) {
257888
257932
  throw new InvalidInputError("--yes is required in non-interactive mode");
257889
257933
  }
@@ -257906,6 +257950,7 @@ async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
257906
257950
  return { outroMessage: "Deployment cancelled" };
257907
257951
  }
257908
257952
  }
257953
+ await maybeBuildBeforeDeploy(ctx, project2, options.build);
257909
257954
  const result = await runTask2("Creating archive and deploying site...", async () => {
257910
257955
  return await deploySite(outputDir);
257911
257956
  }, {
@@ -257915,7 +257960,7 @@ async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
257915
257960
  return { outroMessage: `Visit your site at: ${result.appUrl}` };
257916
257961
  }
257917
257962
  function getSiteDeployCommand() {
257918
- 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);
257919
257964
  }
257920
257965
 
257921
257966
  // src/cli/commands/site/open.ts
@@ -262410,7 +262455,11 @@ async function eject(ctx, options8, command2) {
262410
262455
  successMessage: theme.colors.base44Orange("Project built successfully"),
262411
262456
  errorMessage: "Failed to build project"
262412
262457
  });
262413
- await deployAction(ctx, { yes: true, projectRoot: resolvedPath });
262458
+ await deployAction(ctx, {
262459
+ yes: true,
262460
+ build: false,
262461
+ projectRoot: resolvedPath
262462
+ });
262414
262463
  }
262415
262464
  }
262416
262465
  return { outroMessage: "Your new project is set and ready to use" };
@@ -266705,4 +266754,4 @@ export {
266705
266754
  CLIExitError
266706
266755
  };
266707
266756
 
266708
- //# debugId=0FE91AF90CCD2CC164756E2164756E21
266757
+ //# debugId=0EC4691CF34BC30564756E2164756E21