@base44-preview/cli 0.1.31-pr.657.7711db6 → 0.1.32-pr.658.bc0ac49

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
@@ -236769,6 +236769,27 @@ function siteOrDefault(project) {
236769
236769
  warnConfigFallback(`${project.configPath} has no 'site' block; using the default site commands.`);
236770
236770
  return DEFAULT_SITE;
236771
236771
  }
236772
+ var COMMAND_NOT_FOUND_EXIT_CODES = new Set([127, 9009]);
236773
+ async function runSiteCommandOrDefault(command, fallback, run) {
236774
+ try {
236775
+ return await run(command);
236776
+ } catch (error) {
236777
+ if (command === fallback || !isCommandNotFound(error)) {
236778
+ throw error;
236779
+ }
236780
+ warnSiteCommandFallback(command, fallback);
236781
+ return run(fallback);
236782
+ }
236783
+ }
236784
+ function warnSiteCommandFallback(command, fallback) {
236785
+ warnConfigFallback(`'${command}' could not start because its program is not installed; running '${fallback}' instead.`);
236786
+ }
236787
+ function isCommandNotFoundExit(code) {
236788
+ return typeof code === "number" && COMMAND_NOT_FOUND_EXIT_CODES.has(code);
236789
+ }
236790
+ function isCommandNotFound(error) {
236791
+ return typeof error === "object" && error !== null && "exitCode" in error && isCommandNotFoundExit(error.exitCode);
236792
+ }
236772
236793
  function withoutKey(record, key) {
236773
236794
  return Object.fromEntries(Object.entries(record).filter(([k]) => k !== key));
236774
236795
  }
@@ -239374,7 +239395,7 @@ import { join as join13 } from "node:path";
239374
239395
  // package.json
239375
239396
  var package_default = {
239376
239397
  name: "base44",
239377
- version: "0.1.31",
239398
+ version: "0.1.32",
239378
239399
  description: "Base44 CLI - Unified interface for managing Base44 applications",
239379
239400
  type: "module",
239380
239401
  bin: {
@@ -249751,11 +249772,11 @@ function getFunctionsCommand() {
249751
249772
 
249752
249773
  // src/cli/commands/project/site-build.ts
249753
249774
  async function runSiteBuild({ runTask }, { root, buildCommand = DEFAULT_SITE.buildCommand, appId }) {
249754
- await runTask("Building site...", () => execa({
249775
+ await runTask("Building site...", () => runSiteCommandOrDefault(buildCommand, DEFAULT_SITE.buildCommand, (command) => execa({
249755
249776
  cwd: root,
249756
249777
  shell: true,
249757
249778
  env: { VITE_BASE44_APP_ID: appId }
249758
- })`${buildCommand}`, {
249779
+ })`${command}`), {
249759
249780
  successMessage: "Site built successfully",
249760
249781
  errorMessage: "Build failed"
249761
249782
  });
@@ -262327,14 +262348,25 @@ async function siteDevAction(ctx, forwarded) {
262327
262348
  const site = siteOrDefault(project);
262328
262349
  const serveCommand = site.serveCommand ?? DEFAULT_SERVE_COMMAND;
262329
262350
  const command = [serveCommand, ...forwarded].join(" ");
262330
- const runner = createServeCommandRunner({
262331
- serveCommand: command,
262332
- projectRoot: project.root,
262333
- appId: app.id
262334
- });
262335
- stopRunnerOnProcessSignals(runner);
262336
- runner.onExit((code) => process.exit(code ?? 1));
262337
- runner.start();
262351
+ const fallback = [DEFAULT_SERVE_COMMAND, ...forwarded].join(" ");
262352
+ const serve = (line) => {
262353
+ const runner = createServeCommandRunner({
262354
+ serveCommand: line,
262355
+ projectRoot: project.root,
262356
+ appId: app.id
262357
+ });
262358
+ stopRunnerOnProcessSignals(runner);
262359
+ runner.onExit((code) => {
262360
+ if (line !== fallback && isCommandNotFoundExit(code)) {
262361
+ warnSiteCommandFallback(line, fallback);
262362
+ serve(fallback);
262363
+ return;
262364
+ }
262365
+ process.exit(code ?? 1);
262366
+ });
262367
+ runner.start();
262368
+ };
262369
+ serve(command);
262338
262370
  return { outroMessage: `Frontend dev server running '${command}'` };
262339
262371
  }
262340
262372
  function getSiteDevCommand() {
@@ -262347,12 +262379,16 @@ async function installAction({
262347
262379
  }) {
262348
262380
  const project = await readProjectSettingsOrDefaults();
262349
262381
  const { installCommand } = siteOrDefault(project);
262350
- await runTask("Installing site dependencies...", () => execa({ cwd: project.root, shell: true })`${installCommand}`, {
262382
+ let ran = installCommand;
262383
+ await runTask("Installing site dependencies...", () => runSiteCommandOrDefault(installCommand, DEFAULT_SITE.installCommand, (command) => {
262384
+ ran = command;
262385
+ return execa({ cwd: project.root, shell: true })`${command}`;
262386
+ }), {
262351
262387
  successMessage: "Dependencies installed",
262352
262388
  errorMessage: "Install failed"
262353
262389
  });
262354
262390
  return {
262355
- outroMessage: `Installed with ${theme.styles.bold(installCommand)}`
262391
+ outroMessage: `Installed with ${theme.styles.bold(ran)}`
262356
262392
  };
262357
262393
  }
262358
262394
  function getSiteInstallCommand() {
@@ -271284,4 +271320,4 @@ export {
271284
271320
  runCLI
271285
271321
  };
271286
271322
 
271287
- //# debugId=7FB565796F6FC1AA64756E2164756E21
271323
+ //# debugId=61E073E485FD166064756E2164756E21