@base44-preview/cli 0.0.6-pr.60.bf6ff56 → 0.0.6-pr.61.3329884

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +38 -27
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -26282,30 +26282,48 @@ async function printBanner() {
26282
26282
  //#region src/cli/utils/runCommand.ts
26283
26283
  const base44Color = source_default.bgHex("#E86B3C");
26284
26284
  /**
26285
- * Wraps a command function with the Base44 intro banner and error handling.
26285
+ * Wraps a command function with the Base44 intro/outro and error handling.
26286
26286
  * All CLI commands should use this utility to ensure consistent branding.
26287
- * Also loads .env.local from the project root if available.
26288
26287
  *
26289
- * @param commandFn - The async function to execute as the command
26288
+ * **Responsibilities**:
26289
+ * - Displays the intro (simple tag or full ASCII banner)
26290
+ * - Loads `.env.local` from the project root if available
26291
+ * - Checks authentication if `requireAuth` is set
26292
+ * - Runs the command function
26293
+ * - Displays the outro message returned by the command
26294
+ * - Handles errors and exits with code 1 on failure
26295
+ *
26296
+ * **Important**: Commands should NOT call `intro()` or `outro()` directly.
26297
+ * This function handles both. Commands can return an optional `outroMessage`
26298
+ * which will be displayed at the end.
26299
+ *
26300
+ * @param commandFn - The async function to execute. Returns `RunCommandResult` with optional `outroMessage`.
26290
26301
  * @param options - Optional configuration for the command wrapper
26291
26302
  *
26292
26303
  * @example
26293
- * // Standard command with simple intro
26304
+ * // Standard command with outro message
26305
+ * async function myAction(): Promise<RunCommandResult> {
26306
+ * // ... do work ...
26307
+ * return { outroMessage: "Done!" };
26308
+ * }
26309
+ *
26294
26310
  * export const myCommand = new Command("my-command")
26295
26311
  * .action(async () => {
26296
26312
  * await runCommand(myAction);
26297
26313
  * });
26298
26314
  *
26299
26315
  * @example
26300
- * // Command requiring authentication
26316
+ * // Command requiring authentication with full banner
26301
26317
  * export const myCommand = new Command("my-command")
26302
26318
  * .action(async () => {
26303
- * await runCommand(myAction, { requireAuth: true });
26319
+ * await runCommand(myAction, { requireAuth: true, fullBanner: true });
26304
26320
  * });
26305
26321
  */
26306
26322
  async function runCommand(commandFn, options) {
26307
- if (options?.fullBanner) await printBanner();
26308
- else Ie(base44Color(" Base 44 "));
26323
+ if (options?.fullBanner) {
26324
+ await printBanner();
26325
+ Ie("");
26326
+ } else Ie(base44Color(" Base 44 "));
26309
26327
  await loadProjectEnv();
26310
26328
  try {
26311
26329
  if (options?.requireAuth) {
@@ -26314,7 +26332,8 @@ async function runCommand(commandFn, options) {
26314
26332
  await login();
26315
26333
  }
26316
26334
  }
26317
- await commandFn();
26335
+ const { outroMessage } = await commandFn();
26336
+ Se(outroMessage || "");
26318
26337
  } catch (e$1) {
26319
26338
  if (e$1 instanceof Error) M.error(e$1.stack ?? e$1.message);
26320
26339
  else M.error(String(e$1));
@@ -26440,7 +26459,7 @@ async function login() {
26440
26459
  const token = await waitForAuthentication(deviceCodeResponse.deviceCode, deviceCodeResponse.expiresIn, deviceCodeResponse.interval);
26441
26460
  const userInfo = await getUserInfo(token.accessToken);
26442
26461
  await saveAuthData(token, userInfo);
26443
- M.success(`Successfully logged in as ${source_default.bold(userInfo.email)}`);
26462
+ return { outroMessage: `Successfully logged in as ${source_default.bold(userInfo.email)}` };
26444
26463
  }
26445
26464
  const loginCommand = new Command("login").description("Authenticate with Base44").action(async () => {
26446
26465
  await runCommand(login);
@@ -26450,7 +26469,7 @@ const loginCommand = new Command("login").description("Authenticate with Base44"
26450
26469
  //#region src/cli/commands/auth/whoami.ts
26451
26470
  async function whoami() {
26452
26471
  const auth = await readAuth();
26453
- M.info(`Logged in as: ${auth.name} (${auth.email})`);
26472
+ return { outroMessage: `Logged in as: ${source_default.bold(auth.email)}` };
26454
26473
  }
26455
26474
  const whoamiCommand = new Command("whoami").description("Display current authenticated user").action(async () => {
26456
26475
  await runCommand(whoami, { requireAuth: true });
@@ -26460,10 +26479,10 @@ const whoamiCommand = new Command("whoami").description("Display current authent
26460
26479
  //#region src/cli/commands/auth/logout.ts
26461
26480
  async function logout() {
26462
26481
  await deleteAuth();
26463
- M.info("Logged out successfully");
26482
+ return { outroMessage: "Logged out successfully" };
26464
26483
  }
26465
26484
  const logoutCommand = new Command("logout").description("Logout from current device").action(async () => {
26466
- await runCommand(logout, { requireAuth: true });
26485
+ await runCommand(logout);
26467
26486
  });
26468
26487
 
26469
26488
  //#endregion
@@ -31447,10 +31466,7 @@ async function createArchive(pathToArchive, targetArchivePath) {
31447
31466
  //#region src/cli/commands/entities/push.ts
31448
31467
  async function pushEntitiesAction() {
31449
31468
  const { entities } = await readProjectConfig();
31450
- if (entities.length === 0) {
31451
- M.warn("No entities found in project");
31452
- return;
31453
- }
31469
+ if (entities.length === 0) return { outroMessage: "No entities found in project" };
31454
31470
  M.info(`Found ${entities.length} entities to push`);
31455
31471
  const result = await runTask("Pushing entities to Base44", async () => {
31456
31472
  return await pushEntities(entities);
@@ -31461,7 +31477,7 @@ async function pushEntitiesAction() {
31461
31477
  if (result.created.length > 0) M.success(`Created: ${result.created.join(", ")}`);
31462
31478
  if (result.updated.length > 0) M.success(`Updated: ${result.updated.join(", ")}`);
31463
31479
  if (result.deleted.length > 0) M.warn(`Deleted: ${result.deleted.join(", ")}`);
31464
- if (result.created.length === 0 && result.updated.length === 0 && result.deleted.length === 0) M.info("No changes detected");
31480
+ return {};
31465
31481
  }
31466
31482
  const entitiesPushCommand = new Command("entities").description("Manage project entities").addCommand(new Command("push").description("Push local entities to Base44").action(async () => {
31467
31483
  await runCommand(pushEntitiesAction, { requireAuth: true });
@@ -38138,7 +38154,6 @@ var import_lodash = /* @__PURE__ */ __toESM(require_lodash(), 1);
38138
38154
  const orange = source_default.hex("#E86B3C");
38139
38155
  const cyan = source_default.hex("#00D4FF");
38140
38156
  async function create() {
38141
- Ie("Let's create something amazing!");
38142
38157
  const templateOptions = (await listTemplates()).map((t) => ({
38143
38158
  value: t,
38144
38159
  label: t.name,
@@ -38222,7 +38237,7 @@ async function create() {
38222
38237
  M.message(`${source_default.dim("Project")}: ${orange(name$1.trim())}`);
38223
38238
  M.message(`${source_default.dim("Dashboard")}: ${cyan(dashboardUrl)}`);
38224
38239
  if (finalAppUrl) M.message(`${source_default.dim("Site")}: ${cyan(finalAppUrl)}`);
38225
- Se("Your project is set and ready to use");
38240
+ return { outroMessage: "Your project is set and ready to use" };
38226
38241
  }
38227
38242
  const createCommand = new Command("create").description("Create a new Base44 project").action(async () => {
38228
38243
  await runCommand(create, {
@@ -38238,17 +38253,13 @@ async function deployAction() {
38238
38253
  if (!project.site?.outputDirectory) throw new Error("No site configuration found. Please add 'site.outputDirectory' to your config.jsonc");
38239
38254
  const outputDir = resolve(project.root, project.site.outputDirectory);
38240
38255
  const shouldDeploy = await ye({ message: `Deploy site from ${project.site.outputDirectory}?` });
38241
- if (pD(shouldDeploy) || !shouldDeploy) {
38242
- M.warn("Deployment cancelled");
38243
- return;
38244
- }
38245
- const result = await runTask("Creating archive and deploying site...", async () => {
38256
+ if (pD(shouldDeploy) || !shouldDeploy) return { outroMessage: "Deployment cancelled" };
38257
+ return { outroMessage: `Visit your site at: ${(await runTask("Creating archive and deploying site...", async () => {
38246
38258
  return await deploySite(outputDir);
38247
38259
  }, {
38248
38260
  successMessage: "Site deployed successfully",
38249
38261
  errorMessage: "Deployment failed"
38250
- });
38251
- M.success(`Site deployed to: ${result.appUrl}`);
38262
+ })).appUrl}` };
38252
38263
  }
38253
38264
  const siteDeployCommand = new Command("site").description("Manage site deployments").addCommand(new Command("deploy").description("Deploy built site files to Base44 hosting").action(async () => {
38254
38265
  await runCommand(deployAction, { requireAuth: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/cli",
3
- "version": "0.0.6-pr.60.bf6ff56",
3
+ "version": "0.0.6-pr.61.3329884",
4
4
  "description": "Base44 CLI - Unified interface for managing Base44 applications",
5
5
  "type": "module",
6
6
  "main": "./dist/cli/index.js",