@base44-preview/cli 0.1.7-pr.587.a83a4fb → 0.1.7-pr.588.5b5ab4e

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,25 +256660,6 @@ async function runSiteBuild({ runTask: runTask2 }, { root, buildCommand, appId }
256660
256660
  errorMessage: "Build failed"
256661
256661
  });
256662
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
256663
 
256683
256664
  // src/cli/commands/project/build.ts
256684
256665
  async function buildAction(ctx) {
@@ -256968,8 +256949,7 @@ Examples:
256968
256949
  }
256969
256950
 
256970
256951
  // src/cli/commands/project/deploy.ts
256971
- async function deployAction(ctx, options = {}) {
256972
- const { isNonInteractive, log } = ctx;
256952
+ async function deployAction({ isNonInteractive, log }, options = {}) {
256973
256953
  if (isNonInteractive && !options.yes) {
256974
256954
  throw new InvalidInputError("--yes is required in non-interactive mode");
256975
256955
  }
@@ -257017,20 +256997,6 @@ ${summaryLines.join(`
257017
256997
  ${summaryLines.join(`
257018
256998
  `)}`);
257019
256999
  }
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
- }
257034
257000
  let functionCompleted = 0;
257035
257001
  const functionTotal = functions.length;
257036
257002
  const result = await deployAll(projectData, {
@@ -257059,7 +257025,7 @@ ${summaryLines.join(`
257059
257025
  return { outroMessage: "App deployed successfully" };
257060
257026
  }
257061
257027
  function getDeployCommand2() {
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);
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
257029
  }
257064
257030
  async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
257065
257031
  const needsOAuth = filterPendingOAuth(connectorResults);
@@ -257925,8 +257891,7 @@ function getSecretsCommand() {
257925
257891
 
257926
257892
  // src/cli/commands/site/deploy.ts
257927
257893
  import { resolve as resolve11 } from "node:path";
257928
- async function deployAction2(ctx, options) {
257929
- const { isNonInteractive, runTask: runTask2 } = ctx;
257894
+ async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
257930
257895
  if (isNonInteractive && !options.yes) {
257931
257896
  throw new InvalidInputError("--yes is required in non-interactive mode");
257932
257897
  }
@@ -257949,20 +257914,6 @@ async function deployAction2(ctx, options) {
257949
257914
  return { outroMessage: "Deployment cancelled" };
257950
257915
  }
257951
257916
  }
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
- }
257966
257917
  const result = await runTask2("Creating archive and deploying site...", async () => {
257967
257918
  return await deploySite(outputDir);
257968
257919
  }, {
@@ -257972,7 +257923,7 @@ async function deployAction2(ctx, options) {
257972
257923
  return { outroMessage: `Visit your site at: ${result.appUrl}` };
257973
257924
  }
257974
257925
  function getSiteDeployCommand() {
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);
257926
+ return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").action(deployAction2);
257976
257927
  }
257977
257928
 
257978
257929
  // src/cli/commands/site/open.ts
@@ -262194,6 +262145,10 @@ function validateDevOptions(command2) {
262194
262145
  if (appId !== undefined) {
262195
262146
  command2.error(`base44 dev cannot be used with --app-id or ${BASE44_APP_ID_ENV_VAR}.`);
262196
262147
  }
262148
+ const { port, remote } = command2.opts();
262149
+ if (remote && port !== undefined) {
262150
+ command2.error("--port applies to the local backend, which --remote does not start.");
262151
+ }
262197
262152
  }
262198
262153
  function requireLinkedProject({ app }) {
262199
262154
  if (!app?.projectRoot) {
@@ -262201,31 +262156,44 @@ function requireLinkedProject({ app }) {
262201
262156
  }
262202
262157
  return { id: app.id, projectRoot: app.projectRoot };
262203
262158
  }
262204
- async function createConfiguredServeRunner(app, backendUrl) {
262159
+ async function resolveConfiguredSite(app) {
262205
262160
  const { project: project2 } = await readProjectConfig(app.projectRoot);
262206
262161
  const serveCommand = project2.site?.serveCommand;
262207
- if (!serveCommand) {
262208
- return;
262209
- }
262210
- return createServeCommandRunner({
262211
- serveCommand,
262212
- projectRoot: project2.root,
262213
- appId: app.id,
262214
- appBaseUrl: backendUrl
262215
- });
262162
+ return serveCommand ? { serveCommand, projectRoot: project2.root } : undefined;
262216
262163
  }
262217
- function startServeCommand(runner, backend) {
262164
+ function stopRunnerOnProcessSignals(runner) {
262218
262165
  const stop2 = () => void runner.stop();
262219
262166
  process.on("SIGINT", stop2);
262220
262167
  process.on("SIGTERM", stop2);
262168
+ }
262169
+ function startServeCommand(runner, backend) {
262170
+ stopRunnerOnProcessSignals(runner);
262221
262171
  runner.onExit(() => {
262222
262172
  backend.shutdown().finally(() => process.exit(1));
262223
262173
  });
262224
262174
  createDevLogger("backend", theme.styles.info).log(`Backend running on ${backend.url}`);
262225
262175
  runner.start();
262226
262176
  }
262227
- async function devAction(ctx, options8) {
262228
- const app = requireLinkedProject(ctx);
262177
+ async function remoteDevAction(app) {
262178
+ const site2 = await resolveConfiguredSite(app);
262179
+ if (!site2) {
262180
+ throw new ConfigInvalidError("base44 dev --remote serves the frontend against the production backend, but this project has no site.serveCommand in base44/config.jsonc.");
262181
+ }
262182
+ const appBaseUrl = await getSiteUrl();
262183
+ const runner = createServeCommandRunner({
262184
+ ...site2,
262185
+ appId: app.id,
262186
+ appBaseUrl
262187
+ });
262188
+ stopRunnerOnProcessSignals(runner);
262189
+ runner.onExit((code2) => process.exit(code2 ?? 1));
262190
+ runner.start();
262191
+ return {
262192
+ outroMessage: `Frontend dev server targets ${theme.styles.bold(appBaseUrl)} — every write hits your live app`
262193
+ };
262194
+ }
262195
+ async function localDevAction(ctx, app, options8) {
262196
+ const site2 = await resolveConfiguredSite(app);
262229
262197
  const siteUrlPromise = getSiteUrl().catch(() => {
262230
262198
  return;
262231
262199
  });
@@ -262240,15 +262208,23 @@ async function devAction(ctx, options8) {
262240
262208
  }
262241
262209
  });
262242
262210
  const backendUrl = localServerUrl(backend.port);
262243
- const runner = await createConfiguredServeRunner(app, backendUrl);
262244
- if (runner) {
262211
+ if (site2) {
262212
+ const runner = createServeCommandRunner({
262213
+ ...site2,
262214
+ appId: app.id,
262215
+ appBaseUrl: backendUrl
262216
+ });
262245
262217
  startServeCommand(runner, { url: backendUrl, shutdown: backend.shutdown });
262246
262218
  }
262247
- const outroMessage = runner ? "Open your app using the frontend dev server URL" : `Dev server is available at ${theme.colors.links(backendUrl)}`;
262219
+ const outroMessage = site2 ? "Open your app using the frontend dev server URL" : `Dev server is available at ${theme.colors.links(backendUrl)}`;
262248
262220
  return { outroMessage };
262249
262221
  }
262222
+ async function devAction(ctx, options8) {
262223
+ const app = requireLinkedProject(ctx);
262224
+ return options8.remote ? remoteDevAction(app) : localDevAction(ctx, app, options8);
262225
+ }
262250
262226
  function getDevCommand() {
262251
- return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").hook("preAction", validateDevOptions).action(devAction);
262227
+ return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").option("--remote", "Serve the frontend against the production backend instead of a local one").hook("preAction", validateDevOptions).action(devAction);
262252
262228
  }
262253
262229
 
262254
262230
  // src/core/exec/run-script.ts
@@ -262467,11 +262443,7 @@ async function eject(ctx, options8, command2) {
262467
262443
  successMessage: theme.colors.base44Orange("Project built successfully"),
262468
262444
  errorMessage: "Failed to build project"
262469
262445
  });
262470
- await deployAction(ctx, {
262471
- yes: true,
262472
- build: false,
262473
- projectRoot: resolvedPath
262474
- });
262446
+ await deployAction(ctx, { yes: true, projectRoot: resolvedPath });
262475
262447
  }
262476
262448
  }
262477
262449
  return { outroMessage: "Your new project is set and ready to use" };
@@ -266766,4 +266738,4 @@ export {
266766
266738
  CLIExitError
266767
266739
  };
266768
266740
 
266769
- //# debugId=1FB40B1345DFA60B64756E2164756E21
266741
+ //# debugId=E288D289EECEB6CA64756E2164756E21