@base44-preview/cli 0.1.7-pr.587.a83a4fb → 0.1.7-pr.588.7702fbb
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 +69 -56
- package/dist/cli/index.js.map +7 -7
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -256660,18 +256660,32 @@ async function runSiteBuild({ runTask: runTask2 }, { root, buildCommand, appId }
|
|
|
256660
256660
|
errorMessage: "Build failed"
|
|
256661
256661
|
});
|
|
256662
256662
|
}
|
|
256663
|
-
async function
|
|
256664
|
-
|
|
256665
|
-
|
|
256666
|
-
buildCommand
|
|
256667
|
-
}) {
|
|
256668
|
-
if (!buildCommand) {
|
|
256669
|
-
return false;
|
|
256663
|
+
async function maybeBuildBeforeDeploy(ctx, project2, build) {
|
|
256664
|
+
if (!ctx.app) {
|
|
256665
|
+
return;
|
|
256670
256666
|
}
|
|
256671
|
-
if (build
|
|
256672
|
-
|
|
256667
|
+
if (build === true) {
|
|
256668
|
+
await runSiteBuild(ctx, {
|
|
256669
|
+
root: project2.root,
|
|
256670
|
+
buildCommand: project2.site?.buildCommand,
|
|
256671
|
+
appId: ctx.app.id
|
|
256672
|
+
});
|
|
256673
|
+
return;
|
|
256674
|
+
}
|
|
256675
|
+
if (build === false || !project2.site?.outputDirectory) {
|
|
256676
|
+
return;
|
|
256677
|
+
}
|
|
256678
|
+
const shouldBuild = await shouldAskToBuild(ctx.isNonInteractive, project2.site.buildCommand);
|
|
256679
|
+
if (shouldBuild) {
|
|
256680
|
+
await runSiteBuild(ctx, {
|
|
256681
|
+
root: project2.root,
|
|
256682
|
+
buildCommand: project2.site.buildCommand,
|
|
256683
|
+
appId: ctx.app.id
|
|
256684
|
+
});
|
|
256673
256685
|
}
|
|
256674
|
-
|
|
256686
|
+
}
|
|
256687
|
+
async function shouldAskToBuild(isNonInteractive, buildCommand) {
|
|
256688
|
+
if (!buildCommand || isNonInteractive) {
|
|
256675
256689
|
return false;
|
|
256676
256690
|
}
|
|
256677
256691
|
const answer = await Re({
|
|
@@ -257017,20 +257031,7 @@ ${summaryLines.join(`
|
|
|
257017
257031
|
${summaryLines.join(`
|
|
257018
257032
|
`)}`);
|
|
257019
257033
|
}
|
|
257020
|
-
|
|
257021
|
-
const shouldBuild = await shouldBuildBeforeDeploy({
|
|
257022
|
-
build: options.build,
|
|
257023
|
-
isNonInteractive,
|
|
257024
|
-
buildCommand: project2.site.buildCommand
|
|
257025
|
-
});
|
|
257026
|
-
if (shouldBuild) {
|
|
257027
|
-
await runSiteBuild(ctx, {
|
|
257028
|
-
root: project2.root,
|
|
257029
|
-
buildCommand: project2.site.buildCommand,
|
|
257030
|
-
appId: ctx.app.id
|
|
257031
|
-
});
|
|
257032
|
-
}
|
|
257033
|
-
}
|
|
257034
|
+
await maybeBuildBeforeDeploy(ctx, project2, options.build);
|
|
257034
257035
|
let functionCompleted = 0;
|
|
257035
257036
|
const functionTotal = functions.length;
|
|
257036
257037
|
const result = await deployAll(projectData, {
|
|
@@ -257949,20 +257950,7 @@ async function deployAction2(ctx, options) {
|
|
|
257949
257950
|
return { outroMessage: "Deployment cancelled" };
|
|
257950
257951
|
}
|
|
257951
257952
|
}
|
|
257952
|
-
|
|
257953
|
-
const shouldBuild = await shouldBuildBeforeDeploy({
|
|
257954
|
-
build: options.build,
|
|
257955
|
-
isNonInteractive,
|
|
257956
|
-
buildCommand: project2.site.buildCommand
|
|
257957
|
-
});
|
|
257958
|
-
if (shouldBuild) {
|
|
257959
|
-
await runSiteBuild(ctx, {
|
|
257960
|
-
root: project2.root,
|
|
257961
|
-
buildCommand: project2.site.buildCommand,
|
|
257962
|
-
appId: ctx.app.id
|
|
257963
|
-
});
|
|
257964
|
-
}
|
|
257965
|
-
}
|
|
257953
|
+
await maybeBuildBeforeDeploy(ctx, project2, options.build);
|
|
257966
257954
|
const result = await runTask2("Creating archive and deploying site...", async () => {
|
|
257967
257955
|
return await deploySite(outputDir);
|
|
257968
257956
|
}, {
|
|
@@ -262194,6 +262182,10 @@ function validateDevOptions(command2) {
|
|
|
262194
262182
|
if (appId !== undefined) {
|
|
262195
262183
|
command2.error(`base44 dev cannot be used with --app-id or ${BASE44_APP_ID_ENV_VAR}.`);
|
|
262196
262184
|
}
|
|
262185
|
+
const { port, remote } = command2.opts();
|
|
262186
|
+
if (remote && port !== undefined) {
|
|
262187
|
+
command2.error("--port applies to the local backend, which --remote does not start.");
|
|
262188
|
+
}
|
|
262197
262189
|
}
|
|
262198
262190
|
function requireLinkedProject({ app }) {
|
|
262199
262191
|
if (!app?.projectRoot) {
|
|
@@ -262201,31 +262193,44 @@ function requireLinkedProject({ app }) {
|
|
|
262201
262193
|
}
|
|
262202
262194
|
return { id: app.id, projectRoot: app.projectRoot };
|
|
262203
262195
|
}
|
|
262204
|
-
async function
|
|
262196
|
+
async function resolveConfiguredSite(app) {
|
|
262205
262197
|
const { project: project2 } = await readProjectConfig(app.projectRoot);
|
|
262206
262198
|
const serveCommand = project2.site?.serveCommand;
|
|
262207
|
-
|
|
262208
|
-
return;
|
|
262209
|
-
}
|
|
262210
|
-
return createServeCommandRunner({
|
|
262211
|
-
serveCommand,
|
|
262212
|
-
projectRoot: project2.root,
|
|
262213
|
-
appId: app.id,
|
|
262214
|
-
appBaseUrl: backendUrl
|
|
262215
|
-
});
|
|
262199
|
+
return serveCommand ? { serveCommand, projectRoot: project2.root } : undefined;
|
|
262216
262200
|
}
|
|
262217
|
-
function
|
|
262201
|
+
function stopRunnerOnProcessSignals(runner) {
|
|
262218
262202
|
const stop2 = () => void runner.stop();
|
|
262219
262203
|
process.on("SIGINT", stop2);
|
|
262220
262204
|
process.on("SIGTERM", stop2);
|
|
262205
|
+
}
|
|
262206
|
+
function startServeCommand(runner, backend) {
|
|
262207
|
+
stopRunnerOnProcessSignals(runner);
|
|
262221
262208
|
runner.onExit(() => {
|
|
262222
262209
|
backend.shutdown().finally(() => process.exit(1));
|
|
262223
262210
|
});
|
|
262224
262211
|
createDevLogger("backend", theme.styles.info).log(`Backend running on ${backend.url}`);
|
|
262225
262212
|
runner.start();
|
|
262226
262213
|
}
|
|
262227
|
-
async function
|
|
262228
|
-
const
|
|
262214
|
+
async function remoteDevAction(app) {
|
|
262215
|
+
const site2 = await resolveConfiguredSite(app);
|
|
262216
|
+
if (!site2) {
|
|
262217
|
+
throw new ConfigInvalidError("base44 dev --remote serves the frontend against the production backend, but this project has no site.serveCommand in base44/config.jsonc.");
|
|
262218
|
+
}
|
|
262219
|
+
const appBaseUrl = await getSiteUrl();
|
|
262220
|
+
const runner = createServeCommandRunner({
|
|
262221
|
+
...site2,
|
|
262222
|
+
appId: app.id,
|
|
262223
|
+
appBaseUrl
|
|
262224
|
+
});
|
|
262225
|
+
stopRunnerOnProcessSignals(runner);
|
|
262226
|
+
runner.onExit((code2) => process.exit(code2 ?? 1));
|
|
262227
|
+
runner.start();
|
|
262228
|
+
return {
|
|
262229
|
+
outroMessage: `Frontend dev server targets ${theme.styles.bold(appBaseUrl)} — every write hits your live app`
|
|
262230
|
+
};
|
|
262231
|
+
}
|
|
262232
|
+
async function localDevAction(ctx, app, options8) {
|
|
262233
|
+
const site2 = await resolveConfiguredSite(app);
|
|
262229
262234
|
const siteUrlPromise = getSiteUrl().catch(() => {
|
|
262230
262235
|
return;
|
|
262231
262236
|
});
|
|
@@ -262240,15 +262245,23 @@ async function devAction(ctx, options8) {
|
|
|
262240
262245
|
}
|
|
262241
262246
|
});
|
|
262242
262247
|
const backendUrl = localServerUrl(backend.port);
|
|
262243
|
-
|
|
262244
|
-
|
|
262248
|
+
if (site2) {
|
|
262249
|
+
const runner = createServeCommandRunner({
|
|
262250
|
+
...site2,
|
|
262251
|
+
appId: app.id,
|
|
262252
|
+
appBaseUrl: backendUrl
|
|
262253
|
+
});
|
|
262245
262254
|
startServeCommand(runner, { url: backendUrl, shutdown: backend.shutdown });
|
|
262246
262255
|
}
|
|
262247
|
-
const outroMessage =
|
|
262256
|
+
const outroMessage = site2 ? "Open your app using the frontend dev server URL" : `Dev server is available at ${theme.colors.links(backendUrl)}`;
|
|
262248
262257
|
return { outroMessage };
|
|
262249
262258
|
}
|
|
262259
|
+
async function devAction(ctx, options8) {
|
|
262260
|
+
const app = requireLinkedProject(ctx);
|
|
262261
|
+
return options8.remote ? remoteDevAction(app) : localDevAction(ctx, app, options8);
|
|
262262
|
+
}
|
|
262250
262263
|
function getDevCommand() {
|
|
262251
|
-
return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").hook("preAction", validateDevOptions).action(devAction);
|
|
262264
|
+
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);
|
|
262252
262265
|
}
|
|
262253
262266
|
|
|
262254
262267
|
// src/core/exec/run-script.ts
|
|
@@ -266766,4 +266779,4 @@ export {
|
|
|
266766
266779
|
CLIExitError
|
|
266767
266780
|
};
|
|
266768
266781
|
|
|
266769
|
-
//# debugId=
|
|
266782
|
+
//# debugId=244E76C64D91558B64756E2164756E21
|