@base44-preview/cli 0.1.18-pr.635.c3a4ce4 → 0.1.18-pr.639.a559cb8

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
@@ -119090,7 +119090,7 @@ import path52 from "path";
119090
119090
  import * as path42 from "path";
119091
119091
  import * as fs26 from "fs/promises";
119092
119092
  import * as path22 from "path";
119093
- import process23 from "process";
119093
+ import process22 from "process";
119094
119094
  import * as path32 from "path";
119095
119095
  import process32 from "process";
119096
119096
  import path92 from "path";
@@ -119622,7 +119622,7 @@ function partition2(array2, predicate) {
119622
119622
  return result;
119623
119623
  }
119624
119624
  async function findInDirectory(nameOrNames, { typeCheck, cwd, allowSymlinks = true, filter: filter2 }) {
119625
- const directory = toAbsolutePath(cwd) ?? process23.cwd();
119625
+ const directory = toAbsolutePath(cwd) ?? process22.cwd();
119626
119626
  const names = Array.isArray(nameOrNames) ? nameOrNames : [nameOrNames];
119627
119627
  for (const name of names) {
119628
119628
  const fileOrDirectory = path22.join(directory, name);
@@ -146002,10 +146002,10 @@ __export(exports_supports_color, {
146002
146002
  createSupportsColor: () => createSupportsColor2,
146003
146003
  default: () => supports_color_default2
146004
146004
  });
146005
- import process24 from "node:process";
146005
+ import process21 from "node:process";
146006
146006
  import os9 from "node:os";
146007
146007
  import tty4 from "node:tty";
146008
- function hasFlag2(flag, argv = globalThis.Deno ? globalThis.Deno.args : process24.argv) {
146008
+ function hasFlag2(flag, argv = globalThis.Deno ? globalThis.Deno.args : process21.argv) {
146009
146009
  const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
146010
146010
  const position = argv.indexOf(prefix + flag);
146011
146011
  const terminatorPosition = argv.indexOf("--");
@@ -146068,7 +146068,7 @@ function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
146068
146068
  if (env3.TERM === "dumb") {
146069
146069
  return min;
146070
146070
  }
146071
- if (process24.platform === "win32") {
146071
+ if (process21.platform === "win32") {
146072
146072
  const osRelease = os9.release().split(".");
146073
146073
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
146074
146074
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
@@ -146130,7 +146130,7 @@ function createSupportsColor2(stream, options = {}) {
146130
146130
  }
146131
146131
  var env3, flagForceColor2, supportsColor2, supports_color_default2;
146132
146132
  var init_supports_color = __esm(() => {
146133
- ({ env: env3 } = process24);
146133
+ ({ env: env3 } = process21);
146134
146134
  if (hasFlag2("no-color") || hasFlag2("no-colors") || hasFlag2("color=false") || hasFlag2("color=never")) {
146135
146135
  flagForceColor2 = 0;
146136
146136
  } else if (hasFlag2("color") || hasFlag2("colors") || hasFlag2("color=true") || hasFlag2("color=always")) {
@@ -230721,10 +230721,7 @@ var SiteConfigSchema = object({
230721
230721
  buildCommand: string2().default("npm run build"),
230722
230722
  serveCommand: string2().optional(),
230723
230723
  outputDirectory: string2().optional(),
230724
- installCommand: string2().default("npm install"),
230725
- devHostFlag: string2().default("--host"),
230726
- devHost: string2().default("0.0.0.0"),
230727
- devPort: number2().int().min(1).max(65535).default(5173)
230724
+ installCommand: string2().default("npm install")
230728
230725
  });
230729
230726
  var PluginMetadataSchema = object({
230730
230727
  namespace: string2().min(1, "Plugin namespace cannot be empty").regex(/^[a-zA-Z0-9_-]+$/, "Plugin namespace can only contain letters, numbers, underscores, and dashes")
@@ -240111,6 +240108,9 @@ function deploymentsApiEnabled(env = process.env) {
240111
240108
  const value = env[DEPLOYMENTS_API_ENV];
240112
240109
  return value === "1" || value === "true";
240113
240110
  }
240111
+ async function hasWorkerBuild(projectRoot) {
240112
+ return await detectFullStackArtifact(projectRoot) !== null;
240113
+ }
240114
240114
  async function deployToDeployments(options) {
240115
240115
  const { projectRoot, outputDir, gitHash, concurrency, progress } = options;
240116
240116
  const worker = await resolveWorkerBuild(projectRoot, progress);
@@ -246709,37 +246709,8 @@ async function gitHead(projectRoot) {
246709
246709
  return null;
246710
246710
  }
246711
246711
  }
246712
- // src/core/site/serve-command.ts
246713
- var DEFAULT_SERVE_COMMAND = "npm run dev";
246714
- var SCRIPT = "[A-Za-z0-9:_.-]+";
246715
- var PREFIX2 = "[A-Za-z0-9._/-]+";
246716
- var SCRIPT_RUNNERS = [
246717
- {
246718
- pattern: new RegExp(String.raw`^npm(\s+--prefix\s+${PREFIX2})?\s+run\s+${SCRIPT}$`),
246719
- separator: " -- "
246720
- },
246721
- {
246722
- pattern: new RegExp(String.raw`^(?:pnpm|yarn|bun)(\s+run)?\s+${SCRIPT}$`),
246723
- separator: " "
246724
- }
246725
- ];
246726
- function runnerFor(serveCommand) {
246727
- return SCRIPT_RUNNERS.find((runner) => runner.pattern.test(serveCommand));
246728
- }
246729
- function withServeAddress(serveCommand, { host, port, hostFlag }) {
246730
- const command = serveCommand.trim();
246731
- const args = [hostFlag, host, "--port", String(port)];
246732
- const runner = runnerFor(command);
246733
- if (!runner) {
246734
- return { command, droppedAddress: true };
246735
- }
246736
- return {
246737
- command: `${command}${runner.separator}${args.join(" ")}`,
246738
- droppedAddress: false
246739
- };
246740
- }
246741
246712
  // src/core/project/deploy.ts
246742
- function hasResourcesToDeploy(projectData) {
246713
+ function hasResourcesToDeploy(projectData, options = {}) {
246743
246714
  const {
246744
246715
  project,
246745
246716
  entities,
@@ -246750,7 +246721,7 @@ function hasResourcesToDeploy(projectData) {
246750
246721
  connectors,
246751
246722
  authConfig
246752
246723
  } = projectData;
246753
- const hasSite = Boolean(project.site?.outputDirectory);
246724
+ const hasSite = Boolean(project.site?.outputDirectory) || Boolean(options.workerBuild);
246754
246725
  const hasEntities = entities.length > 0;
246755
246726
  const hasFunctions = functions.length > 0;
246756
246727
  const hasActors = actors.length > 0;
@@ -246772,6 +246743,7 @@ async function deployAll(projectData, options) {
246772
246743
  connectors,
246773
246744
  authConfig
246774
246745
  } = projectData;
246746
+ const workerGitHash = await hasWorkerBuild(project.root) ? await resolveGitHash(project.root) : null;
246775
246747
  await setAppVisibility(project.visibility);
246776
246748
  if (project.visibility) {
246777
246749
  options?.onVisibilitySet?.(project.visibility);
@@ -246809,8 +246781,19 @@ async function deployAll(projectData, options) {
246809
246781
  await authConfigResource.push(authConfig);
246810
246782
  const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
246811
246783
  const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
246812
- if (project.site?.outputDirectory) {
246813
- const outputDir = resolve5(project.root, project.site.outputDirectory);
246784
+ const outputDir = project.site?.outputDirectory ? resolve5(project.root, project.site.outputDirectory) : null;
246785
+ if (workerGitHash) {
246786
+ const { deploymentId } = await deployToDeployments({
246787
+ projectRoot: project.root,
246788
+ outputDir,
246789
+ gitHash: workerGitHash
246790
+ });
246791
+ return {
246792
+ deployment: { deploymentId, gitHash: workerGitHash },
246793
+ connectorResults
246794
+ };
246795
+ }
246796
+ if (outputDir) {
246814
246797
  const { appUrl } = await deploySite(outputDir);
246815
246798
  return { appUrl, connectorResults };
246816
246799
  }
@@ -249640,7 +249623,7 @@ async function buildAction(ctx) {
249640
249623
  };
249641
249624
  }
249642
249625
  function getBuildCommand() {
249643
- return new Base44Command("build", { requireAuth: false }).description("Build the site with the Base44 app id injected").action(buildAction);
249626
+ return new Base44Command("build").description("Build the site with the Base44 app id injected").action(buildAction);
249644
249627
  }
249645
249628
 
249646
249629
  // src/cli/commands/project/create.ts
@@ -249921,7 +249904,8 @@ async function deployAction(ctx, options = {}) {
249921
249904
  throw new InvalidInputError("--yes is required in non-interactive mode");
249922
249905
  }
249923
249906
  const projectData = await readProjectConfig(options.projectRoot);
249924
- if (!hasResourcesToDeploy(projectData)) {
249907
+ const workerBuild = await hasWorkerBuild(projectData.project.root);
249908
+ if (!hasResourcesToDeploy(projectData, { workerBuild })) {
249925
249909
  return {
249926
249910
  outroMessage: "No resources found to deploy"
249927
249911
  };
@@ -249957,7 +249941,9 @@ async function deployAction(ctx, options = {}) {
249957
249941
  if (project.visibility) {
249958
249942
  summaryLines.push(` - Visibility: ${project.visibility}`);
249959
249943
  }
249960
- if (project.site?.outputDirectory) {
249944
+ if (workerBuild) {
249945
+ summaryLines.push(" - Site");
249946
+ } else if (project.site?.outputDirectory) {
249961
249947
  summaryLines.push(` - Site from ${project.site.outputDirectory}`);
249962
249948
  }
249963
249949
  if (!options.yes) {
@@ -250012,6 +249998,10 @@ ${summaryLines.join(`
250012
249998
  if (result.appUrl) {
250013
249999
  log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(result.appUrl)}`);
250014
250000
  }
250001
+ if (result.deployment) {
250002
+ const { deploymentId, gitHash } = result.deployment;
250003
+ log.message(`${theme.styles.header("Deployment")}: ${deploymentId} (commit ${gitHash.slice(0, 12)})`);
250004
+ }
250015
250005
  return { outroMessage: "App deployed successfully" };
250016
250006
  }
250017
250007
  function getDeployCommand3() {
@@ -250037,36 +250027,6 @@ function printStripeResult(r, log) {
250037
250027
  log.info(` Connectors dashboard: ${theme.colors.links(getConnectorsUrl())}`);
250038
250028
  }
250039
250029
 
250040
- // src/cli/commands/project/install.ts
250041
- async function installAction({
250042
- runTask
250043
- }) {
250044
- const { project } = await readProjectConfig();
250045
- const installCommand = project.site?.installCommand;
250046
- if (!installCommand) {
250047
- throw new ConfigNotFoundError("No site install command found.", {
250048
- hints: [
250049
- {
250050
- message: `Add a 'site' block to your config.jsonc (e.g., "site": { "installCommand": "npm ci" }). Inside one, installCommand defaults to "npm install".`
250051
- }
250052
- ]
250053
- });
250054
- }
250055
- await runTask("Installing site dependencies...", () => execa({ cwd: project.root, shell: true })`${installCommand}`, {
250056
- successMessage: "Dependencies installed",
250057
- errorMessage: "Install failed"
250058
- });
250059
- return {
250060
- outroMessage: `Installed with ${theme.styles.bold(installCommand)}`
250061
- };
250062
- }
250063
- function getInstallCommand() {
250064
- return new Base44Command("install", {
250065
- requireAuth: false,
250066
- requireAppContext: false
250067
- }).description("Install the site's dependencies with its configured command").action(installAction);
250068
- }
250069
-
250070
250030
  // src/cli/commands/project/app-id-options.ts
250071
250031
  function readExplicitAppId(command) {
250072
250032
  const { appId } = command.optsWithGlobals();
@@ -251052,16 +251012,17 @@ async function deployAction2(ctx, options) {
251052
251012
  }
251053
251013
  const project = await readProjectSettings();
251054
251014
  await maybeBuildBeforeDeploy(ctx, project, options.build);
251015
+ const workerBuild = await hasWorkerBuild(project.root);
251055
251016
  if (!options.yes) {
251056
251017
  const outputDirectory = project.site?.outputDirectory;
251057
251018
  const shouldDeploy = await Re({
251058
- message: outputDirectory ? `Deploy site from ${outputDirectory}?` : "Deploy site?"
251019
+ message: outputDirectory && !workerBuild ? `Deploy site from ${outputDirectory}?` : "Deploy site?"
251059
251020
  });
251060
251021
  if (Ct(shouldDeploy) || !shouldDeploy) {
251061
251022
  return { outroMessage: "Deployment cancelled" };
251062
251023
  }
251063
251024
  }
251064
- return deploymentsApiEnabled() ? await deployToDeploymentsApi(ctx, project, options) : await deployTarball(ctx, project);
251025
+ return workerBuild || deploymentsApiEnabled() ? await deployToDeploymentsApi(ctx, project, options) : await deployTarball(ctx, project);
251065
251026
  }
251066
251027
  async function deployToDeploymentsApi(ctx, project, options) {
251067
251028
  const { runTask, log, jsonMode } = ctx;
@@ -251146,206 +251107,6 @@ function parseConcurrency(value) {
251146
251107
  return parsed;
251147
251108
  }
251148
251109
 
251149
- // src/cli/dev/createDevLogger.ts
251150
- var colorByType = {
251151
- error: theme.styles.error,
251152
- warn: theme.styles.warn,
251153
- log: (input) => input
251154
- };
251155
- var stringify = (item) => {
251156
- if (typeof item === "string") {
251157
- return item;
251158
- }
251159
- if (item instanceof Error) {
251160
- return item.toString();
251161
- }
251162
- try {
251163
- return JSON.stringify(item, null, 2) ?? String(item);
251164
- } catch {
251165
- return String(item);
251166
- }
251167
- };
251168
- function createDevLogger(label, labelColor = theme.styles.dim) {
251169
- const prefix = label ? `${labelColor(`[${label}]`)} ` : "";
251170
- const print = (type, ...args) => {
251171
- const colorize = colorByType[type];
251172
- console[type](prefix + args.map((item) => colorize(stringify(item))).join(" "));
251173
- };
251174
- return {
251175
- log: (...args) => print("log", ...args),
251176
- error: (msg, err) => {
251177
- print("error", msg);
251178
- if (err) {
251179
- print("error", err);
251180
- }
251181
- },
251182
- warn: (...args) => print("warn", ...args)
251183
- };
251184
- }
251185
-
251186
- // src/cli/dev/dev-server/serve-runner.ts
251187
- import { spawn as spawn2 } from "node:child_process";
251188
- import process21 from "node:process";
251189
-
251190
- class ServeRunner {
251191
- command;
251192
- cwd;
251193
- env;
251194
- logger;
251195
- child;
251196
- stopping = false;
251197
- stopPromise;
251198
- exitListeners = [];
251199
- constructor(options) {
251200
- this.command = options.command;
251201
- this.cwd = options.cwd;
251202
- this.env = options.env;
251203
- this.logger = options.logger;
251204
- }
251205
- start() {
251206
- if (this.child) {
251207
- return;
251208
- }
251209
- const stdin = process21.platform === "win32" ? "ignore" : "inherit";
251210
- const child = spawn2(this.command, {
251211
- cwd: this.cwd,
251212
- shell: true,
251213
- detached: process21.platform !== "win32",
251214
- env: { ...process21.env, ...this.env },
251215
- stdio: [stdin, "pipe", "pipe"],
251216
- windowsHide: true
251217
- });
251218
- this.child = child;
251219
- this.setupHandlers(child);
251220
- }
251221
- onExit(listener) {
251222
- this.exitListeners.push(listener);
251223
- }
251224
- async stop() {
251225
- if (this.stopPromise) {
251226
- return this.stopPromise;
251227
- }
251228
- this.stopPromise = this.stopChild();
251229
- return this.stopPromise;
251230
- }
251231
- async stopChild() {
251232
- const child = this.child;
251233
- if (!child || child.exitCode !== null) {
251234
- return;
251235
- }
251236
- this.stopping = true;
251237
- const exited = new Promise((resolve) => child.once("exit", () => resolve()));
251238
- if (process21.platform === "win32" && child.pid) {
251239
- const taskkill = spawn2("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
251240
- stdio: "ignore",
251241
- windowsHide: true
251242
- });
251243
- await new Promise((resolve) => {
251244
- taskkill.once("exit", () => resolve());
251245
- taskkill.once("error", () => resolve());
251246
- });
251247
- } else if (child.pid) {
251248
- try {
251249
- process21.kill(-child.pid, "SIGTERM");
251250
- } catch {
251251
- child.kill();
251252
- }
251253
- }
251254
- await exited;
251255
- }
251256
- setupHandlers(child) {
251257
- child.stdout?.on("data", (data) => this.emitLines(data, "log"));
251258
- child.stderr?.on("data", (data) => this.emitLines(data, "error"));
251259
- child.on("error", (error) => {
251260
- this.logger.error("Frontend dev server failed to start:", error);
251261
- this.notifyExit(null);
251262
- });
251263
- child.on("exit", (code) => {
251264
- if (this.stopping) {
251265
- return;
251266
- }
251267
- this.logger.error(`Frontend dev server exited with code ${code}`);
251268
- this.notifyExit(code);
251269
- });
251270
- }
251271
- notifyExit(code) {
251272
- for (const listener of this.exitListeners) {
251273
- listener(code);
251274
- }
251275
- }
251276
- emitLines(data, type) {
251277
- const lines = data.toString().trimEnd().split(`
251278
- `);
251279
- for (const line of lines) {
251280
- if (type === "error") {
251281
- this.logger.error(line);
251282
- } else {
251283
- this.logger.log(line);
251284
- }
251285
- }
251286
- }
251287
- }
251288
-
251289
- // src/cli/dev/serve-command-runner.ts
251290
- function createServeCommandRunner({
251291
- serveCommand,
251292
- projectRoot,
251293
- appId,
251294
- appBaseUrl
251295
- }) {
251296
- return new ServeRunner({
251297
- command: serveCommand,
251298
- cwd: projectRoot,
251299
- env: {
251300
- VITE_BASE44_APP_ID: appId,
251301
- ...appBaseUrl ? { VITE_BASE44_APP_BASE_URL: appBaseUrl } : {}
251302
- },
251303
- logger: createDevLogger("frontend", theme.colors.base44Orange)
251304
- });
251305
- }
251306
-
251307
- // src/cli/dev/stop-runner-on-signals.ts
251308
- import process22 from "node:process";
251309
- function stopRunnerOnProcessSignals(runner) {
251310
- const stop = () => void runner.stop();
251311
- process22.on("SIGINT", stop);
251312
- process22.on("SIGTERM", stop);
251313
- }
251314
-
251315
- // src/cli/commands/site/dev.ts
251316
- async function siteDevAction(ctx) {
251317
- const { app } = ctx;
251318
- if (!app?.projectRoot) {
251319
- throw new ConfigInvalidError("base44 site dev requires a linked local project. Run it from a project with base44/.app.jsonc.");
251320
- }
251321
- const { project } = await readProjectConfig(app.projectRoot);
251322
- const site = project.site;
251323
- if (!site) {
251324
- throw new InvalidInputError(`This project has no 'site' block in base44/config.jsonc, so there is no frontend to serve. Add one naming its serveCommand; site dev falls back to "npm run dev".`);
251325
- }
251326
- const serveCommand = site.serveCommand ?? DEFAULT_SERVE_COMMAND;
251327
- const { command, droppedAddress } = withServeAddress(serveCommand, {
251328
- host: site.devHost,
251329
- port: site.devPort,
251330
- hostFlag: site.devHostFlag
251331
- });
251332
- if (droppedAddress) {
251333
- throw new InvalidInputError(`serveCommand '${serveCommand}' takes no forwarded arguments, so the bind address cannot be passed to it. Bind it inside serveCommand itself, or use an 'npm run', 'pnpm', 'yarn' or 'bun run' script.`);
251334
- }
251335
- const runner = createServeCommandRunner({
251336
- serveCommand: command,
251337
- projectRoot: project.root,
251338
- appId: app.id
251339
- });
251340
- stopRunnerOnProcessSignals(runner);
251341
- runner.onExit((code) => process.exit(code ?? 1));
251342
- runner.start();
251343
- return { outroMessage: `Frontend dev server running '${command}'` };
251344
- }
251345
- function getSiteDevCommand() {
251346
- return new Base44Command("dev", { requireAuth: false }).description("Run the site's dev server, with no local backend").action(siteDevAction);
251347
- }
251348
-
251349
251110
  // src/cli/commands/site/open.ts
251350
251111
  async function openAction({
251351
251112
  isNonInteractive
@@ -251362,7 +251123,7 @@ function getSiteOpenCommand() {
251362
251123
 
251363
251124
  // src/cli/commands/site/index.ts
251364
251125
  function getSiteCommand() {
251365
- return new Command2("site").description("Manage app site (frontend app)").addCommand(getSiteDeployCommand()).addCommand(getSiteDevCommand()).addCommand(getSiteOpenCommand());
251126
+ return new Command2("site").description("Manage app site (frontend app)").addCommand(getSiteDeployCommand()).addCommand(getSiteOpenCommand());
251366
251127
  }
251367
251128
 
251368
251129
  // src/core/types/generator.ts
@@ -251882,6 +251643,43 @@ function getWorkspaceCommand() {
251882
251643
  return new Command2("workspace").description("List workspaces, inspect one, and move apps between them").addCommand(getWorkspaceListCommand()).addCommand(getWorkspaceGetCommand()).addCommand(getWorkspaceMoveCommand());
251883
251644
  }
251884
251645
 
251646
+ // src/cli/dev/createDevLogger.ts
251647
+ var colorByType = {
251648
+ error: theme.styles.error,
251649
+ warn: theme.styles.warn,
251650
+ log: (input) => input
251651
+ };
251652
+ var stringify = (item) => {
251653
+ if (typeof item === "string") {
251654
+ return item;
251655
+ }
251656
+ if (item instanceof Error) {
251657
+ return item.toString();
251658
+ }
251659
+ try {
251660
+ return JSON.stringify(item, null, 2) ?? String(item);
251661
+ } catch {
251662
+ return String(item);
251663
+ }
251664
+ };
251665
+ function createDevLogger(label, labelColor = theme.styles.dim) {
251666
+ const prefix = label ? `${labelColor(`[${label}]`)} ` : "";
251667
+ const print = (type, ...args) => {
251668
+ const colorize = colorByType[type];
251669
+ console[type](prefix + args.map((item) => colorize(stringify(item))).join(" "));
251670
+ };
251671
+ return {
251672
+ log: (...args) => print("log", ...args),
251673
+ error: (msg, err) => {
251674
+ print("error", msg);
251675
+ if (err) {
251676
+ print("error", err);
251677
+ }
251678
+ },
251679
+ warn: (...args) => print("warn", ...args)
251680
+ };
251681
+ }
251682
+
251885
251683
  // src/cli/dev/dev-server/main.ts
251886
251684
  var import_cors = __toESM(require_lib4(), 1);
251887
251685
  var import_express6 = __toESM(require_express(), 1);
@@ -252014,7 +251812,7 @@ var $dir = async (options) => dirWithOptions(options);
252014
251812
  var $tmpName = promisify11(tmp.tmpName);
252015
251813
 
252016
251814
  // src/cli/dev/dev-server/function-manager.ts
252017
- import { spawn as spawn3 } from "node:child_process";
251815
+ import { spawn as spawn2 } from "node:child_process";
252018
251816
  import { dirname as dirname23, join as join31 } from "node:path";
252019
251817
  import { pathToFileURL } from "node:url";
252020
251818
 
@@ -252112,7 +251910,7 @@ class FunctionManager extends BaseFunctionManager {
252112
251910
  async stopFunction(_name, { process: proc }) {
252113
251911
  const exited = new Promise((r) => proc.once("exit", () => r()));
252114
251912
  if (process.platform === "win32" && proc.pid) {
252115
- spawn3("taskkill", ["/pid", String(proc.pid), "/T", "/F"]);
251913
+ spawn2("taskkill", ["/pid", String(proc.pid), "/T", "/F"]);
252116
251914
  } else {
252117
251915
  proc.kill();
252118
251916
  }
@@ -252121,7 +251919,7 @@ class FunctionManager extends BaseFunctionManager {
252121
251919
  spawnFunction(func, port) {
252122
251920
  this.logger.log(`Spawning function "${func.name}" on port ${port}`);
252123
251921
  const importMapPath = join31(dirname23(this.wrapperPath), "import-map.json");
252124
- const process2 = spawn3("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
251922
+ const process2 = spawn2("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
252125
251923
  env: {
252126
251924
  ...globalThis.process.env,
252127
251925
  FUNCTION_PATH: pathToFileURL(func.entryPath).href,
@@ -255651,6 +255449,127 @@ async function createDevServer(options) {
255651
255449
  return { port, server, shutdown };
255652
255450
  }
255653
255451
 
255452
+ // src/cli/dev/dev-server/serve-runner.ts
255453
+ import { spawn as spawn3 } from "node:child_process";
255454
+ import process23 from "node:process";
255455
+
255456
+ class ServeRunner {
255457
+ command;
255458
+ cwd;
255459
+ env;
255460
+ logger;
255461
+ child;
255462
+ stopping = false;
255463
+ stopPromise;
255464
+ exitListeners = [];
255465
+ constructor(options) {
255466
+ this.command = options.command;
255467
+ this.cwd = options.cwd;
255468
+ this.env = options.env;
255469
+ this.logger = options.logger;
255470
+ }
255471
+ start() {
255472
+ if (this.child) {
255473
+ return;
255474
+ }
255475
+ const stdin = process23.platform === "win32" ? "ignore" : "inherit";
255476
+ const child = spawn3(this.command, {
255477
+ cwd: this.cwd,
255478
+ shell: true,
255479
+ detached: process23.platform !== "win32",
255480
+ env: { ...process23.env, ...this.env },
255481
+ stdio: [stdin, "pipe", "pipe"],
255482
+ windowsHide: true
255483
+ });
255484
+ this.child = child;
255485
+ this.setupHandlers(child);
255486
+ }
255487
+ onExit(listener) {
255488
+ this.exitListeners.push(listener);
255489
+ }
255490
+ async stop() {
255491
+ if (this.stopPromise) {
255492
+ return this.stopPromise;
255493
+ }
255494
+ this.stopPromise = this.stopChild();
255495
+ return this.stopPromise;
255496
+ }
255497
+ async stopChild() {
255498
+ const child = this.child;
255499
+ if (!child || child.exitCode !== null) {
255500
+ return;
255501
+ }
255502
+ this.stopping = true;
255503
+ const exited = new Promise((resolve) => child.once("exit", () => resolve()));
255504
+ if (process23.platform === "win32" && child.pid) {
255505
+ const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
255506
+ stdio: "ignore",
255507
+ windowsHide: true
255508
+ });
255509
+ await new Promise((resolve) => {
255510
+ taskkill.once("exit", () => resolve());
255511
+ taskkill.once("error", () => resolve());
255512
+ });
255513
+ } else if (child.pid) {
255514
+ try {
255515
+ process23.kill(-child.pid, "SIGTERM");
255516
+ } catch {
255517
+ child.kill();
255518
+ }
255519
+ }
255520
+ await exited;
255521
+ }
255522
+ setupHandlers(child) {
255523
+ child.stdout?.on("data", (data) => this.emitLines(data, "log"));
255524
+ child.stderr?.on("data", (data) => this.emitLines(data, "error"));
255525
+ child.on("error", (error) => {
255526
+ this.logger.error("Frontend dev server failed to start:", error);
255527
+ this.notifyExit(null);
255528
+ });
255529
+ child.on("exit", (code) => {
255530
+ if (this.stopping) {
255531
+ return;
255532
+ }
255533
+ this.logger.error(`Frontend dev server exited with code ${code}`);
255534
+ this.notifyExit(code);
255535
+ });
255536
+ }
255537
+ notifyExit(code) {
255538
+ for (const listener of this.exitListeners) {
255539
+ listener(code);
255540
+ }
255541
+ }
255542
+ emitLines(data, type) {
255543
+ const lines = data.toString().trimEnd().split(`
255544
+ `);
255545
+ for (const line of lines) {
255546
+ if (type === "error") {
255547
+ this.logger.error(line);
255548
+ } else {
255549
+ this.logger.log(line);
255550
+ }
255551
+ }
255552
+ }
255553
+ }
255554
+
255555
+ // src/cli/dev/serve-command-runner.ts
255556
+ function createServeCommandRunner({
255557
+ serveCommand,
255558
+ projectRoot,
255559
+ appId,
255560
+ appBaseUrl
255561
+ }) {
255562
+ return new ServeRunner({
255563
+ command: serveCommand,
255564
+ cwd: projectRoot,
255565
+ env: {
255566
+ VITE_BASE44_APP_ID: appId,
255567
+ VITE_BASE44_APP_BASE_URL: appBaseUrl
255568
+ },
255569
+ logger: createDevLogger("frontend", theme.colors.base44Orange)
255570
+ });
255571
+ }
255572
+
255654
255573
  // src/cli/commands/dev.ts
255655
255574
  function localServerUrl(port) {
255656
255575
  return `http://localhost:${port}`;
@@ -255676,6 +255595,11 @@ async function resolveConfiguredSite(app) {
255676
255595
  const serveCommand = project.site?.serveCommand;
255677
255596
  return serveCommand ? { serveCommand, projectRoot: project.root } : undefined;
255678
255597
  }
255598
+ function stopRunnerOnProcessSignals(runner) {
255599
+ const stop = () => void runner.stop();
255600
+ process.on("SIGINT", stop);
255601
+ process.on("SIGTERM", stop);
255602
+ }
255679
255603
  function startServeCommand(runner, backend) {
255680
255604
  stopRunnerOnProcessSignals(runner);
255681
255605
  runner.onExit(() => {
@@ -255991,7 +255915,6 @@ function createProgram(context) {
255991
255915
  program.addCommand(getCreateCommand());
255992
255916
  program.addCommand(getScaffoldCommand());
255993
255917
  program.addCommand(getDashboardCommand());
255994
- program.addCommand(getInstallCommand());
255995
255918
  program.addCommand(getBuildCommand());
255996
255919
  program.addCommand(getDeployCommand3());
255997
255920
  program.addCommand(getVisibilityCommand());
@@ -260061,4 +259984,4 @@ export {
260061
259984
  runCLI
260062
259985
  };
260063
259986
 
260064
- //# debugId=E02B26E5C6F924D964756E2164756E21
259987
+ //# debugId=752874D903B2231464756E2164756E21