@base44-preview/cli 0.1.6-pr.580.bdc9780 → 0.1.6-pr.582.27b0175
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/assets/templates/backend-and-client/package.json +1 -2
- package/dist/assets/templates/backend-and-client/src/api/base44Client.js.ejs +5 -0
- package/dist/assets/templates/backend-and-client/vite.config.js +8 -3
- package/dist/cli/index.js +26 -154
- package/dist/cli/index.js.map +11 -13
- package/package.json +1 -1
- package/dist/assets/templates/backend-and-client/src/api/base44Client.js +0 -13
- package/dist/assets/templates/backend-and-client/src/lib/app-params.js +0 -54
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import base44 from '@base44/vite-plugin';
|
|
2
|
-
import react from '@vitejs/plugin-react';
|
|
3
1
|
import { defineConfig } from 'vite';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
import path from 'path';
|
|
4
4
|
|
|
5
5
|
export default defineConfig({
|
|
6
|
-
plugins: [
|
|
6
|
+
plugins: [react()],
|
|
7
|
+
resolve: {
|
|
8
|
+
alias: {
|
|
9
|
+
'@': path.resolve(__dirname, './src'),
|
|
10
|
+
},
|
|
11
|
+
},
|
|
7
12
|
});
|
package/dist/cli/index.js
CHANGED
|
@@ -247479,9 +247479,7 @@ async function deploySite(siteOutputDir) {
|
|
|
247479
247479
|
if (!await pathExists(siteOutputDir)) {
|
|
247480
247480
|
throw new InvalidInputError(`Output directory does not exist: ${siteOutputDir}. Make sure to build your project first.`, {
|
|
247481
247481
|
hints: [
|
|
247482
|
-
{
|
|
247483
|
-
message: "Run 'base44 build' first (it injects your app id; a bare 'npm run build' does not)"
|
|
247484
|
-
}
|
|
247482
|
+
{ message: "Run your build command (e.g., 'npm run build') first" }
|
|
247485
247483
|
]
|
|
247486
247484
|
});
|
|
247487
247485
|
}
|
|
@@ -247489,9 +247487,7 @@ async function deploySite(siteOutputDir) {
|
|
|
247489
247487
|
if (filePaths.length === 0) {
|
|
247490
247488
|
throw new ConfigInvalidError(`No files found in output directory: ${siteOutputDir}. Make sure to build your project first.`, siteOutputDir, {
|
|
247491
247489
|
hints: [
|
|
247492
|
-
{
|
|
247493
|
-
message: "Run 'base44 build' first (it injects your app id; a bare 'npm run build' does not)"
|
|
247494
|
-
}
|
|
247490
|
+
{ message: "Run your build command (e.g., 'npm run build') first" }
|
|
247495
247491
|
]
|
|
247496
247492
|
});
|
|
247497
247493
|
}
|
|
@@ -256644,68 +256640,6 @@ function getFunctionsCommand() {
|
|
|
256644
256640
|
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand()).addCommand(getDeleteCommand()).addCommand(getListCommand()).addCommand(getPullCommand());
|
|
256645
256641
|
}
|
|
256646
256642
|
|
|
256647
|
-
// src/cli/commands/project/site-build.ts
|
|
256648
|
-
async function runSiteBuild({ runTask: runTask2 }, { root, buildCommand, appId }) {
|
|
256649
|
-
if (!buildCommand) {
|
|
256650
|
-
throw new ConfigNotFoundError("No site build command found.", {
|
|
256651
|
-
hints: [
|
|
256652
|
-
{
|
|
256653
|
-
message: `Add 'site.buildCommand' to your config.jsonc (e.g., "site": { "buildCommand": "npm run build" })`
|
|
256654
|
-
}
|
|
256655
|
-
]
|
|
256656
|
-
});
|
|
256657
|
-
}
|
|
256658
|
-
await runTask2("Building site...", async () => {
|
|
256659
|
-
await execa({
|
|
256660
|
-
cwd: root,
|
|
256661
|
-
shell: true,
|
|
256662
|
-
env: { VITE_BASE44_APP_ID: appId }
|
|
256663
|
-
})`${buildCommand}`;
|
|
256664
|
-
}, {
|
|
256665
|
-
successMessage: "Site built successfully",
|
|
256666
|
-
errorMessage: "Build failed"
|
|
256667
|
-
});
|
|
256668
|
-
}
|
|
256669
|
-
async function shouldBuildBeforeDeploy({
|
|
256670
|
-
build,
|
|
256671
|
-
isNonInteractive,
|
|
256672
|
-
buildCommand
|
|
256673
|
-
}) {
|
|
256674
|
-
if (!buildCommand) {
|
|
256675
|
-
return false;
|
|
256676
|
-
}
|
|
256677
|
-
if (build !== undefined) {
|
|
256678
|
-
return build;
|
|
256679
|
-
}
|
|
256680
|
-
if (isNonInteractive) {
|
|
256681
|
-
return false;
|
|
256682
|
-
}
|
|
256683
|
-
const answer = await Re({
|
|
256684
|
-
message: `Build the site first? (runs '${buildCommand}' with your app id)`
|
|
256685
|
-
});
|
|
256686
|
-
return !Ct(answer) && answer;
|
|
256687
|
-
}
|
|
256688
|
-
|
|
256689
|
-
// src/cli/commands/project/build.ts
|
|
256690
|
-
async function buildAction(ctx) {
|
|
256691
|
-
const { app } = ctx;
|
|
256692
|
-
if (!app?.projectRoot) {
|
|
256693
|
-
throw new ConfigInvalidError("base44 build requires a linked local project. Run it from a project with base44/.app.jsonc.");
|
|
256694
|
-
}
|
|
256695
|
-
const { project: project2 } = await readProjectConfig(app.projectRoot);
|
|
256696
|
-
await runSiteBuild(ctx, {
|
|
256697
|
-
root: project2.root,
|
|
256698
|
-
buildCommand: project2.site?.buildCommand,
|
|
256699
|
-
appId: app.id
|
|
256700
|
-
});
|
|
256701
|
-
return {
|
|
256702
|
-
outroMessage: `Site built with app id ${theme.styles.bold(app.id)}`
|
|
256703
|
-
};
|
|
256704
|
-
}
|
|
256705
|
-
function getBuildCommand() {
|
|
256706
|
-
return new Base44Command("build").description("Build the site with the Base44 app id injected").action(buildAction);
|
|
256707
|
-
}
|
|
256708
|
-
|
|
256709
256643
|
// src/cli/commands/project/create.ts
|
|
256710
256644
|
import { basename as basename4, resolve as resolve8 } from "node:path";
|
|
256711
256645
|
var import_kebabCase = __toESM(require_kebabCase(), 1);
|
|
@@ -256768,11 +256702,7 @@ async function completeProjectSetup({
|
|
|
256768
256702
|
const { appUrl } = await runTask2("Installing dependencies...", async (updateMessage) => {
|
|
256769
256703
|
await execa({ cwd: resolvedPath, shell: true })`${installCommand}`;
|
|
256770
256704
|
updateMessage("Building project...");
|
|
256771
|
-
await execa({
|
|
256772
|
-
cwd: resolvedPath,
|
|
256773
|
-
shell: true,
|
|
256774
|
-
env: { VITE_BASE44_APP_ID: projectId }
|
|
256775
|
-
})`${buildCommand}`;
|
|
256705
|
+
await execa({ cwd: resolvedPath, shell: true })`${buildCommand}`;
|
|
256776
256706
|
updateMessage("Deploying site...");
|
|
256777
256707
|
return await deploySite(join23(resolvedPath, outputDirectory));
|
|
256778
256708
|
}, {
|
|
@@ -256978,8 +256908,7 @@ Examples:
|
|
|
256978
256908
|
}
|
|
256979
256909
|
|
|
256980
256910
|
// src/cli/commands/project/deploy.ts
|
|
256981
|
-
async function deployAction(
|
|
256982
|
-
const { isNonInteractive, log } = ctx;
|
|
256911
|
+
async function deployAction({ isNonInteractive, log }, options = {}) {
|
|
256983
256912
|
if (isNonInteractive && !options.yes) {
|
|
256984
256913
|
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
256985
256914
|
}
|
|
@@ -257027,20 +256956,6 @@ ${summaryLines.join(`
|
|
|
257027
256956
|
${summaryLines.join(`
|
|
257028
256957
|
`)}`);
|
|
257029
256958
|
}
|
|
257030
|
-
if (project2.site?.outputDirectory && ctx.app) {
|
|
257031
|
-
const shouldBuild = await shouldBuildBeforeDeploy({
|
|
257032
|
-
build: options.build,
|
|
257033
|
-
isNonInteractive,
|
|
257034
|
-
buildCommand: project2.site.buildCommand
|
|
257035
|
-
});
|
|
257036
|
-
if (shouldBuild) {
|
|
257037
|
-
await runSiteBuild(ctx, {
|
|
257038
|
-
root: project2.root,
|
|
257039
|
-
buildCommand: project2.site.buildCommand,
|
|
257040
|
-
appId: ctx.app.id
|
|
257041
|
-
});
|
|
257042
|
-
}
|
|
257043
|
-
}
|
|
257044
256959
|
let functionCompleted = 0;
|
|
257045
256960
|
const functionTotal = functions.length;
|
|
257046
256961
|
const result = await deployAll(projectData, {
|
|
@@ -257069,7 +256984,7 @@ ${summaryLines.join(`
|
|
|
257069
256984
|
return { outroMessage: "App deployed successfully" };
|
|
257070
256985
|
}
|
|
257071
256986
|
function getDeployCommand2() {
|
|
257072
|
-
return new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").
|
|
256987
|
+
return new Base44Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(deployAction);
|
|
257073
256988
|
}
|
|
257074
256989
|
async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
|
|
257075
256990
|
const needsOAuth = filterPendingOAuth(connectorResults);
|
|
@@ -257935,8 +257850,7 @@ function getSecretsCommand() {
|
|
|
257935
257850
|
|
|
257936
257851
|
// src/cli/commands/site/deploy.ts
|
|
257937
257852
|
import { resolve as resolve11 } from "node:path";
|
|
257938
|
-
async function deployAction2(
|
|
257939
|
-
const { isNonInteractive, runTask: runTask2 } = ctx;
|
|
257853
|
+
async function deployAction2({ isNonInteractive, runTask: runTask2 }, options) {
|
|
257940
257854
|
if (isNonInteractive && !options.yes) {
|
|
257941
257855
|
throw new InvalidInputError("--yes is required in non-interactive mode");
|
|
257942
257856
|
}
|
|
@@ -257959,18 +257873,6 @@ async function deployAction2(ctx, options) {
|
|
|
257959
257873
|
return { outroMessage: "Deployment cancelled" };
|
|
257960
257874
|
}
|
|
257961
257875
|
}
|
|
257962
|
-
const shouldBuild = await shouldBuildBeforeDeploy({
|
|
257963
|
-
build: options.build,
|
|
257964
|
-
isNonInteractive,
|
|
257965
|
-
buildCommand: project2.site.buildCommand
|
|
257966
|
-
});
|
|
257967
|
-
if (shouldBuild && ctx.app) {
|
|
257968
|
-
await runSiteBuild(ctx, {
|
|
257969
|
-
root: project2.root,
|
|
257970
|
-
buildCommand: project2.site.buildCommand,
|
|
257971
|
-
appId: ctx.app.id
|
|
257972
|
-
});
|
|
257973
|
-
}
|
|
257974
257876
|
const result = await runTask2("Creating archive and deploying site...", async () => {
|
|
257975
257877
|
return await deploySite(outputDir);
|
|
257976
257878
|
}, {
|
|
@@ -257980,7 +257882,7 @@ async function deployAction2(ctx, options) {
|
|
|
257980
257882
|
return { outroMessage: `Visit your site at: ${result.appUrl}` };
|
|
257981
257883
|
}
|
|
257982
257884
|
function getSiteDeployCommand() {
|
|
257983
|
-
return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").
|
|
257885
|
+
return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").action(deployAction2);
|
|
257984
257886
|
}
|
|
257985
257887
|
|
|
257986
257888
|
// src/cli/commands/site/open.ts
|
|
@@ -262202,10 +262104,6 @@ function validateDevOptions(command2) {
|
|
|
262202
262104
|
if (appId !== undefined) {
|
|
262203
262105
|
command2.error(`base44 dev cannot be used with --app-id or ${BASE44_APP_ID_ENV_VAR}.`);
|
|
262204
262106
|
}
|
|
262205
|
-
const { port, remote } = command2.opts();
|
|
262206
|
-
if (remote && port !== undefined) {
|
|
262207
|
-
command2.error("--port applies to the local backend, which --remote does not start.");
|
|
262208
|
-
}
|
|
262209
262107
|
}
|
|
262210
262108
|
function requireLinkedProject({ app }) {
|
|
262211
262109
|
if (!app?.projectRoot) {
|
|
@@ -262213,44 +262111,31 @@ function requireLinkedProject({ app }) {
|
|
|
262213
262111
|
}
|
|
262214
262112
|
return { id: app.id, projectRoot: app.projectRoot };
|
|
262215
262113
|
}
|
|
262216
|
-
async function
|
|
262114
|
+
async function createConfiguredServeRunner(app, backendUrl) {
|
|
262217
262115
|
const { project: project2 } = await readProjectConfig(app.projectRoot);
|
|
262218
262116
|
const serveCommand = project2.site?.serveCommand;
|
|
262219
|
-
|
|
262117
|
+
if (!serveCommand) {
|
|
262118
|
+
return;
|
|
262119
|
+
}
|
|
262120
|
+
return createServeCommandRunner({
|
|
262121
|
+
serveCommand,
|
|
262122
|
+
projectRoot: project2.root,
|
|
262123
|
+
appId: app.id,
|
|
262124
|
+
appBaseUrl: backendUrl
|
|
262125
|
+
});
|
|
262220
262126
|
}
|
|
262221
|
-
function
|
|
262127
|
+
function startServeCommand(runner, backend) {
|
|
262222
262128
|
const stop2 = () => void runner.stop();
|
|
262223
262129
|
process.on("SIGINT", stop2);
|
|
262224
262130
|
process.on("SIGTERM", stop2);
|
|
262225
|
-
}
|
|
262226
|
-
function startServeCommand(runner, backend) {
|
|
262227
|
-
stopRunnerOnProcessSignals(runner);
|
|
262228
262131
|
runner.onExit(() => {
|
|
262229
262132
|
backend.shutdown().finally(() => process.exit(1));
|
|
262230
262133
|
});
|
|
262231
262134
|
createDevLogger("backend", theme.styles.info).log(`Backend running on ${backend.url}`);
|
|
262232
262135
|
runner.start();
|
|
262233
262136
|
}
|
|
262234
|
-
async function
|
|
262235
|
-
const
|
|
262236
|
-
if (!site2) {
|
|
262237
|
-
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
|
-
}
|
|
262239
|
-
const appBaseUrl = await getSiteUrl();
|
|
262240
|
-
const runner = createServeCommandRunner({
|
|
262241
|
-
...site2,
|
|
262242
|
-
appId: app.id,
|
|
262243
|
-
appBaseUrl
|
|
262244
|
-
});
|
|
262245
|
-
stopRunnerOnProcessSignals(runner);
|
|
262246
|
-
runner.onExit((code2) => process.exit(code2 ?? 1));
|
|
262247
|
-
runner.start();
|
|
262248
|
-
return {
|
|
262249
|
-
outroMessage: `Frontend dev server targets ${theme.styles.bold(appBaseUrl)} — every write hits your live app`
|
|
262250
|
-
};
|
|
262251
|
-
}
|
|
262252
|
-
async function localDevAction(ctx, app, options8) {
|
|
262253
|
-
const site2 = await resolveConfiguredSite(app);
|
|
262137
|
+
async function devAction(ctx, options8) {
|
|
262138
|
+
const app = requireLinkedProject(ctx);
|
|
262254
262139
|
const siteUrlPromise = getSiteUrl().catch(() => {
|
|
262255
262140
|
return;
|
|
262256
262141
|
});
|
|
@@ -262265,23 +262150,15 @@ async function localDevAction(ctx, app, options8) {
|
|
|
262265
262150
|
}
|
|
262266
262151
|
});
|
|
262267
262152
|
const backendUrl = localServerUrl(backend.port);
|
|
262268
|
-
|
|
262269
|
-
|
|
262270
|
-
...site2,
|
|
262271
|
-
appId: app.id,
|
|
262272
|
-
appBaseUrl: backendUrl
|
|
262273
|
-
});
|
|
262153
|
+
const runner = await createConfiguredServeRunner(app, backendUrl);
|
|
262154
|
+
if (runner) {
|
|
262274
262155
|
startServeCommand(runner, { url: backendUrl, shutdown: backend.shutdown });
|
|
262275
262156
|
}
|
|
262276
|
-
const outroMessage =
|
|
262157
|
+
const outroMessage = runner ? "Open your app using the frontend dev server URL" : `Dev server is available at ${theme.colors.links(backendUrl)}`;
|
|
262277
262158
|
return { outroMessage };
|
|
262278
262159
|
}
|
|
262279
|
-
async function devAction(ctx, options8) {
|
|
262280
|
-
const app = requireLinkedProject(ctx);
|
|
262281
|
-
return options8.remote ? remoteDevAction(app) : localDevAction(ctx, app, options8);
|
|
262282
|
-
}
|
|
262283
262160
|
function getDevCommand() {
|
|
262284
|
-
return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").
|
|
262161
|
+
return new Base44Command("dev").description("Start the development server").option("-p, --port <number>", "Port for the development server").hook("preAction", validateDevOptions).action(devAction);
|
|
262285
262162
|
}
|
|
262286
262163
|
|
|
262287
262164
|
// src/core/exec/run-script.ts
|
|
@@ -262500,11 +262377,7 @@ async function eject(ctx, options8, command2) {
|
|
|
262500
262377
|
successMessage: theme.colors.base44Orange("Project built successfully"),
|
|
262501
262378
|
errorMessage: "Failed to build project"
|
|
262502
262379
|
});
|
|
262503
|
-
await deployAction(ctx, {
|
|
262504
|
-
yes: true,
|
|
262505
|
-
build: false,
|
|
262506
|
-
projectRoot: resolvedPath
|
|
262507
|
-
});
|
|
262380
|
+
await deployAction(ctx, { yes: true, projectRoot: resolvedPath });
|
|
262508
262381
|
}
|
|
262509
262382
|
}
|
|
262510
262383
|
return { outroMessage: "Your new project is set and ready to use" };
|
|
@@ -262533,7 +262406,6 @@ function createProgram(context) {
|
|
|
262533
262406
|
program2.addCommand(getCreateCommand());
|
|
262534
262407
|
program2.addCommand(getScaffoldCommand());
|
|
262535
262408
|
program2.addCommand(getDashboardCommand());
|
|
262536
|
-
program2.addCommand(getBuildCommand());
|
|
262537
262409
|
program2.addCommand(getDeployCommand2());
|
|
262538
262410
|
program2.addCommand(getVisibilityCommand());
|
|
262539
262411
|
program2.addCommand(getLinkCommand());
|
|
@@ -266799,4 +266671,4 @@ export {
|
|
|
266799
266671
|
CLIExitError
|
|
266800
266672
|
};
|
|
266801
266673
|
|
|
266802
|
-
//# debugId=
|
|
266674
|
+
//# debugId=741C52053719673B64756E2164756E21
|