@base44-preview/cli 0.1.31-pr.657.7711db6 → 0.1.32-pr.643.d9f6a73

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 CHANGED
@@ -221164,6 +221164,34 @@ var require_dist5 = __commonJS(function(exports, module) {
221164
221164
  }
221165
221165
  });
221166
221166
 
221167
+ // ../../node_modules/commander/index.js
221168
+ var exports_commander = {};
221169
+ __exportCjs(exports_commander, {
221170
+ program: () => $program,
221171
+ createCommand: () => $createCommand,
221172
+ createOption: () => $createOption,
221173
+ createArgument: () => $createArgument,
221174
+ Command: () => $Command,
221175
+ Option: () => $Option,
221176
+ Argument: () => $Argument,
221177
+ Help: () => $Help,
221178
+ CommanderError: () => $CommanderError,
221179
+ InvalidArgumentError: () => $InvalidArgumentError,
221180
+ InvalidOptionArgumentError: () => $InvalidOptionArgumentError
221181
+ }, {
221182
+ program: (value) => $program = value,
221183
+ createCommand: (value) => $createCommand = value,
221184
+ createOption: (value) => $createOption = value,
221185
+ createArgument: (value) => $createArgument = value,
221186
+ Command: (value) => $Command = value,
221187
+ Option: (value) => $Option = value,
221188
+ Argument: (value) => $Argument = value,
221189
+ Help: (value) => $Help = value,
221190
+ CommanderError: (value) => $CommanderError = value,
221191
+ InvalidArgumentError: (value) => $InvalidArgumentError = value,
221192
+ InvalidOptionArgumentError: (value) => $InvalidOptionArgumentError = value
221193
+ });
221194
+
221167
221195
  // src/core/utils/env.ts
221168
221196
  var import_dotenv = __toESM(require_main(), 1);
221169
221197
  import { basename, dirname as dirname3, join } from "node:path";
@@ -229878,32 +229906,6 @@ class SimpleLogger {
229878
229906
  }
229879
229907
  }
229880
229908
  // ../../node_modules/commander/index.js
229881
- var exports_commander = {};
229882
- __exportCjs(exports_commander, {
229883
- program: () => $program,
229884
- createCommand: () => $createCommand,
229885
- createOption: () => $createOption,
229886
- createArgument: () => $createArgument,
229887
- Command: () => $Command,
229888
- Option: () => $Option,
229889
- Argument: () => $Argument,
229890
- Help: () => $Help,
229891
- CommanderError: () => $CommanderError,
229892
- InvalidArgumentError: () => $InvalidArgumentError,
229893
- InvalidOptionArgumentError: () => $InvalidOptionArgumentError
229894
- }, {
229895
- program: (value) => $program = value,
229896
- createCommand: (value) => $createCommand = value,
229897
- createOption: (value) => $createOption = value,
229898
- createArgument: (value) => $createArgument = value,
229899
- Command: (value) => $Command = value,
229900
- Option: (value) => $Option = value,
229901
- Argument: (value) => $Argument = value,
229902
- Help: (value) => $Help = value,
229903
- CommanderError: (value) => $CommanderError = value,
229904
- InvalidArgumentError: (value) => $InvalidArgumentError = value,
229905
- InvalidOptionArgumentError: (value) => $InvalidOptionArgumentError = value
229906
- });
229907
229909
  var { Argument } = require_argument();
229908
229910
  var { Command } = require_command();
229909
229911
  var { CommanderError, InvalidArgumentError } = require_error2();
@@ -236596,6 +236598,15 @@ var FinalizeDeploymentResponseSchema = object({
236596
236598
  }).transform((data) => ({
236597
236599
  deploymentId: data.deployment_id
236598
236600
  }));
236601
+ var PublishDeploymentResponseSchema = object({
236602
+ git_hash: string2(),
236603
+ deployed_at: string2(),
236604
+ app_url: string2()
236605
+ }).transform((data) => ({
236606
+ gitHash: data.git_hash,
236607
+ deployedAt: data.deployed_at,
236608
+ appUrl: data.app_url
236609
+ }));
236599
236610
 
236600
236611
  // src/core/project/api.ts
