@base44-preview/cli 0.1.6-pr.580.7cd67af → 0.1.6-pr.580.9cdb7f2
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 +209 -206
- package/dist/cli/index.js.map +8 -8
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -163190,7 +163190,7 @@ var require_stringify5 = __commonJS((exports, module) => {
|
|
|
163190
163190
|
return typeof v10 === "string" || typeof v10 === "number" || typeof v10 === "boolean" || typeof v10 === "symbol" || typeof v10 === "bigint";
|
|
163191
163191
|
};
|
|
163192
163192
|
var sentinel = {};
|
|
163193
|
-
var
|
|
163193
|
+
var stringify = function stringify2(object2, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter2, sort, allowDots, serializeDate, format3, formatter, encodeValuesOnly, charset, sideChannel) {
|
|
163194
163194
|
var obj = object2;
|
|
163195
163195
|
var tmpSc = sideChannel;
|
|
163196
163196
|
var step = 0;
|
|
@@ -163266,7 +163266,7 @@ var require_stringify5 = __commonJS((exports, module) => {
|
|
|
163266
163266
|
sideChannel.set(object2, step);
|
|
163267
163267
|
var valueSideChannel = getSideChannel();
|
|
163268
163268
|
valueSideChannel.set(sentinel, sideChannel);
|
|
163269
|
-
pushToArray(values,
|
|
163269
|
+
pushToArray(values, stringify2(value, keyPrefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null : encoder, filter2, sort, allowDots, serializeDate, format3, formatter, encodeValuesOnly, charset, valueSideChannel));
|
|
163270
163270
|
}
|
|
163271
163271
|
return values;
|
|
163272
163272
|
};
|
|
@@ -163364,7 +163364,7 @@ var require_stringify5 = __commonJS((exports, module) => {
|
|
|
163364
163364
|
if (options8.skipNulls && value === null) {
|
|
163365
163365
|
continue;
|
|
163366
163366
|
}
|
|
163367
|
-
pushToArray(keys,
|
|
163367
|
+
pushToArray(keys, stringify(value, key2, generateArrayPrefix, commaRoundTrip, options8.allowEmptyArrays, options8.strictNullHandling, options8.skipNulls, options8.encodeDotInKeys, options8.encode ? options8.encoder : null, options8.filter, options8.sort, options8.allowDots, options8.serializeDate, options8.format, options8.formatter, options8.encodeValuesOnly, options8.charset, sideChannel));
|
|
163368
163368
|
}
|
|
163369
163369
|
var joined = keys.join(options8.delimiter);
|
|
163370
163370
|
var prefix = options8.addQueryPrefix === true ? "?" : "";
|
|
@@ -163654,13 +163654,13 @@ var require_parse8 = __commonJS((exports, module) => {
|
|
|
163654
163654
|
|
|
163655
163655
|
// ../../node_modules/qs/lib/index.js
|
|
163656
163656
|
var require_lib6 = __commonJS((exports, module) => {
|
|
163657
|
-
var
|
|
163657
|
+
var stringify = require_stringify5();
|
|
163658
163658
|
var parse11 = require_parse8();
|
|
163659
163659
|
var formats = require_formats();
|
|
163660
163660
|
module.exports = {
|
|
163661
163661
|
formats,
|
|
163662
163662
|
parse: parse11,
|
|
163663
|
-
stringify
|
|
163663
|
+
stringify
|
|
163664
163664
|
};
|
|
163665
163665
|
});
|
|
163666
163666
|
|
|
@@ -165293,7 +165293,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
165293
165293
|
exports.compile = compile2;
|
|
165294
165294
|
exports.match = match;
|
|
165295
165295
|
exports.pathToRegexp = pathToRegexp;
|
|
165296
|
-
exports.stringify =
|
|
165296
|
+
exports.stringify = stringify;
|
|
165297
165297
|
var DEFAULT_DELIMITER = "/";
|
|
165298
165298
|
var NOOP_VALUE = (value) => value;
|
|
165299
165299
|
var ID_START = /^[$_\p{ID_Start}]$/u;
|
|
@@ -165623,7 +165623,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
165623
165623
|
}
|
|
165624
165624
|
return value;
|
|
165625
165625
|
}
|
|
165626
|
-
function
|
|
165626
|
+
function stringify(data) {
|
|
165627
165627
|
return stringifyTokens(data.tokens);
|
|
165628
165628
|
}
|
|
165629
165629
|
function isNameSafe(name2) {
|
|
@@ -168490,7 +168490,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168490
168490
|
var escape3 = app.get("json escape");
|
|
168491
168491
|
var replacer = app.get("json replacer");
|
|
168492
168492
|
var spaces = app.get("json spaces");
|
|
168493
|
-
var body =
|
|
168493
|
+
var body = stringify(obj, replacer, spaces, escape3);
|
|
168494
168494
|
if (!this.get("Content-Type")) {
|
|
168495
168495
|
this.set("Content-Type", "application/json");
|
|
168496
168496
|
}
|
|
@@ -168501,7 +168501,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168501
168501
|
var escape3 = app.get("json escape");
|
|
168502
168502
|
var replacer = app.get("json replacer");
|
|
168503
168503
|
var spaces = app.get("json spaces");
|
|
168504
|
-
var body =
|
|
168504
|
+
var body = stringify(obj, replacer, spaces, escape3);
|
|
168505
168505
|
var callback = this.req.query[app.get("jsonp callback name")];
|
|
168506
168506
|
if (!this.get("Content-Type")) {
|
|
168507
168507
|
this.set("X-Content-Type-Options", "nosniff");
|
|
@@ -168820,7 +168820,7 @@ var require_response = __commonJS((exports, module) => {
|
|
|
168820
168820
|
}
|
|
168821
168821
|
file2.pipe(res2);
|
|
168822
168822
|
}
|
|
168823
|
-
function
|
|
168823
|
+
function stringify(value, replacer, spaces, escape3) {
|
|
168824
168824
|
var json3 = replacer || spaces ? JSON.stringify(value, replacer, spaces) : JSON.stringify(value);
|
|
168825
168825
|
if (escape3 && typeof json3 === "string") {
|
|
168826
168826
|
json3 = json3.replace(/[<>&]/g, function(c8) {
|
|
@@ -258285,43 +258285,6 @@ function getWorkspaceCommand() {
|
|
|
258285
258285
|
return new Command("workspace").description("List workspaces, inspect one, and move apps between them").addCommand(getWorkspaceListCommand()).addCommand(getWorkspaceGetCommand()).addCommand(getWorkspaceMoveCommand());
|
|
258286
258286
|
}
|
|
258287
258287
|
|
|
258288
|
-
// src/cli/dev/createDevLogger.ts
|
|
258289
|
-
var colorByType = {
|
|
258290
|
-
error: theme.styles.error,
|
|
258291
|
-
warn: theme.styles.warn,
|
|
258292
|
-
log: (input) => input
|
|
258293
|
-
};
|
|
258294
|
-
var stringify = (item) => {
|
|
258295
|
-
if (typeof item === "string") {
|
|
258296
|
-
return item;
|
|
258297
|
-
}
|
|
258298
|
-
if (item instanceof Error) {
|
|
258299
|
-
return item.toString();
|
|
258300
|
-
}
|
|
258301
|
-
try {
|
|
258302
|
-
return JSON.stringify(item, null, 2) ?? String(item);
|
|
258303
|
-
} catch {
|
|
258304
|
-
return String(item);
|
|
258305
|
-
}
|
|
258306
|
-
};
|
|
258307
|
-
function createDevLogger(label2, labelColor = theme.styles.dim) {
|
|
258308
|
-
const prefix = label2 ? `${labelColor(`[${label2}]`)} ` : "";
|
|
258309
|
-
const print = (type, ...args) => {
|
|
258310
|
-
const colorize = colorByType[type];
|
|
258311
|
-
console[type](prefix + args.map((item) => colorize(stringify(item))).join(" "));
|
|
258312
|
-
};
|
|
258313
|
-
return {
|
|
258314
|
-
log: (...args) => print("log", ...args),
|
|
258315
|
-
error: (msg, err) => {
|
|
258316
|
-
print("error", msg);
|
|
258317
|
-
if (err) {
|
|
258318
|
-
print("error", err);
|
|
258319
|
-
}
|
|
258320
|
-
},
|
|
258321
|
-
warn: (...args) => print("warn", ...args)
|
|
258322
|
-
};
|
|
258323
|
-
}
|
|
258324
|
-
|
|
258325
258288
|
// src/cli/dev/dev-server/main.ts
|
|
258326
258289
|
var import_cors = __toESM(require_lib4(), 1);
|
|
258327
258290
|
var import_express6 = __toESM(require_express(), 1);
|
|
@@ -258458,6 +258421,43 @@ var $tmpName = promisify11(tmp.tmpName);
|
|
|
258458
258421
|
var $tmpdir = tmp.tmpdir;
|
|
258459
258422
|
var $setGracefulCleanup = tmp.setGracefulCleanup;
|
|
258460
258423
|
|
|
258424
|
+
// src/cli/dev/createDevLogger.ts
|
|
258425
|
+
var colorByType = {
|
|
258426
|
+
error: theme.styles.error,
|
|
258427
|
+
warn: theme.styles.warn,
|
|
258428
|
+
log: (input) => input
|
|
258429
|
+
};
|
|
258430
|
+
var stringify = (item) => {
|
|
258431
|
+
if (typeof item === "string") {
|
|
258432
|
+
return item;
|
|
258433
|
+
}
|
|
258434
|
+
if (item instanceof Error) {
|
|
258435
|
+
return item.toString();
|
|
258436
|
+
}
|
|
258437
|
+
try {
|
|
258438
|
+
return JSON.stringify(item, null, 2) ?? String(item);
|
|
258439
|
+
} catch {
|
|
258440
|
+
return String(item);
|
|
258441
|
+
}
|
|
258442
|
+
};
|
|
258443
|
+
function createDevLogger(label2, labelColor = theme.styles.dim) {
|
|
258444
|
+
const prefix = label2 ? `${labelColor(`[${label2}]`)} ` : "";
|
|
258445
|
+
const print = (type, ...args) => {
|
|
258446
|
+
const colorize = colorByType[type];
|
|
258447
|
+
console[type](prefix + args.map((item) => colorize(stringify(item))).join(" "));
|
|
258448
|
+
};
|
|
258449
|
+
return {
|
|
258450
|
+
log: (...args) => print("log", ...args),
|
|
258451
|
+
error: (msg, err) => {
|
|
258452
|
+
print("error", msg);
|
|
258453
|
+
if (err) {
|
|
258454
|
+
print("error", err);
|
|
258455
|
+
}
|
|
258456
|
+
},
|
|
258457
|
+
warn: (...args) => print("warn", ...args)
|
|
258458
|
+
};
|
|
258459
|
+
}
|
|
258460
|
+
|
|
258461
258461
|
// src/cli/dev/dev-server/function-manager.ts
|
|
258462
258462
|
import { spawn as spawn2 } from "node:child_process";
|
|
258463
258463
|
import { dirname as dirname20, join as join27 } from "node:path";
|
|
@@ -260211,6 +260211,109 @@ function createCustomIntegrationRoutes(remoteProxy, logger2) {
|
|
|
260211
260211
|
return router;
|
|
260212
260212
|
}
|
|
260213
260213
|
|
|
260214
|
+
// src/cli/dev/dev-server/serve-runner.ts
|
|
260215
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
260216
|
+
import process23 from "node:process";
|
|
260217
|
+
|
|
260218
|
+
class ServeRunner {
|
|
260219
|
+
command;
|
|
260220
|
+
cwd;
|
|
260221
|
+
env;
|
|
260222
|
+
logger;
|
|
260223
|
+
child;
|
|
260224
|
+
stopping = false;
|
|
260225
|
+
stopPromise;
|
|
260226
|
+
exitListeners = [];
|
|
260227
|
+
constructor(options8) {
|
|
260228
|
+
this.command = options8.command;
|
|
260229
|
+
this.cwd = options8.cwd;
|
|
260230
|
+
this.env = options8.env;
|
|
260231
|
+
this.logger = options8.logger;
|
|
260232
|
+
}
|
|
260233
|
+
start() {
|
|
260234
|
+
if (this.child) {
|
|
260235
|
+
return;
|
|
260236
|
+
}
|
|
260237
|
+
const stdin2 = process23.platform === "win32" ? "ignore" : "inherit";
|
|
260238
|
+
const child = spawn3(this.command, {
|
|
260239
|
+
cwd: this.cwd,
|
|
260240
|
+
shell: true,
|
|
260241
|
+
detached: process23.platform !== "win32",
|
|
260242
|
+
env: { ...process23.env, ...this.env },
|
|
260243
|
+
stdio: [stdin2, "pipe", "pipe"],
|
|
260244
|
+
windowsHide: true
|
|
260245
|
+
});
|
|
260246
|
+
this.child = child;
|
|
260247
|
+
this.setupHandlers(child);
|
|
260248
|
+
}
|
|
260249
|
+
onExit(listener) {
|
|
260250
|
+
this.exitListeners.push(listener);
|
|
260251
|
+
}
|
|
260252
|
+
async stop() {
|
|
260253
|
+
if (this.stopPromise) {
|
|
260254
|
+
return this.stopPromise;
|
|
260255
|
+
}
|
|
260256
|
+
this.stopPromise = this.stopChild();
|
|
260257
|
+
return this.stopPromise;
|
|
260258
|
+
}
|
|
260259
|
+
async stopChild() {
|
|
260260
|
+
const child = this.child;
|
|
260261
|
+
if (!child || child.exitCode !== null) {
|
|
260262
|
+
return;
|
|
260263
|
+
}
|
|
260264
|
+
this.stopping = true;
|
|
260265
|
+
const exited = new Promise((resolve13) => child.once("exit", () => resolve13()));
|
|
260266
|
+
if (process23.platform === "win32" && child.pid) {
|
|
260267
|
+
const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
260268
|
+
stdio: "ignore",
|
|
260269
|
+
windowsHide: true
|
|
260270
|
+
});
|
|
260271
|
+
await new Promise((resolve13) => {
|
|
260272
|
+
taskkill.once("exit", () => resolve13());
|
|
260273
|
+
taskkill.once("error", () => resolve13());
|
|
260274
|
+
});
|
|
260275
|
+
} else if (child.pid) {
|
|
260276
|
+
try {
|
|
260277
|
+
process23.kill(-child.pid, "SIGTERM");
|
|
260278
|
+
} catch {
|
|
260279
|
+
child.kill();
|
|
260280
|
+
}
|
|
260281
|
+
}
|
|
260282
|
+
await exited;
|
|
260283
|
+
}
|
|
260284
|
+
setupHandlers(child) {
|
|
260285
|
+
child.stdout?.on("data", (data) => this.emitLines(data, "log"));
|
|
260286
|
+
child.stderr?.on("data", (data) => this.emitLines(data, "error"));
|
|
260287
|
+
child.on("error", (error48) => {
|
|
260288
|
+
this.logger.error("Frontend dev server failed to start:", error48);
|
|
260289
|
+
this.notifyExit(null);
|
|
260290
|
+
});
|
|
260291
|
+
child.on("exit", (code2) => {
|
|
260292
|
+
if (this.stopping) {
|
|
260293
|
+
return;
|
|
260294
|
+
}
|
|
260295
|
+
this.logger.error(`Frontend dev server exited with code ${code2}`);
|
|
260296
|
+
this.notifyExit(code2);
|
|
260297
|
+
});
|
|
260298
|
+
}
|
|
260299
|
+
notifyExit(code2) {
|
|
260300
|
+
for (const listener of this.exitListeners) {
|
|
260301
|
+
listener(code2);
|
|
260302
|
+
}
|
|
260303
|
+
}
|
|
260304
|
+
emitLines(data, type) {
|
|
260305
|
+
const lines = data.toString().trimEnd().split(`
|
|
260306
|
+
`);
|
|
260307
|
+
for (const line3 of lines) {
|
|
260308
|
+
if (type === "error") {
|
|
260309
|
+
this.logger.error(line3);
|
|
260310
|
+
} else {
|
|
260311
|
+
this.logger.log(line3);
|
|
260312
|
+
}
|
|
260313
|
+
}
|
|
260314
|
+
}
|
|
260315
|
+
}
|
|
260316
|
+
|
|
260214
260317
|
// src/cli/dev/dev-server/watcher.ts
|
|
260215
260318
|
import { EventEmitter as EventEmitter4 } from "node:events";
|
|
260216
260319
|
import { relative as relative6 } from "node:path";
|
|
@@ -262038,6 +262141,19 @@ async function createDevServer(options8) {
|
|
|
262038
262141
|
}
|
|
262039
262142
|
});
|
|
262040
262143
|
await base44ConfigWatcher.start();
|
|
262144
|
+
const serveCommand = project2.site?.serveCommand;
|
|
262145
|
+
let serveRunner;
|
|
262146
|
+
if (options8.appId && serveCommand) {
|
|
262147
|
+
serveRunner = new ServeRunner({
|
|
262148
|
+
command: serveCommand,
|
|
262149
|
+
cwd: project2.root,
|
|
262150
|
+
env: {
|
|
262151
|
+
VITE_BASE44_APP_ID: options8.appId,
|
|
262152
|
+
VITE_BASE44_APP_BASE_URL: baseUrl
|
|
262153
|
+
},
|
|
262154
|
+
logger: createDevLogger("frontend", theme.colors.base44Orange)
|
|
262155
|
+
});
|
|
262156
|
+
}
|
|
262041
262157
|
const handleShutdownError = (error48) => {
|
|
262042
262158
|
const errorMessage = error48 instanceof Error ? error48.message : String(error48);
|
|
262043
262159
|
devLogger.error(`Failed to shut down dev server: ${errorMessage}`);
|
|
@@ -262060,6 +262176,7 @@ async function createDevServer(options8) {
|
|
|
262060
262176
|
base44ConfigWatcher.close();
|
|
262061
262177
|
await io6.close();
|
|
262062
262178
|
await functionManager.stopAll();
|
|
262179
|
+
await serveRunner?.stop();
|
|
262063
262180
|
await closeServerIfRunning();
|
|
262064
262181
|
};
|
|
262065
262182
|
let shutdownPromise;
|
|
@@ -262069,118 +262186,28 @@ async function createDevServer(options8) {
|
|
|
262069
262186
|
};
|
|
262070
262187
|
process.on("SIGINT", shutdown);
|
|
262071
262188
|
process.on("SIGTERM", shutdown);
|
|
262072
|
-
|
|
262073
|
-
|
|
262074
|
-
|
|
262075
|
-
|
|
262076
|
-
|
|
262077
|
-
|
|
262078
|
-
|
|
262079
|
-
class ServeRunner {
|
|
262080
|
-
command;
|
|
262081
|
-
cwd;
|
|
262082
|
-
env;
|
|
262083
|
-
logger;
|
|
262084
|
-
child;
|
|
262085
|
-
stopping = false;
|
|
262086
|
-
stopPromise;
|
|
262087
|
-
exitListeners = [];
|
|
262088
|
-
constructor(options8) {
|
|
262089
|
-
this.command = options8.command;
|
|
262090
|
-
this.cwd = options8.cwd;
|
|
262091
|
-
this.env = options8.env;
|
|
262092
|
-
this.logger = options8.logger;
|
|
262093
|
-
}
|
|
262094
|
-
start() {
|
|
262095
|
-
if (this.child) {
|
|
262096
|
-
return;
|
|
262097
|
-
}
|
|
262098
|
-
const stdin2 = process23.platform === "win32" ? "ignore" : "inherit";
|
|
262099
|
-
const child = spawn3(this.command, {
|
|
262100
|
-
cwd: this.cwd,
|
|
262101
|
-
shell: true,
|
|
262102
|
-
detached: process23.platform !== "win32",
|
|
262103
|
-
env: { ...process23.env, ...this.env },
|
|
262104
|
-
stdio: [stdin2, "pipe", "pipe"],
|
|
262105
|
-
windowsHide: true
|
|
262106
|
-
});
|
|
262107
|
-
this.child = child;
|
|
262108
|
-
this.setupHandlers(child);
|
|
262109
|
-
}
|
|
262110
|
-
onExit(listener) {
|
|
262111
|
-
this.exitListeners.push(listener);
|
|
262112
|
-
}
|
|
262113
|
-
async stop() {
|
|
262114
|
-
if (this.stopPromise) {
|
|
262115
|
-
return this.stopPromise;
|
|
262116
|
-
}
|
|
262117
|
-
this.stopPromise = this.stopChild();
|
|
262118
|
-
return this.stopPromise;
|
|
262119
|
-
}
|
|
262120
|
-
async stopChild() {
|
|
262121
|
-
const child = this.child;
|
|
262122
|
-
if (!child || child.exitCode !== null) {
|
|
262123
|
-
return;
|
|
262124
|
-
}
|
|
262125
|
-
this.stopping = true;
|
|
262126
|
-
const exited = new Promise((resolve15) => child.once("exit", () => resolve15()));
|
|
262127
|
-
if (process23.platform === "win32" && child.pid) {
|
|
262128
|
-
const taskkill = spawn3("taskkill", ["/pid", String(child.pid), "/T", "/F"], {
|
|
262129
|
-
stdio: "ignore",
|
|
262130
|
-
windowsHide: true
|
|
262131
|
-
});
|
|
262132
|
-
await new Promise((resolve15) => {
|
|
262133
|
-
taskkill.once("exit", () => resolve15());
|
|
262134
|
-
taskkill.once("error", () => resolve15());
|
|
262135
|
-
});
|
|
262136
|
-
} else if (child.pid) {
|
|
262137
|
-
try {
|
|
262138
|
-
process23.kill(-child.pid, "SIGTERM");
|
|
262139
|
-
} catch {
|
|
262140
|
-
child.kill();
|
|
262141
|
-
}
|
|
262142
|
-
}
|
|
262143
|
-
await exited;
|
|
262144
|
-
}
|
|
262145
|
-
setupHandlers(child) {
|
|
262146
|
-
child.stdout?.on("data", (data) => this.emitLines(data, "log"));
|
|
262147
|
-
child.stderr?.on("data", (data) => this.emitLines(data, "error"));
|
|
262148
|
-
child.on("error", (error48) => {
|
|
262149
|
-
this.logger.error("Frontend dev server failed to start:", error48);
|
|
262150
|
-
this.notifyExit(null);
|
|
262151
|
-
});
|
|
262152
|
-
child.on("exit", (code2) => {
|
|
262153
|
-
if (this.stopping) {
|
|
262154
|
-
return;
|
|
262155
|
-
}
|
|
262156
|
-
this.logger.error(`Frontend dev server exited with code ${code2}`);
|
|
262157
|
-
this.notifyExit(code2);
|
|
262158
|
-
});
|
|
262159
|
-
}
|
|
262160
|
-
notifyExit(code2) {
|
|
262161
|
-
for (const listener of this.exitListeners) {
|
|
262162
|
-
listener(code2);
|
|
262163
|
-
}
|
|
262164
|
-
}
|
|
262165
|
-
emitLines(data, type) {
|
|
262166
|
-
const lines = data.toString().trimEnd().split(`
|
|
262167
|
-
`);
|
|
262168
|
-
for (const line3 of lines) {
|
|
262169
|
-
if (type === "error") {
|
|
262170
|
-
this.logger.error(line3);
|
|
262171
|
-
} else {
|
|
262172
|
-
this.logger.log(line3);
|
|
262173
|
-
}
|
|
262174
|
-
}
|
|
262189
|
+
serveRunner?.onExit(() => {
|
|
262190
|
+
shutdown().finally(() => process.exit(1));
|
|
262191
|
+
});
|
|
262192
|
+
if (serveRunner) {
|
|
262193
|
+
devLogger.log(`Backend running on ${baseUrl}`);
|
|
262194
|
+
serveRunner.start();
|
|
262175
262195
|
}
|
|
262196
|
+
return { port, server, isServingFrontend: serveRunner !== undefined };
|
|
262176
262197
|
}
|
|
262177
262198
|
|
|
262178
|
-
// src/cli/dev/serve
|
|
262179
|
-
function
|
|
262180
|
-
|
|
262181
|
-
|
|
262199
|
+
// src/cli/dev/remote-serve.ts
|
|
262200
|
+
function startRemoteServe(options8) {
|
|
262201
|
+
const runner = createRemoteServeRunner(options8);
|
|
262202
|
+
stopRunnerOnProcessSignals(runner);
|
|
262203
|
+
runner.onExit((code2) => process.exit(code2 ?? 1));
|
|
262204
|
+
runner.start();
|
|
262205
|
+
}
|
|
262206
|
+
function createRemoteServeRunner({
|
|
262182
262207
|
appId,
|
|
262183
|
-
appBaseUrl
|
|
262208
|
+
appBaseUrl,
|
|
262209
|
+
serveCommand,
|
|
262210
|
+
projectRoot
|
|
262184
262211
|
}) {
|
|
262185
262212
|
return new ServeRunner({
|
|
262186
262213
|
command: serveCommand,
|
|
@@ -262192,6 +262219,11 @@ function createServeCommandRunner({
|
|
|
262192
262219
|
logger: createDevLogger("frontend", theme.colors.base44Orange)
|
|
262193
262220
|
});
|
|
262194
262221
|
}
|
|
262222
|
+
function stopRunnerOnProcessSignals(runner) {
|
|
262223
|
+
const stop2 = () => void runner.stop();
|
|
262224
|
+
process.on("SIGINT", stop2);
|
|
262225
|
+
process.on("SIGTERM", stop2);
|
|
262226
|
+
}
|
|
262195
262227
|
|
|
262196
262228
|
// src/cli/commands/dev.ts
|
|
262197
262229
|
function localServerUrl(port) {
|
|
@@ -262207,56 +262239,40 @@ function validateDevOptions(command2) {
|
|
|
262207
262239
|
command2.error("--port applies to the local backend, which --remote does not start.");
|
|
262208
262240
|
}
|
|
262209
262241
|
}
|
|
262210
|
-
function
|
|
262211
|
-
if (!app?.projectRoot) {
|
|
262212
|
-
throw new ConfigInvalidError("base44 dev requires a linked local project. Run it from a project with base44/.app.jsonc.");
|
|
262213
|
-
}
|
|
262214
|
-
return { id: app.id, projectRoot: app.projectRoot };
|
|
262215
|
-
}
|
|
262216
|
-
async function resolveConfiguredSite(app) {
|
|
262242
|
+
async function remoteDevAction(app) {
|
|
262217
262243
|
const { project: project2 } = await readProjectConfig(app.projectRoot);
|
|
262218
262244
|
const serveCommand = project2.site?.serveCommand;
|
|
262219
|
-
|
|
262220
|
-
}
|
|
262221
|
-
function stopRunnerOnProcessSignals(runner) {
|
|
262222
|
-
const stop2 = () => void runner.stop();
|
|
262223
|
-
process.on("SIGINT", stop2);
|
|
262224
|
-
process.on("SIGTERM", stop2);
|
|
262225
|
-
}
|
|
262226
|
-
function startServeCommand(runner, backend) {
|
|
262227
|
-
stopRunnerOnProcessSignals(runner);
|
|
262228
|
-
runner.onExit(() => {
|
|
262229
|
-
backend.shutdown().finally(() => process.exit(1));
|
|
262230
|
-
});
|
|
262231
|
-
createDevLogger("backend", theme.styles.info).log(`Backend running on ${backend.url}`);
|
|
262232
|
-
runner.start();
|
|
262233
|
-
}
|
|
262234
|
-
async function remoteDevAction(app) {
|
|
262235
|
-
const site2 = await resolveConfiguredSite(app);
|
|
262236
|
-
if (!site2) {
|
|
262245
|
+
if (!serveCommand) {
|
|
262237
262246
|
throw new ConfigInvalidError("base44 dev --remote serves the frontend against the production backend, but this project has no site.serveCommand in base44/config.jsonc.");
|
|
262238
262247
|
}
|
|
262239
262248
|
const appBaseUrl = await getSiteUrl();
|
|
262240
|
-
|
|
262241
|
-
...site2,
|
|
262249
|
+
startRemoteServe({
|
|
262242
262250
|
appId: app.id,
|
|
262243
|
-
appBaseUrl
|
|
262251
|
+
appBaseUrl,
|
|
262252
|
+
serveCommand,
|
|
262253
|
+
projectRoot: project2.root
|
|
262244
262254
|
});
|
|
262245
|
-
stopRunnerOnProcessSignals(runner);
|
|
262246
|
-
runner.onExit((code2) => process.exit(code2 ?? 1));
|
|
262247
|
-
runner.start();
|
|
262248
262255
|
return {
|
|
262249
262256
|
outroMessage: `Frontend dev server targets ${theme.styles.bold(appBaseUrl)} — every write hits your live app`
|
|
262250
262257
|
};
|
|
262251
262258
|
}
|
|
262252
|
-
async function
|
|
262253
|
-
const
|
|
262259
|
+
async function devAction(ctx, options8) {
|
|
262260
|
+
const { log, app } = ctx;
|
|
262261
|
+
if (!app?.projectRoot) {
|
|
262262
|
+
throw new ConfigInvalidError("base44 dev requires a linked local project. Run it from a project with base44/.app.jsonc.");
|
|
262263
|
+
}
|
|
262264
|
+
if (options8.remote) {
|
|
262265
|
+
return remoteDevAction({ id: app.id, projectRoot: app.projectRoot });
|
|
262266
|
+
}
|
|
262267
|
+
const port = options8.port ? Number(options8.port) : undefined;
|
|
262268
|
+
const appId = app.id;
|
|
262254
262269
|
const siteUrlPromise = getSiteUrl().catch(() => {
|
|
262255
262270
|
return;
|
|
262256
262271
|
});
|
|
262257
|
-
const
|
|
262258
|
-
log
|
|
262259
|
-
port
|
|
262272
|
+
const { port: resolvedPort, isServingFrontend } = await createDevServer({
|
|
262273
|
+
log,
|
|
262274
|
+
port,
|
|
262275
|
+
appId,
|
|
262260
262276
|
denoWrapperPath: getDenoWrapperPath(),
|
|
262261
262277
|
loadResources: async () => {
|
|
262262
262278
|
const { functions, entities, project: project2 } = await readProjectConfig();
|
|
@@ -262264,22 +262280,9 @@ async function localDevAction(ctx, app, options8) {
|
|
|
262264
262280
|
return { functions, entities, project: project2, siteUrl };
|
|
262265
262281
|
}
|
|
262266
262282
|
});
|
|
262267
|
-
const
|
|
262268
|
-
if (site2) {
|
|
262269
|
-
const runner = createServeCommandRunner({
|
|
262270
|
-
...site2,
|
|
262271
|
-
appId: app.id,
|
|
262272
|
-
appBaseUrl: backendUrl
|
|
262273
|
-
});
|
|
262274
|
-
startServeCommand(runner, { url: backendUrl, shutdown: backend.shutdown });
|
|
262275
|
-
}
|
|
262276
|
-
const outroMessage = site2 ? "Open your app using the frontend dev server URL" : `Dev server is available at ${theme.colors.links(backendUrl)}`;
|
|
262283
|
+
const outroMessage = isServingFrontend ? "Open your app using the frontend dev server URL" : `Dev server is available at ${theme.colors.links(localServerUrl(resolvedPort))}`;
|
|
262277
262284
|
return { outroMessage };
|
|
262278
262285
|
}
|
|
262279
|
-
async function devAction(ctx, options8) {
|
|
262280
|
-
const app = requireLinkedProject(ctx);
|
|
262281
|
-
return options8.remote ? remoteDevAction(app) : localDevAction(ctx, app, options8);
|
|
262282
|
-
}
|
|
262283
262286
|
function getDevCommand() {
|
|
262284
262287
|
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);
|
|
262285
262288
|
}
|
|
@@ -266799,4 +266802,4 @@ export {
|
|
|
266799
266802
|
CLIExitError
|
|
266800
266803
|
};
|
|
266801
266804
|
|
|
266802
|
-
//# debugId=
|
|
266805
|
+
//# debugId=92E6FA4E34506F4E64756E2164756E21
|