@base44-preview/cli 0.1.16-pr.634.fb8f8af → 0.1.16-pr.635.0ca7e05
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 +304 -180
- package/dist/cli/index.js.map +16 -12
- package/package.json +1 -1
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
|
|
119093
|
+
import process23 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) ??
|
|
119625
|
+
const directory = toAbsolutePath(cwd) ?? process23.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
|
|
146005
|
+
import process24 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 :
|
|
146008
|
+
function hasFlag2(flag, argv = globalThis.Deno ? globalThis.Deno.args : process24.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 (
|
|
146071
|
+
if (process24.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 } =
|
|
146133
|
+
({ env: env3 } = process24);
|
|
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")) {
|
|
@@ -230708,7 +230708,8 @@ var SiteConfigSchema = object({
|
|
|
230708
230708
|
buildCommand: string2().default("npm run build"),
|
|
230709
230709
|
serveCommand: string2().optional(),
|
|
230710
230710
|
outputDirectory: string2().optional(),
|
|
230711
|
-
installCommand: string2().default("npm install")
|
|
230711
|
+
installCommand: string2().default("npm install"),
|
|
230712
|
+
devHostFlag: string2().optional()
|
|
230712
230713
|
});
|
|
230713
230714
|
var PluginMetadataSchema = object({
|
|
230714
230715
|
namespace: string2().min(1, "Plugin namespace cannot be empty").regex(/^[a-zA-Z0-9_-]+$/, "Plugin namespace can only contain letters, numbers, underscores, and dashes")
|
|
@@ -246679,6 +246680,42 @@ async function gitHead(projectRoot) {
|
|
|
246679
246680
|
return null;
|
|
246680
246681
|
}
|
|
246681
246682
|
}
|
|
246683
|
+
// src/core/site/serve-command.ts
|
|
246684
|
+
var DEFAULT_SERVE_COMMAND = "npm run dev";
|
|
246685
|
+
var DEFAULT_HOST_FLAG = "--host";
|
|
246686
|
+
var SCRIPT = "[A-Za-z0-9:_.-]+";
|
|
246687
|
+
var PREFIX2 = "[A-Za-z0-9._/-]+";
|
|
246688
|
+
var SCRIPT_RUNNERS = [
|
|
246689
|
+
{
|
|
246690
|
+
pattern: new RegExp(String.raw`^npm(\s+--prefix\s+${PREFIX2})?\s+run\s+${SCRIPT}$`),
|
|
246691
|
+
separator: " -- "
|
|
246692
|
+
},
|
|
246693
|
+
{
|
|
246694
|
+
pattern: new RegExp(String.raw`^(?:pnpm|yarn|bun)(\s+run)?\s+${SCRIPT}$`),
|
|
246695
|
+
separator: " "
|
|
246696
|
+
}
|
|
246697
|
+
];
|
|
246698
|
+
function runnerFor(serveCommand) {
|
|
246699
|
+
return SCRIPT_RUNNERS.find((runner) => runner.pattern.test(serveCommand));
|
|
246700
|
+
}
|
|
246701
|
+
function withServeAddress(serveCommand, { host, port, hostFlag }) {
|
|
246702
|
+
const command = serveCommand.trim();
|
|
246703
|
+
const args = [
|
|
246704
|
+
...host ? [hostFlag ?? DEFAULT_HOST_FLAG, host] : [],
|
|
246705
|
+
...port === undefined ? [] : ["--port", String(port)]
|
|
246706
|
+
];
|
|
246707
|
+
if (args.length === 0) {
|
|
246708
|
+
return { command, droppedAddress: false };
|
|
246709
|
+
}
|
|
246710
|
+
const runner = runnerFor(command);
|
|
246711
|
+
if (!runner) {
|
|
246712
|
+
return { command, droppedAddress: true };
|
|
246713
|
+
}
|
|
246714
|
+
return {
|
|
246715
|
+
command: `${command}${runner.separator}${args.join(" ")}`,
|
|
246716
|
+
droppedAddress: false
|
|
246717
|
+
};
|
|
246718
|
+
}
|
|
246682
246719
|
// src/core/project/deploy.ts
|
|
246683
246720
|
function hasResourcesToDeploy(projectData) {
|
|
246684
246721
|
const {
|
|
@@ -249581,7 +249618,7 @@ async function buildAction(ctx) {
|
|
|
249581
249618
|
};
|
|
249582
249619
|
}
|
|
249583
249620
|
function getBuildCommand() {
|
|
249584
|
-
return new Base44Command("build").description("Build the site with the Base44 app id injected").action(buildAction);
|
|
249621
|
+
return new Base44Command("build", { requireAuth: false }).description("Build the site with the Base44 app id injected").action(buildAction);
|
|
249585
249622
|
}
|
|
249586
249623
|
|
|
249587
249624
|
// src/cli/commands/project/create.ts
|
|
@@ -249978,6 +250015,36 @@ function printStripeResult(r, log) {
|
|
|
249978
250015
|
log.info(` Connectors dashboard: ${theme.colors.links(getConnectorsUrl())}`);
|
|
249979
250016
|
}
|
|
249980
250017
|
|
|
250018
|
+
// src/cli/commands/project/install.ts
|
|
250019
|
+
async function installAction({
|
|
250020
|
+
runTask
|
|
250021
|
+
}) {
|
|
250022
|
+
const { project } = await readProjectConfig();
|
|
250023
|
+
const installCommand = project.site?.installCommand;
|
|
250024
|
+
if (!installCommand) {
|
|
250025
|
+
throw new ConfigNotFoundError("No site install command found.", {
|
|
250026
|
+
hints: [
|
|
250027
|
+
{
|
|
250028
|
+
message: `Add a 'site' block to your config.jsonc (e.g., "site": { "installCommand": "npm ci" }). Inside one, installCommand defaults to "npm install".`
|
|
250029
|
+
}
|
|
250030
|
+
]
|
|
250031
|
+
});
|
|
250032
|
+
}
|
|
250033
|
+
await runTask("Installing site dependencies...", () => execa({ cwd: project.root, shell: true })`${installCommand}`, {
|
|
250034
|
+
successMessage: "Dependencies installed",
|
|
250035
|
+
errorMessage: "Install failed"
|
|
250036
|
+
});
|
|
250037
|
+
return {
|
|
250038
|
+
outroMessage: `Installed with ${theme.styles.bold(installCommand)}`
|
|
250039
|
+
};
|
|
250040
|
+
}
|
|
250041
|
+
function getInstallCommand() {
|
|
250042
|
+
return new Base44Command("install", {
|
|
250043
|
+
requireAuth: false,
|
|
250044
|
+
requireAppContext: false
|
|
250045
|
+
}).description("Install the site's dependencies with its configured command").action(installAction);
|
|
250046
|
+
}
|
|
250047
|
+
|
|
249981
250048
|
// src/cli/commands/project/app-id-options.ts
|
|
249982
250049
|
function readExplicitAppId(command) {
|
|
249983
250050
|
const { appId } = command.optsWithGlobals();
|
|
@@ -251057,6 +251124,219 @@ function parseConcurrency(value) {
|
|
|
251057
251124
|
return parsed;
|
|
251058
251125
|
}
|
|
251059
251126
|
|
|
251127
|
+
// src/cli/dev/createDevLogger.ts
|
|
251128
|
+
var colorByType = {
|
|
251129
|
+
error: theme.styles.error,
|
|
251130
|
+
warn: theme.styles.warn,
|
|
251131
|
+
log: (input) => input
|
|
251132
|
+
};
|
|
251133
|
+
var stringify = (item) => {
|
|
251134
|
+
if (typeof item === "string") {
|
|
251135
|
+
return item;
|
|
251136
|
+
}
|
|
251137
|
+
if (item instanceof Error) {
|
|
251138
|
+
return item.toString();
|
|
251139
|
+
}
|
|
251140
|
+
try {
|
|
251141
|
+
return JSON.stringify(item, null, 2) ?? String(item);
|
|
251142
|
+
} catch {
|
|
251143
|
+
return String(item);
|
|
251144
|
+
}
|
|
251145
|
+
};
|
|
251146
|
+
function createDevLogger(label, labelColor = theme.styles.dim) {
|
|
251147
|
+
const prefix = label ? `${labelColor(`[${label}]`)} ` : "";
|
|
251148
|
+
const print = (type, ...args) => {
|
|
251149
|
+
const colorize = colorByType[type];
|
|
251150
|
+
console[type](prefix + args.map((item) => colorize(stringify(item))).join(" "));
|
|
251151
|
+
};
|
|
251152
|
+
return {
|
|
251153
|
+
log: (...args) => print("log", ...args),
|
|
251154
|
+
error: (msg, err) => {
|
|
251155
|
+
print("error", msg);
|
|
251156
|
+
if (err) {
|
|
251157
|
+
print("error", err);
|
|
251158
|
+
}
|
|
251159
|
+
},
|
|
251160
|
+
warn: (...args) => print("warn", ...args)
|
|
251161
|
+
};
|
|
251162
|
+
}
|
|
251163
|
+
|
|
251164
|
+
// src/cli/dev/dev-server/serve-runner.ts
|
|
251165
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
251166
|
+
import process21 from "node:process";
|
|
251167
|
+
|
|
251168
|
+
class ServeRunner {
|
|
251169
|
+
command;
|
|
251170
|
+
cwd;
|
|
251171
|
+
env;
|
|
251172
|
+
logger;
|
|
251173
|
+
child;
|
|
251174
|
+
stopping = false;
|
|
251175
|
+
stopPromise;
|
|
251176
|
+
exitListeners = [];
|
|
251177
|
+
constructor(options) {
|
|
251178
|
+
this.command = options.command;
|
|
251179
|
+
this.cwd = options.cwd;
|
|
251180
|
+
this.env = options.env;
|
|
251181
|
+
this.logger = options.logger;
|
|
251182
|
+
}
|
|
251183
|
+
start() {
|
|
251184
|
+
if (this.child) {
|
|
251185
|
+
return;
|
|
251186
|
+
}
|
|
251187
|
+
const stdin = process21.platform === "win32" ? "ignore" : "inherit";
|
|
251188
|
+
const child = spawn2(this.command, {
|
|
251189
|
+
cwd: this.cwd,
|
|
251190
|
+
shell: true,
|
|
251191
|
+
detached: process21.platform !== "win32",
|
|
251192
|
+
env: { ...process21.env, ...this.env },
|
|
251193
|
+
stdio: [stdin, "pipe", "pipe"],
|
|
251194
|
+
windowsHide: true
|
|
251195
|
+
});
|
|
251196
|
+
this.child = child;
|
|
251197
|
+
this.setupHandlers(child);
|
|
251198
|
+
}
|
|
251199
|
+
onExit(listener) {
|
|
251200
|
+
this.exitListeners.push(listener);
|
|
251201
|
+
}
|
|
251202
|
+
async stop() {
|
|
251203
|
+
if (this.stopPromise) {
|
|
251204
|
+
return this.stopPromise;
|
|
251205
|
+
}
|
|
251206
|
+
this.stopPromise = this.stopChild();
|
|
251207
|
+
return this.stopPromise;
|
|
251208
|
+
}
|
|
251209
|
+
async stopChild() {
|
|
251210
|
+
const child = this.child;
|
|
251211
|
+
if (!child || child.exitCode !== null) {
|
|
251212
|
+
return;
|
|
251213
|
+
}
|
|
251214
|
+
this.stopping = true;
|
|
251215
|
+
const exited = new Promise((resolve) => child.once("exit", () => resolve()));
|
|
251216
|
+
if (process21.platform === "win32" && child.pid) {
|
|
251217
|
+
const taskkill = spawn2("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
251218
|
+
stdio: "ignore",
|
|
251219
|
+
windowsHide: true
|
|
251220
|
+
});
|
|
251221
|
+
await new Promise((resolve) => {
|
|
251222
|
+
taskkill.once("exit", () => resolve());
|
|
251223
|
+
taskkill.once("error", () => resolve());
|
|
251224
|
+
});
|
|
251225
|
+
} else if (child.pid) {
|
|
251226
|
+
try {
|
|
251227
|
+
process21.kill(-child.pid, "SIGTERM");
|
|
251228
|
+
} catch {
|
|
251229
|
+
child.kill();
|
|
251230
|
+
}
|
|
251231
|
+
}
|
|
251232
|
+
await exited;
|
|
251233
|
+
}
|
|
251234
|
+
setupHandlers(child) {
|
|
251235
|
+
child.stdout?.on("data", (data) => this.emitLines(data, "log"));
|
|
251236
|
+
child.stderr?.on("data", (data) => this.emitLines(data, "error"));
|
|
251237
|
+
child.on("error", (error) => {
|
|
251238
|
+
this.logger.error("Frontend dev server failed to start:", error);
|
|
251239
|
+
this.notifyExit(null);
|
|
251240
|
+
});
|
|
251241
|
+
child.on("exit", (code) => {
|
|
251242
|
+
if (this.stopping) {
|
|
251243
|
+
return;
|
|
251244
|
+
}
|
|
251245
|
+
this.logger.error(`Frontend dev server exited with code ${code}`);
|
|
251246
|
+
this.notifyExit(code);
|
|
251247
|
+
});
|
|
251248
|
+
}
|
|
251249
|
+
notifyExit(code) {
|
|
251250
|
+
for (const listener of this.exitListeners) {
|
|
251251
|
+
listener(code);
|
|
251252
|
+
}
|
|
251253
|
+
}
|
|
251254
|
+
emitLines(data, type) {
|
|
251255
|
+
const lines = data.toString().trimEnd().split(`
|
|
251256
|
+
`);
|
|
251257
|
+
for (const line of lines) {
|
|
251258
|
+
if (type === "error") {
|
|
251259
|
+
this.logger.error(line);
|
|
251260
|
+
} else {
|
|
251261
|
+
this.logger.log(line);
|
|
251262
|
+
}
|
|
251263
|
+
}
|
|
251264
|
+
}
|
|
251265
|
+
}
|
|
251266
|
+
|
|
251267
|
+
// src/cli/dev/serve-command-runner.ts
|
|
251268
|
+
function createServeCommandRunner({
|
|
251269
|
+
serveCommand,
|
|
251270
|
+
projectRoot,
|
|
251271
|
+
appId,
|
|
251272
|
+
appBaseUrl
|
|
251273
|
+
}) {
|
|
251274
|
+
return new ServeRunner({
|
|
251275
|
+
command: serveCommand,
|
|
251276
|
+
cwd: projectRoot,
|
|
251277
|
+
env: {
|
|
251278
|
+
VITE_BASE44_APP_ID: appId,
|
|
251279
|
+
...appBaseUrl ? { VITE_BASE44_APP_BASE_URL: appBaseUrl } : {}
|
|
251280
|
+
},
|
|
251281
|
+
logger: createDevLogger("frontend", theme.colors.base44Orange)
|
|
251282
|
+
});
|
|
251283
|
+
}
|
|
251284
|
+
|
|
251285
|
+
// src/cli/dev/stop-runner-on-signals.ts
|
|
251286
|
+
import process22 from "node:process";
|
|
251287
|
+
function stopRunnerOnProcessSignals(runner) {
|
|
251288
|
+
const stop = () => void runner.stop();
|
|
251289
|
+
process22.on("SIGINT", stop);
|
|
251290
|
+
process22.on("SIGTERM", stop);
|
|
251291
|
+
}
|
|
251292
|
+
|
|
251293
|
+
// src/cli/commands/site/dev.ts
|
|
251294
|
+
function parsePort(value) {
|
|
251295
|
+
if (!/^\d+$/.test(value)) {
|
|
251296
|
+
throw new InvalidArgumentError2("must be a whole number");
|
|
251297
|
+
}
|
|
251298
|
+
const port = Number(value);
|
|
251299
|
+
if (port < 1 || port > 65535) {
|
|
251300
|
+
throw new InvalidArgumentError2("must be between 1 and 65535");
|
|
251301
|
+
}
|
|
251302
|
+
return port;
|
|
251303
|
+
}
|
|
251304
|
+
async function siteDevAction(ctx, options) {
|
|
251305
|
+
const { app } = ctx;
|
|
251306
|
+
if (!app?.projectRoot) {
|
|
251307
|
+
throw new ConfigInvalidError("base44 site dev requires a linked local project. Run it from a project with base44/.app.jsonc.");
|
|
251308
|
+
}
|
|
251309
|
+
const { project } = await readProjectConfig(app.projectRoot);
|
|
251310
|
+
const site = project.site;
|
|
251311
|
+
if (!site) {
|
|
251312
|
+
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".`);
|
|
251313
|
+
}
|
|
251314
|
+
const serveCommand = site.serveCommand ?? DEFAULT_SERVE_COMMAND;
|
|
251315
|
+
const { command, droppedAddress } = withServeAddress(serveCommand, {
|
|
251316
|
+
host: options.host,
|
|
251317
|
+
port: options.port,
|
|
251318
|
+
hostFlag: site.devHostFlag
|
|
251319
|
+
});
|
|
251320
|
+
if (droppedAddress) {
|
|
251321
|
+
throw new InvalidInputError(`serveCommand '${serveCommand}' takes no forwarded arguments, so --host/--port cannot be passed to it. Put the address in serveCommand itself, or use an 'npm run', 'pnpm', 'yarn' or 'bun run' script.`);
|
|
251322
|
+
}
|
|
251323
|
+
const runner = createServeCommandRunner({
|
|
251324
|
+
serveCommand: command,
|
|
251325
|
+
projectRoot: project.root,
|
|
251326
|
+
appId: app.id,
|
|
251327
|
+
appBaseUrl: options.backendUrl
|
|
251328
|
+
});
|
|
251329
|
+
stopRunnerOnProcessSignals(runner);
|
|
251330
|
+
runner.onExit((code) => process.exit(code ?? 1));
|
|
251331
|
+
runner.start();
|
|
251332
|
+
return {
|
|
251333
|
+
outroMessage: options.backendUrl ? `Frontend dev server running '${command}' against ${theme.styles.bold(options.backendUrl)}` : `Frontend dev server running '${command}'`
|
|
251334
|
+
};
|
|
251335
|
+
}
|
|
251336
|
+
function getSiteDevCommand() {
|
|
251337
|
+
return new Base44Command("dev", { requireAuth: false }).description("Run the site's dev server against a given backend (no local backend)").option("--backend-url <url>", "Backend the frontend should call, injected as VITE_BASE44_APP_BASE_URL. Omit for a frontend that reaches its backend same-origin.").option("--host <address>", "Address to bind, e.g. 0.0.0.0").option("--port <number>", "Port to bind", parsePort).action(siteDevAction);
|
|
251338
|
+
}
|
|
251339
|
+
|
|
251060
251340
|
// src/cli/commands/site/open.ts
|
|
251061
251341
|
async function openAction({
|
|
251062
251342
|
isNonInteractive
|
|
@@ -251073,7 +251353,7 @@ function getSiteOpenCommand() {
|
|
|
251073
251353
|
|
|
251074
251354
|
// src/cli/commands/site/index.ts
|
|
251075
251355
|
function getSiteCommand() {
|
|
251076
|
-
return new Command2("site").description("Manage app site (frontend app)").addCommand(getSiteDeployCommand()).addCommand(getSiteOpenCommand());
|
|
251356
|
+
return new Command2("site").description("Manage app site (frontend app)").addCommand(getSiteDeployCommand()).addCommand(getSiteDevCommand()).addCommand(getSiteOpenCommand());
|
|
251077
251357
|
}
|
|
251078
251358
|
|
|
251079
251359
|
// src/core/types/generator.ts
|
|
@@ -251593,43 +251873,6 @@ function getWorkspaceCommand() {
|
|
|
251593
251873
|
return new Command2("workspace").description("List workspaces, inspect one, and move apps between them").addCommand(getWorkspaceListCommand()).addCommand(getWorkspaceGetCommand()).addCommand(getWorkspaceMoveCommand());
|
|
251594
251874
|
}
|
|
251595
251875
|
|
|
251596
|
-
// src/cli/dev/createDevLogger.ts
|
|
251597
|
-
var colorByType = {
|
|
251598
|
-
error: theme.styles.error,
|
|
251599
|
-
warn: theme.styles.warn,
|
|
251600
|
-
log: (input) => input
|
|
251601
|
-
};
|
|
251602
|
-
var stringify = (item) => {
|
|
251603
|
-
if (typeof item === "string") {
|
|
251604
|
-
return item;
|
|
251605
|
-
}
|
|
251606
|
-
if (item instanceof Error) {
|
|
251607
|
-
return item.toString();
|
|
251608
|
-
}
|
|
251609
|
-
try {
|
|
251610
|
-
return JSON.stringify(item, null, 2) ?? String(item);
|
|
251611
|
-
} catch {
|
|
251612
|
-
return String(item);
|
|
251613
|
-
}
|
|
251614
|
-
};
|
|
251615
|
-
function createDevLogger(label, labelColor = theme.styles.dim) {
|
|
251616
|
-
const prefix = label ? `${labelColor(`[${label}]`)} ` : "";
|
|
251617
|
-
const print = (type, ...args) => {
|
|
251618
|
-
const colorize = colorByType[type];
|
|
251619
|
-
console[type](prefix + args.map((item) => colorize(stringify(item))).join(" "));
|
|
251620
|
-
};
|
|
251621
|
-
return {
|
|
251622
|
-
log: (...args) => print("log", ...args),
|
|
251623
|
-
error: (msg, err) => {
|
|
251624
|
-
print("error", msg);
|
|
251625
|
-
if (err) {
|
|
251626
|
-
print("error", err);
|
|
251627
|
-
}
|
|
251628
|
-
},
|
|
251629
|
-
warn: (...args) => print("warn", ...args)
|
|
251630
|
-
};
|
|
251631
|
-
}
|
|
251632
|
-
|
|
251633
251876
|
// src/cli/dev/dev-server/main.ts
|
|
251634
251877
|
var import_cors = __toESM(require_lib4(), 1);
|
|
251635
251878
|
var import_express6 = __toESM(require_express(), 1);
|
|
@@ -251762,7 +252005,7 @@ var $dir = async (options) => dirWithOptions(options);
|
|
|
251762
252005
|
var $tmpName = promisify11(tmp.tmpName);
|
|
251763
252006
|
|
|
251764
252007
|
// src/cli/dev/dev-server/function-manager.ts
|
|
251765
|
-
import { spawn as
|
|
252008
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
251766
252009
|
import { dirname as dirname23, join as join31 } from "node:path";
|
|
251767
252010
|
import { pathToFileURL } from "node:url";
|
|
251768
252011
|
|
|
@@ -251860,7 +252103,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
251860
252103
|
async stopFunction(_name, { process: proc }) {
|
|
251861
252104
|
const exited = new Promise((r) => proc.once("exit", () => r()));
|
|
251862
252105
|
if (process.platform === "win32" && proc.pid) {
|
|
251863
|
-
|
|
252106
|
+
spawn3("taskkill", ["/pid", String(proc.pid), "/T", "/F"]);
|
|
251864
252107
|
} else {
|
|
251865
252108
|
proc.kill();
|
|
251866
252109
|
}
|
|
@@ -251869,7 +252112,7 @@ class FunctionManager extends BaseFunctionManager {
|
|
|
251869
252112
|
spawnFunction(func, port) {
|
|
251870
252113
|
this.logger.log(`Spawning function "${func.name}" on port ${port}`);
|
|
251871
252114
|
const importMapPath = join31(dirname23(this.wrapperPath), "import-map.json");
|
|
251872
|
-
const process2 =
|
|
252115
|
+
const process2 = spawn3("deno", ["run", "--allow-all", "--import-map", importMapPath, this.wrapperPath], {
|
|
251873
252116
|
env: {
|
|
251874
252117
|
...globalThis.process.env,
|
|
251875
252118
|
FUNCTION_PATH: pathToFileURL(func.entryPath).href,
|
|
@@ -255399,127 +255642,6 @@ async function createDevServer(options) {
|
|
|
255399
255642
|
return { port, server, shutdown };
|
|
255400
255643
|
}
|
|
255401
255644
|
|
|
255402
|
-
// src/cli/dev/dev-server/serve-runner.ts
|
|
255403
|
-
import { spawn as spawn3 } from "node:child_process";
|
|
255404
|
-
import process23 from "node:process";
|
|
255405
|
-
|
|
255406
|
-
class ServeRunner {
|
|
255407
|
-
command;
|
|
255408
|
-
cwd;
|
|
255409
|
-
env;
|
|
255410
|
-
logger;
|
|
255411
|
-
child;
|
|
255412
|
-
stopping = false;
|
|
255413
|
-
stopPromise;
|
|
255414
|
-
exitListeners = [];
|
|
255415
|
-
constructor(options) {
|
|
255416
|
-
this.command = options.command;
|
|
255417
|
-
this.cwd = options.cwd;
|
|
255418
|
-
this.env = options.env;
|
|
255419
|
-
this.logger = options.logger;
|
|
255420
|
-
}
|
|
255421
|
-
start() {
|
|
255422
|
-
if (this.child) {
|
|
255423
|
-
return;
|
|
255424
|
-
}
|
|
255425
|
-
const stdin = process23.platform === "win32" ? "ignore" : "inherit";
|
|
255426
|
-
const child = spawn3(this.command, {
|
|
255427
|
-
cwd: this.cwd,
|
|
255428
|
-
shell: true,
|
|
255429
|
-
detached: process23.platform !== "win32",
|
|
255430
|
-
env: { ...process23.env, ...this.env },
|
|
255431
|
-
stdio: [stdin, "pipe", "pipe"],
|
|
255432
|
-
windowsHide: true
|
|
255433
|
-
});
|
|
255434
|
-
this.child = child;
|
|
255435
|
-
this.setupHandlers(child);
|
|
255436
|
-
}
|
|
255437
|
-
onExit(listener) {
|
|
255438
|
-
this.exitListeners.push(listener);
|
|
255439
|
-
}
|
|
255440
|
-
async stop() {
|
|
255441
|
-
if (this.stopPromise) {
|
|
255442
|
-
return this.stopPromise;
|
|
255443
|
-
}
|
|
255444
|
-
this.stopPromise = this.stopChild();
|
|
255445
|
-
return this.stopPromise;
|
|
255446
|
-
}
|
|
255447
|
-
async stopChild() {
|
|
255448
|
-
const child = this.child;
|
|
255449
|
-
if (!child || child.exitCode !== null) {
|
|
255450
|
-
return;
|
|
255451
|
-
}
|
|
255452
|
-
this.stopping = true;
|
|
255453
|
-
const exited = new Promise((resolve) => child.once("exit", () => resolve()));
|
|
255454
|
-
if (process23.platform === "win32" && child.pid) {
|
|
255455
|
-
const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
255456
|
-
stdio: "ignore",
|
|
255457
|
-
windowsHide: true
|
|
255458
|
-
});
|
|
255459
|
-
await new Promise((resolve) => {
|
|
255460
|
-
taskkill.once("exit", () => resolve());
|
|
255461
|
-
taskkill.once("error", () => resolve());
|
|
255462
|
-
});
|
|
255463
|
-
} else if (child.pid) {
|
|
255464
|
-
try {
|
|
255465
|
-
process23.kill(-child.pid, "SIGTERM");
|
|
255466
|
-
} catch {
|
|
255467
|
-
child.kill();
|
|
255468
|
-
}
|
|
255469
|
-
}
|
|
255470
|
-
await exited;
|
|
255471
|
-
}
|
|
255472
|
-
setupHandlers(child) {
|
|
255473
|
-
child.stdout?.on("data", (data) => this.emitLines(data, "log"));
|
|
255474
|
-
child.stderr?.on("data", (data) => this.emitLines(data, "error"));
|
|
255475
|
-
child.on("error", (error) => {
|
|
255476
|
-
this.logger.error("Frontend dev server failed to start:", error);
|
|
255477
|
-
this.notifyExit(null);
|
|
255478
|
-
});
|
|
255479
|
-
child.on("exit", (code) => {
|
|
255480
|
-
if (this.stopping) {
|
|
255481
|
-
return;
|
|
255482
|
-
}
|
|
255483
|
-
this.logger.error(`Frontend dev server exited with code ${code}`);
|
|
255484
|
-
this.notifyExit(code);
|
|
255485
|
-
});
|
|
255486
|
-
}
|
|
255487
|
-
notifyExit(code) {
|
|
255488
|
-
for (const listener of this.exitListeners) {
|
|
255489
|
-
listener(code);
|
|
255490
|
-
}
|
|
255491
|
-
}
|
|
255492
|
-
emitLines(data, type) {
|
|
255493
|
-
const lines = data.toString().trimEnd().split(`
|
|
255494
|
-
`);
|
|
255495
|
-
for (const line of lines) {
|
|
255496
|
-
if (type === "error") {
|
|
255497
|
-
this.logger.error(line);
|
|
255498
|
-
} else {
|
|
255499
|
-
this.logger.log(line);
|
|
255500
|
-
}
|
|
255501
|
-
}
|
|
255502
|
-
}
|
|
255503
|
-
}
|
|
255504
|
-
|
|
255505
|
-
// src/cli/dev/serve-command-runner.ts
|
|
255506
|
-
function createServeCommandRunner({
|
|
255507
|
-
serveCommand,
|
|
255508
|
-
projectRoot,
|
|
255509
|
-
appId,
|
|
255510
|
-
appBaseUrl
|
|
255511
|
-
}) {
|
|
255512
|
-
return new ServeRunner({
|
|
255513
|
-
command: serveCommand,
|
|
255514
|
-
cwd: projectRoot,
|
|
255515
|
-
env: {
|
|
255516
|
-
VITE_BASE44_APP_ID: appId,
|
|
255517
|
-
VITE_BASE44_APP_BASE_URL: appBaseUrl
|
|
255518
|
-
},
|
|
255519
|
-
logger: createDevLogger("frontend", theme.colors.base44Orange)
|
|
255520
|
-
});
|
|
255521
|
-
}
|
|
255522
|
-
|
|
255523
255645
|
// src/cli/commands/dev.ts
|
|
255524
255646
|
function localServerUrl(port) {
|
|
255525
255647
|
return `http://localhost:${port}`;
|
|
@@ -255545,11 +255667,6 @@ async function resolveConfiguredSite(app) {
|
|
|
255545
255667
|
const serveCommand = project.site?.serveCommand;
|
|
255546
255668
|
return serveCommand ? { serveCommand, projectRoot: project.root } : undefined;
|
|
255547
255669
|
}
|
|
255548
|
-
function stopRunnerOnProcessSignals(runner) {
|
|
255549
|
-
const stop = () => void runner.stop();
|
|
255550
|
-
process.on("SIGINT", stop);
|
|
255551
|
-
process.on("SIGTERM", stop);
|
|
255552
|
-
}
|
|
255553
255670
|
function startServeCommand(runner, backend) {
|
|
255554
255671
|
stopRunnerOnProcessSignals(runner);
|
|
255555
255672
|
runner.onExit(() => {
|
|
@@ -255663,7 +255780,7 @@ function readStdin2() {
|
|
|
255663
255780
|
process.stdin.on("error", reject);
|
|
255664
255781
|
});
|
|
255665
255782
|
}
|
|
255666
|
-
function
|
|
255783
|
+
function parsePort2(value) {
|
|
255667
255784
|
const port = Number(value);
|
|
255668
255785
|
if (!Number.isInteger(port) || port <= 0 || port > 65535) {
|
|
255669
255786
|
throw new InvalidInputError(`Invalid --port value: "${value}".`, {
|
|
@@ -255700,7 +255817,7 @@ async function execAction({ app, isNonInteractive }, options) {
|
|
|
255700
255817
|
if (!code.trim()) {
|
|
255701
255818
|
throw noInputError;
|
|
255702
255819
|
}
|
|
255703
|
-
const local = options.local ? await resolveLocalTarget(options.port !== undefined ?
|
|
255820
|
+
const local = options.local ? await resolveLocalTarget(options.port !== undefined ? parsePort2(options.port) : DEFAULT_DEV_SERVER_PORT) : undefined;
|
|
255704
255821
|
const { exitCode } = await runScript({
|
|
255705
255822
|
appId: app.id,
|
|
255706
255823
|
code,
|
|
@@ -255819,9 +255936,15 @@ async function eject(ctx, options, command) {
|
|
|
255819
255936
|
});
|
|
255820
255937
|
if (!Ct(shouldDeploy) && shouldDeploy) {
|
|
255821
255938
|
await runTask("Installing dependencies...", async (updateMessage) => {
|
|
255822
|
-
await execa({
|
|
255939
|
+
await execa({
|
|
255940
|
+
cwd: resolvedPath,
|
|
255941
|
+
shell: true
|
|
255942
|
+
})`${site.installCommand}`;
|
|
255823
255943
|
updateMessage("Building project...");
|
|
255824
|
-
await execa({
|
|
255944
|
+
await execa({
|
|
255945
|
+
cwd: resolvedPath,
|
|
255946
|
+
shell: true
|
|
255947
|
+
})`${site.buildCommand}`;
|
|
255825
255948
|
}, {
|
|
255826
255949
|
successMessage: theme.colors.base44Orange("Project built successfully"),
|
|
255827
255950
|
errorMessage: "Failed to build project"
|
|
@@ -255859,6 +255982,7 @@ function createProgram(context) {
|
|
|
255859
255982
|
program.addCommand(getCreateCommand());
|
|
255860
255983
|
program.addCommand(getScaffoldCommand());
|
|
255861
255984
|
program.addCommand(getDashboardCommand());
|
|
255985
|
+
program.addCommand(getInstallCommand());
|
|
255862
255986
|
program.addCommand(getBuildCommand());
|
|
255863
255987
|
program.addCommand(getDeployCommand3());
|
|
255864
255988
|
program.addCommand(getVisibilityCommand());
|
|
@@ -259928,4 +260052,4 @@ export {
|
|
|
259928
260052
|
runCLI
|
|
259929
260053
|
};
|
|
259930
260054
|
|
|
259931
|
-
//# debugId=
|
|
260055
|
+
//# debugId=641CFB9F676DAC6564756E2164756E21
|