236601
236612
  var PUBLIC_SETTINGS = {
@@ -239374,7 +239385,7 @@ import { join as join13 } from "node:path";
239374
239385
  // package.json
239375
239386
  var package_default = {
239376
239387
  name: "base44",
239377
- version: "0.1.31",
239388
+ version: "0.1.32",
239378
239389
  description: "Base44 CLI - Unified interface for managing Base44 applications",
239379
239390
  type: "module",
239380
239391
  bin: {
@@ -239678,6 +239689,22 @@ async function finalizeDeployment(deploymentId, sessionId, payload) {
239678
239689
  }
239679
239690
  return result.data;
239680
239691
  }
239692
+ async function publishDeployment(gitHash) {
239693
+ const appClient = getAppClient();
239694
+ let response;
239695
+ try {
239696
+ response = await appClient.post(`deployments/${gitHash}/publish`, {
239697
+ timeout: 120000
239698
+ });
239699
+ } catch (error) {
239700
+ throw await ApiError.fromHttpError(error, "publishing deployment");
239701
+ }
239702
+ const result = PublishDeploymentResponseSchema.safeParse(await response.json());
239703
+ if (!result.success) {
239704
+ throw new SchemaValidationError("Invalid response from server", result.error);
239705
+ }
239706
+ return result.data;
239707
+ }
239681
239708
  // src/core/site/config.ts
239682
239709
  async function getSiteFilePaths(outputDir) {
239683
239710
  return await globby("**/*", {
@@ -240261,11 +240288,6 @@ async function putPresignedBody(upload, body) {
240261
240288
 
240262
240289
  // src/core/site/deployment.ts
240263
240290
  var NO_ASSETS = { manifest: {}, filesByHash: new Map };
240264
- var DEPLOYMENTS_API_ENV = "BASE44_DEPLOYMENTS_API";
240265
- function deploymentsApiEnabled(env = process.env) {
240266
- const value = env[DEPLOYMENTS_API_ENV];
240267
- return value === "1" || value === "true";
240268
- }
240269
240291
  async function deployToDeployments(options) {
240270
240292
  const { projectRoot, outputDir, gitHash, concurrency, progress } = options;
240271
240293
  const worker = await resolveWorkerBuild(projectRoot, progress);
@@ -246871,7 +246893,7 @@ async function gitHead(projectRoot) {
246871
246893
  }
246872
246894
  }
246873
246895
  // src/core/project/deploy.ts
246874
- function hasResourcesToDeploy(projectData) {
246896
+ async function hasResourcesToDeploy(projectData) {
246875
246897
  const {
246876
246898
  project,
246877
246899
  entities,
@@ -246882,7 +246904,7 @@ function hasResourcesToDeploy(projectData) {
246882
246904
  connectors,
246883
246905
  authConfig
246884
246906
  } = projectData;
246885
- const hasSite = Boolean(project.site?.outputDirectory);
246907
+ const hasSite = Boolean(project.site?.outputDirectory) || Boolean(await detectFullStackArtifact(project.root));
246886
246908
  const hasEntities = entities.length > 0;
246887
246909
  const hasFunctions = functions.length > 0;
246888
246910
  const hasActors = actors.length > 0;
@@ -246941,12 +246963,59 @@ async function deployAll(projectData, options) {
246941
246963
  await authConfigResource.push(authConfig);
246942
246964
  const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
246943
246965
  const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
246944
- if (project.site?.outputDirectory) {
246945
- const outputDir = resolve5(project.root, project.site.outputDirectory);
246966
+ const appUrl = await deployProjectSite(project, options);
246967
+ return appUrl ? { appUrl, connectorResults } : { connectorResults };
246968
+ }
246969
+ async function deployProjectSite(project, options) {
246970
+ const outputDirectory = project.site?.outputDirectory;
246971
+ const outputDir = outputDirectory ? resolve5(project.root, outputDirectory) : null;
246972
+ if (!outputDir) {
246973
+ if (!await detectFullStackArtifact(project.root)) {
246974
+ return;
246975
+ }
246976
+ const gitHash = await resolveGitHash(project.root, options?.gitHash);
246977
+ return shipCommit(project.root, null, gitHash, options);
246978
+ }
246979
+ const gitHash = await resolveGitHash(project.root, options?.gitHash).catch(() => {
246980
+ return;
246981
+ });
246982
+ if (!gitHash) {
246983
+ options?.onSiteProgress?.("No commit found for this build, so it was deployed without one. Commit your work to address deployments by it.");
246946
246984
  const { appUrl } = await deploySite(outputDir);
246947
- return { appUrl, connectorResults };
246985
+ return appUrl;
246986
+ }
246987
+ return shipCommit(project.root, outputDir, gitHash, options);
246988
+ }
246989
+ async function shipCommit(projectRoot, outputDir, gitHash, options) {
246990
+ await deployToDeployments({
246991
+ projectRoot,
246992
+ outputDir,
246993
+ gitHash,
246994
+ progress: {
246995
+ onWarning: (message) => options?.onSiteProgress?.(message),
246996
+ onAssets: ({ totalAssets, newAssets }) => options?.onSiteProgress?.(`Found ${totalAssets} static assets (${newAssets} new)`)
246997
+ }
246998
+ });
246999
+ if (options?.publish === false) {
247000
+ return;
247001
+ }
247002
+ try {
247003
+ const { appUrl } = await publishDeployment(gitHash);
247004
+ return appUrl;
247005
+ } catch (error) {
247006
+ if (!publishesFromBuilder(error)) {
247007
+ throw error;
247008
+ }
247009
+ options?.onSiteProgress?.("Site deployed. This app is published from the Base44 builder, so production was left where it was.");
247010
+ return;
246948
247011
  }
246949
- return { connectorResults };
247012
+ }
247013
+ function publishesFromBuilder(error) {
247014
+ if (!(error instanceof ApiError)) {
247015
+ return false;
247016
+ }
247017
+ const body = error.responseBody;
247018
+ return body?.extra_data?.code === "app_publishes_from_builder";
246950
247019
  }
246951
247020
  // src/core/project/target.ts
246952
247021
  import { dirname as dirname13, join as join19, resolve as resolve6 } from "node:path";
@@ -250078,7 +250147,7 @@ async function deployAction(ctx, options = {}) {
250078
250147
  throw new InvalidInputError("--yes is required in non-interactive mode");
250079
250148
  }
250080
250149
  const projectData = await readProjectConfig(options.projectRoot);
250081
- if (!hasResourcesToDeploy(projectData)) {
250150
+ if (!await hasResourcesToDeploy(projectData)) {
250082
250151
  return {
250083
250152
  outroMessage: "No resources found to deploy"
250084
250153
  };
@@ -250137,6 +250206,11 @@ ${summaryLines.join(`
250137
250206
  const functionTotal = functions.length;
250138
250207
  let actorCompleted = 0;
250139
250208
  const result = await deployAll(projectData, {
250209
+ gitHash: options.gitHash,
250210
+ publish: options.publish,
250211
+ onSiteProgress: (message) => {
250212
+ log.message(theme.styles.dim(message));
250213
+ },
250140
250214
  onVisibilitySet: (level) => {
250141
250215
  log.success(`App visibility set to ${level}`);
250142
250216
  },
@@ -250172,7 +250246,7 @@ ${summaryLines.join(`
250172
250246
  return { outroMessage: "App deployed successfully" };
250173
250247
  }
250174
250248
  function getDeployCommand3() {
250175
- return new Base44Command("deploy").description("Deploy all project resources (entities, functions, actors, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)").action(deployAction);
250249
+ return new Base44Command("deploy").description("Deploy all project resources (entities, functions, actors, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)").option("--no-publish", "Deploy the site without serving it in production yet").addOption(new Option2("--git-hash <hash>", "Commit the built site came from (defaults to the checkout's HEAD)").argParser(parseGitHash)).action(deployAction);
250176
250250
  }
250177
250251
  async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
250178
250252
  const needsOAuth = filterPendingOAuth(connectorResults);
@@ -250193,6 +250267,12 @@ function printStripeResult(r, log) {
250193
250267
  }
250194
250268
  log.info(` Connectors dashboard: ${theme.colors.links(getConnectorsUrl())}`);
250195
250269
  }
250270
+ function parseGitHash(value) {
250271
+ if (!isGitCommitHash(value)) {
250272
+ throw new InvalidArgumentError2("Expected a git commit hash (7-64 hex chars).");
250273
+ }
250274
+ return value;
250275
+ }
250196
250276
 
250197
250277
  // src/cli/commands/project/app-id-options.ts
250198
250278
  function readExplicitAppId(command) {
@@ -262074,17 +262154,18 @@ async function deployAction2(ctx, options) {
262074
262154
  return { outroMessage: "Deployment cancelled" };
262075
262155
  }
262076
262156
  }
262077
- return deploymentsApiEnabled() ? await deployToDeploymentsApi(ctx, project, options) : await deployTarball(ctx, project);
262157
+ return deployToDeploymentsApi(ctx, project, options);
262078
262158
  }
262079
262159
  async function deployToDeploymentsApi(ctx, project, options) {
262080
262160
  const { runTask, log, jsonMode } = ctx;
262081
262161
  const projectRoot = project.root;
262162
+ const outputDir = siteOutputDir(project);
262082
262163
  const gitHash = await resolveGitHash(projectRoot, options.gitHash);
262083
262164
  const progressLines = [];
262084
262165
  const warnings = [];
262085
262166
  const { deploymentId } = await runTask("Deploying site...", async (updateMessage) => await deployToDeployments({
262086
262167
  projectRoot,
262087
- outputDir: siteOutputDir(project),
262168
+ outputDir,
262088
262169
  gitHash,
262089
262170
  concurrency: options.concurrency,
262090
262171
  progress: {
@@ -262110,33 +262191,24 @@ async function deployToDeploymentsApi(ctx, project, options) {
262110
262191
  for (const warning of warnings) {
262111
262192
  log.warn(warning);
262112
262193
  }
262194
+ const published = options.publish ? await runTask("Publishing site...", async () => await publishDeployment(gitHash), { successMessage: "Site published", errorMessage: "Publish failed" }) : undefined;
262195
+ if (published) {
262196
+ log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(published.appUrl)}`);
262197
+ }
262113
262198
  return {
262114
262199
  outroMessage: `Deployment ${deploymentId} (commit ${gitHash.slice(0, 12)})`,
262115
- stdout: jsonMode ? `${JSON.stringify({ deploymentId, gitHash }, null, 2)}
262200
+ stdout: jsonMode ? `${JSON.stringify({ deploymentId, gitHash, published: Boolean(published) }, null, 2)}
262116
262201
  ` : undefined
262117
262202
  };
262118
262203
  }
262119
- async function deployTarball({ runTask }, project) {
262120
- const outputDir = siteOutputDir(project);
262121
- const { appUrl } = await runTask("Creating archive and deploying site...", async () => await deploySite(outputDir), {
262122
- successMessage: "Site deployed successfully",
262123
- errorMessage: "Deployment failed"
262124
- });
262125
- return { outroMessage: `Visit your site at: ${appUrl}` };
262126
- }
262127
262204
  function siteOutputDir(project) {
262128
262205
  const { outputDirectory = DEFAULT_SITE.outputDirectory } = siteOrDefault(project);
262129
262206
  return resolve15(project.root, outputDirectory);
262130
262207
  }
262131
262208
  function getSiteDeployCommand() {
262132
- const command = new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)");
262133
- if (deploymentsApiEnabled()) {
262134
- command.addOption(new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser(parseGitHash));
262135
- command.addOption(new Option2("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency));
262136
- }
262137
- return command.action(deployAction2);
262209
+ return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)").option("--publish", "Serve this build in production once it is deployed").addOption(new Option2("--git-hash <hash>", "Commit the build came from (defaults to the checkout's HEAD)").argParser(parseGitHash2)).addOption(new Option2("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency)).action(deployAction2);
262138
262210
  }
262139
- function parseGitHash(value) {
262211
+ function parseGitHash2(value) {
262140
262212
  if (!isGitCommitHash(value)) {
262141
262213
  throw new InvalidArgumentError2("Expected a git commit hash (7-64 hex chars).");
262142
262214
  }
@@ -271284,4 +271356,4 @@ export {
271284
271356
  runCLI
271285
271357
  };
271286
271358
 
271287
- //# debugId=7FB565796F6FC1AA64756E2164756E21
271359
+ //# debugId=67AAB05EA687C35164756E2164756E21