@base44-preview/cli 0.0.32-pr.249.6b67311 → 0.0.32-pr.249.89127f3
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 +54 -32
- package/dist/cli/index.js.map +13 -13
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -186785,12 +186785,12 @@ var BANNER_LINES = [
|
|
|
186785
186785
|
"██████╔╝██║ ██║███████║███████╗ ██║ ██║",
|
|
186786
186786
|
"╚═════╝ ╚═╝ ╚═╝╚══════╝╚══════╝ ╚═╝ ╚═╝"
|
|
186787
186787
|
];
|
|
186788
|
-
async function printBanner() {
|
|
186789
|
-
if (
|
|
186790
|
-
await printAnimatedLines(BANNER_LINES);
|
|
186791
|
-
} else {
|
|
186788
|
+
async function printBanner(isNonInteractive) {
|
|
186789
|
+
if (isNonInteractive) {
|
|
186792
186790
|
console.log(theme.colors.base44Orange(BANNER_LINES.join(`
|
|
186793
186791
|
`)));
|
|
186792
|
+
} else {
|
|
186793
|
+
await printAnimatedLines(BANNER_LINES);
|
|
186794
186794
|
}
|
|
186795
186795
|
}
|
|
186796
186796
|
// src/cli/errors.ts
|
|
@@ -193595,7 +193595,7 @@ async function printUpgradeNotificationIfAvailable() {
|
|
|
193595
193595
|
async function runCommand(commandFn, options, context) {
|
|
193596
193596
|
console.log();
|
|
193597
193597
|
if (options?.fullBanner) {
|
|
193598
|
-
await printBanner();
|
|
193598
|
+
await printBanner(context.isNonInteractive);
|
|
193599
193599
|
Ie("");
|
|
193600
193600
|
} else {
|
|
193601
193601
|
Ie(theme.colors.base44OrangeBackground(" Base 44 "));
|
|
@@ -194525,7 +194525,7 @@ function printSummary(results, oauthOutcomes) {
|
|
|
194525
194525
|
M2.error(`Failed: ${r2.type}${r2.error ? ` - ${r2.error}` : ""}`);
|
|
194526
194526
|
}
|
|
194527
194527
|
}
|
|
194528
|
-
async function pushConnectorsAction() {
|
|
194528
|
+
async function pushConnectorsAction(isNonInteractive) {
|
|
194529
194529
|
const { connectors } = await readProjectConfig();
|
|
194530
194530
|
if (connectors.length === 0) {
|
|
194531
194531
|
M2.info("No local connectors found - checking for remote connectors to remove");
|
|
@@ -194539,18 +194539,18 @@ async function pushConnectorsAction() {
|
|
|
194539
194539
|
const needsOAuth = filterPendingOAuth(results);
|
|
194540
194540
|
let outroMessage = "Connectors pushed to Base44";
|
|
194541
194541
|
const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
|
|
194542
|
-
skipPrompt:
|
|
194542
|
+
skipPrompt: isNonInteractive
|
|
194543
194543
|
});
|
|
194544
194544
|
const allAuthorized = oauthOutcomes.size > 0 && [...oauthOutcomes.values()].every((s) => s === "ACTIVE");
|
|
194545
194545
|
if (needsOAuth.length > 0 && !allAuthorized) {
|
|
194546
|
-
outroMessage =
|
|
194546
|
+
outroMessage = isNonInteractive ? "Skipped OAuth in non-interactive mode. Run 'base44 connectors push' locally or open the links above to authorize." : "Some connectors still require authorization. Run 'base44 connectors push' or open the links above to authorize.";
|
|
194547
194547
|
}
|
|
194548
194548
|
printSummary(results, oauthOutcomes);
|
|
194549
194549
|
return { outroMessage };
|
|
194550
194550
|
}
|
|
194551
194551
|
function getConnectorsPushCommand(context) {
|
|
194552
194552
|
return new Command("push").description("Push local connectors to Base44 (overwrites connectors on Base44)").action(async () => {
|
|
194553
|
-
await runCommand(pushConnectorsAction, { requireAuth: true }, context);
|
|
194553
|
+
await runCommand(() => pushConnectorsAction(context.isNonInteractive), { requireAuth: true }, context);
|
|
194554
194554
|
});
|
|
194555
194555
|
}
|
|
194556
194556
|
|
|
@@ -194560,16 +194560,16 @@ function getConnectorsCommand(context) {
|
|
|
194560
194560
|
}
|
|
194561
194561
|
|
|
194562
194562
|
// src/cli/commands/dashboard/open.ts
|
|
194563
|
-
async function openDashboard() {
|
|
194563
|
+
async function openDashboard(isNonInteractive) {
|
|
194564
194564
|
const dashboardUrl = getDashboardUrl();
|
|
194565
|
-
if (!
|
|
194565
|
+
if (!isNonInteractive) {
|
|
194566
194566
|
await open_default(dashboardUrl);
|
|
194567
194567
|
}
|
|
194568
194568
|
return { outroMessage: `Dashboard opened at ${dashboardUrl}` };
|
|
194569
194569
|
}
|
|
194570
194570
|
function getDashboardOpenCommand(context) {
|
|
194571
194571
|
return new Command("open").description("Open the app dashboard in your browser").action(async () => {
|
|
194572
|
-
await runCommand(openDashboard, { requireAuth: true }, context);
|
|
194572
|
+
await runCommand(() => openDashboard(context.isNonInteractive), { requireAuth: true }, context);
|
|
194573
194573
|
});
|
|
194574
194574
|
}
|
|
194575
194575
|
|
|
@@ -194875,7 +194875,7 @@ ${summaryLines.join(`
|
|
|
194875
194875
|
const needsOAuth = filterPendingOAuth(result.connectorResults ?? []);
|
|
194876
194876
|
if (needsOAuth.length > 0) {
|
|
194877
194877
|
const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
|
|
194878
|
-
skipPrompt: options.yes ||
|
|
194878
|
+
skipPrompt: options.yes || options.isNonInteractive
|
|
194879
194879
|
});
|
|
194880
194880
|
const allAuthorized = oauthOutcomes.size > 0 && [...oauthOutcomes.values()].every((s) => s === "ACTIVE");
|
|
194881
194881
|
if (!allAuthorized) {
|
|
@@ -194890,7 +194890,10 @@ ${summaryLines.join(`
|
|
|
194890
194890
|
}
|
|
194891
194891
|
function getDeployCommand(context) {
|
|
194892
194892
|
return new Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
|
|
194893
|
-
await runCommand(() => deployAction(
|
|
194893
|
+
await runCommand(() => deployAction({
|
|
194894
|
+
...options,
|
|
194895
|
+
isNonInteractive: context.isNonInteractive
|
|
194896
|
+
}), { requireAuth: true }, context);
|
|
194894
194897
|
});
|
|
194895
194898
|
}
|
|
194896
194899
|
|
|
@@ -195072,21 +195075,24 @@ async function deployAction2(options) {
|
|
|
195072
195075
|
}
|
|
195073
195076
|
function getSiteDeployCommand(context) {
|
|
195074
195077
|
return new Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
|
|
195075
|
-
await runCommand(() => deployAction2(
|
|
195078
|
+
await runCommand(() => deployAction2({
|
|
195079
|
+
...options,
|
|
195080
|
+
isNonInteractive: context.isNonInteractive
|
|
195081
|
+
}), { requireAuth: true }, context);
|
|
195076
195082
|
});
|
|
195077
195083
|
}
|
|
195078
195084
|
|
|
195079
195085
|
// src/cli/commands/site/open.ts
|
|
195080
|
-
async function openAction() {
|
|
195086
|
+
async function openAction(isNonInteractive) {
|
|
195081
195087
|
const siteUrl = await getSiteUrl();
|
|
195082
|
-
if (!
|
|
195088
|
+
if (!isNonInteractive) {
|
|
195083
195089
|
await open_default(siteUrl);
|
|
195084
195090
|
}
|
|
195085
195091
|
return { outroMessage: `Site opened at ${siteUrl}` };
|
|
195086
195092
|
}
|
|
195087
195093
|
function getSiteOpenCommand(context) {
|
|
195088
195094
|
return new Command("open").description("Open the published site in your browser").action(async () => {
|
|
195089
|
-
await runCommand(openAction, { requireAuth: true }, context);
|
|
195095
|
+
await runCommand(() => openAction(context.isNonInteractive), { requireAuth: true }, context);
|
|
195090
195096
|
});
|
|
195091
195097
|
}
|
|
195092
195098
|
|
|
@@ -195411,6 +195417,7 @@ var READY_TIMEOUT = 30000;
|
|
|
195411
195417
|
class FunctionManager {
|
|
195412
195418
|
functions;
|
|
195413
195419
|
running = new Map;
|
|
195420
|
+
starting = new Map;
|
|
195414
195421
|
logger;
|
|
195415
195422
|
constructor(functions, logger) {
|
|
195416
195423
|
this.functions = new Map(functions.map((f7) => [f7.name, f7]));
|
|
@@ -195437,15 +195444,25 @@ class FunctionManager {
|
|
|
195437
195444
|
if (existing?.ready) {
|
|
195438
195445
|
return existing.port;
|
|
195439
195446
|
}
|
|
195447
|
+
const pending = this.starting.get(name2);
|
|
195448
|
+
if (pending) {
|
|
195449
|
+
return pending;
|
|
195450
|
+
}
|
|
195440
195451
|
const backendFunction = this.functions.get(name2);
|
|
195441
195452
|
if (!backendFunction) {
|
|
195442
195453
|
throw new InvalidInputError(`Function "${name2}" not found`, {
|
|
195443
195454
|
hints: [{ message: "Check available functions in your project" }]
|
|
195444
195455
|
});
|
|
195445
195456
|
}
|
|
195446
|
-
|
|
195447
|
-
|
|
195457
|
+
const promise2 = this.startFunction(name2, backendFunction);
|
|
195458
|
+
this.starting.set(name2, promise2);
|
|
195459
|
+
try {
|
|
195460
|
+
return await promise2;
|
|
195461
|
+
} finally {
|
|
195462
|
+
this.starting.delete(name2);
|
|
195448
195463
|
}
|
|
195464
|
+
}
|
|
195465
|
+
async startFunction(name2, backendFunction) {
|
|
195449
195466
|
const port = await this.allocatePort();
|
|
195450
195467
|
const process21 = this.spawnFunction(backendFunction, port);
|
|
195451
195468
|
const runningFunc = {
|
|
@@ -195467,6 +195484,7 @@ class FunctionManager {
|
|
|
195467
195484
|
process21.kill();
|
|
195468
195485
|
}
|
|
195469
195486
|
this.running.clear();
|
|
195487
|
+
this.starting.clear();
|
|
195470
195488
|
}
|
|
195471
195489
|
stop(name2) {
|
|
195472
195490
|
const running = this.running.get(name2);
|
|
@@ -195519,7 +195537,16 @@ class FunctionManager {
|
|
|
195519
195537
|
}
|
|
195520
195538
|
waitForReady(name2, runningFunc) {
|
|
195521
195539
|
return new Promise((resolve5, reject) => {
|
|
195540
|
+
runningFunc.process.on("exit", (code2) => {
|
|
195541
|
+
if (!runningFunc.ready) {
|
|
195542
|
+
clearTimeout(timeout3);
|
|
195543
|
+
reject(new InternalError(`Function "${name2}" exited with code ${code2}`, {
|
|
195544
|
+
hints: [{ message: "Check the function code for errors" }]
|
|
195545
|
+
}));
|
|
195546
|
+
}
|
|
195547
|
+
});
|
|
195522
195548
|
const timeout3 = setTimeout(() => {
|
|
195549
|
+
runningFunc.process.kill();
|
|
195523
195550
|
reject(new InternalError(`Function "${name2}" failed to start within ${READY_TIMEOUT / 1000}s timeout`, {
|
|
195524
195551
|
hints: [
|
|
195525
195552
|
{ message: "Check the function code for startup errors" }
|
|
@@ -195536,14 +195563,6 @@ class FunctionManager {
|
|
|
195536
195563
|
}
|
|
195537
195564
|
};
|
|
195538
195565
|
runningFunc.process.stdout?.on("data", onData);
|
|
195539
|
-
runningFunc.process.on("exit", (code2) => {
|
|
195540
|
-
if (!runningFunc.ready) {
|
|
195541
|
-
clearTimeout(timeout3);
|
|
195542
|
-
reject(new InternalError(`Function "${name2}" exited with code ${code2}`, {
|
|
195543
|
-
hints: [{ message: "Check the function code for errors" }]
|
|
195544
|
-
}));
|
|
195545
|
-
}
|
|
195546
|
-
});
|
|
195547
195566
|
});
|
|
195548
195567
|
}
|
|
195549
195568
|
}
|
|
@@ -195612,8 +195631,10 @@ function proxyRequest(req, res, port, logger) {
|
|
|
195612
195631
|
error: "Failed to proxy request to function",
|
|
195613
195632
|
details: error48.message
|
|
195614
195633
|
});
|
|
195634
|
+
res.once("finish", resolve5);
|
|
195635
|
+
} else {
|
|
195636
|
+
resolve5();
|
|
195615
195637
|
}
|
|
195616
|
-
resolve5();
|
|
195617
195638
|
});
|
|
195618
195639
|
req.pipe(proxyReq);
|
|
195619
195640
|
});
|
|
@@ -195783,7 +195804,7 @@ async function eject(options8) {
|
|
|
195783
195804
|
}
|
|
195784
195805
|
function getEjectCommand(context) {
|
|
195785
195806
|
return new Command("eject").description("Download the code for an existing Base44 project").option("-p, --path <path>", "Path where to write the project").option("--project-id <id>", "Project ID to eject (skips interactive selection)").option("-y, --yes", "Skip confirmation prompts").action(async (options8) => {
|
|
195786
|
-
await runCommand(() => eject(options8), { requireAuth: true, requireAppConfig: false }, context);
|
|
195807
|
+
await runCommand(() => eject({ ...options8, isNonInteractive: context.isNonInteractive }), { requireAuth: true, requireAppConfig: false }, context);
|
|
195787
195808
|
});
|
|
195788
195809
|
}
|
|
195789
195810
|
|
|
@@ -200050,7 +200071,8 @@ function addCommandInfoToErrorReporter(program2, errorReporter) {
|
|
|
200050
200071
|
async function runCLI() {
|
|
200051
200072
|
const errorReporter = new ErrorReporter;
|
|
200052
200073
|
errorReporter.registerProcessErrorHandlers();
|
|
200053
|
-
const
|
|
200074
|
+
const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
|
|
200075
|
+
const context = { errorReporter, isNonInteractive };
|
|
200054
200076
|
const program2 = createProgram(context);
|
|
200055
200077
|
try {
|
|
200056
200078
|
const userInfo = await readAuth();
|
|
@@ -200075,4 +200097,4 @@ export {
|
|
|
200075
200097
|
CLIExitError
|
|
200076
200098
|
};
|
|
200077
200099
|
|
|
200078
|
-
//# debugId=
|
|
200100
|
+
//# debugId=E2377672720E70A864756E2164756E21
|