@base44-preview/cli 0.1.33-pr.643.44738be → 0.1.33-pr.643.706636f

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
@@ -246850,22 +246850,21 @@ function isGitCommitHash(value) {
246850
246850
  }
246851
246851
 
246852
246852
  // src/core/site/git-hash.ts
246853
- async function resolveGitHash(projectRoot, explicit) {
246854
- const hash = explicit ?? await gitHead(projectRoot);
246855
- if (!hash || !isGitCommitHash(hash)) {
246856
- throw new InvalidInputError(explicit ? `'${explicit}' is not a git commit hash.` : "Deployments are addressed by the commit that produced the build, and no git commit was found.", {
246857
- hints: [
246858
- {
246859
- message: "Run the deploy from a git checkout, or pass the commit explicitly with --git-hash."
246860
- }
246861
- ]
246862
- });
246863
- }
246864
- return hash;
246853
+ function workerBuildNeedsGitHashError() {
246854
+ return new InvalidInputError("A full-stack build deploys by the commit that produced it, and none was given.", {
246855
+ hints: [
246856
+ {
246857
+ message: "Pass it with --git-hash, e.g. --git-hash $(git rev-parse HEAD)."
246858
+ }
246859
+ ]
246860
+ });
246865
246861
  }
246866
246862
  async function resolveProvenanceCommit(projectRoot, explicit) {
246867
246863
  if (explicit) {
246868
- return await resolveGitHash(projectRoot, explicit);
246864
+ if (!isGitCommitHash(explicit)) {
246865
+ throw new InvalidInputError(`'${explicit}' is not a git commit hash.`);
246866
+ }
246867
+ return explicit;
246869
246868
  }
246870
246869
  const hash = await gitHead(projectRoot);
246871
246870
  return hash && isGitCommitHash(hash) ? hash : undefined;
@@ -246914,6 +246913,9 @@ async function deployAll(projectData, options) {
246914
246913
  connectors,
246915
246914
  authConfig
246916
246915
  } = projectData;
246916
+ if (!options?.gitHash && await detectFullStackArtifact(project.root)) {
246917
+ throw workerBuildNeedsGitHashError();
246918
+ }
246917
246919
  await setAppVisibility(project.visibility);
246918
246920
  if (project.visibility) {
246919
246921
  options?.onVisibilitySet?.(project.visibility);
@@ -246957,22 +246959,15 @@ async function deployAll(projectData, options) {
246957
246959
  async function deployProjectSite(project, options) {
246958
246960
  const outputDirectory = project.site?.outputDirectory;
246959
246961
  const outputDir = outputDirectory ? resolve5(project.root, outputDirectory) : null;
246960
- if (!outputDir) {
246961
- if (!await detectFullStackArtifact(project.root)) {
246962
- return;
246963
- }
246964
- const gitHash = await resolveGitHash(project.root, options?.gitHash);
246965
- return shipCommit(project.root, null, gitHash, options);
246962
+ const gitHash = options?.gitHash;
246963
+ if (gitHash && (outputDir || await detectFullStackArtifact(project.root))) {
246964
+ return shipCommit(project.root, outputDir, gitHash, options);
246966
246965
  }
246967
- const gitHash = await resolveGitHash(project.root, options?.gitHash).catch(() => {
246966
+ if (!outputDir) {
246968
246967
  return;
246969
- });
246970
- if (!gitHash) {
246971
- options?.onSiteProgress?.("No commit found for this build, so it was deployed without one. Commit your work to address deployments by it.");
246972
- const { appUrl } = await deploySite(outputDir);
246973
- return appUrl;
246974
246968
  }
246975
- return shipCommit(project.root, outputDir, gitHash, options);
246969
+ const { appUrl } = await deploySite(outputDir);
246970
+ return appUrl;
246976
246971
  }
246977
246972
  async function shipCommit(projectRoot, outputDir, gitHash, options) {
246978
246973
  await deployToDeployments({
@@ -252098,7 +252093,7 @@ ${summaryLines.join(`
252098
252093
  return { outroMessage: "App deployed successfully" };
252099
252094
  }
252100
252095
  function getDeployCommand3() {
252101
- 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)").addOption(new Option2("--git-hash <hash>", "Commit the built site came from (defaults to the checkout's HEAD)").argParser(parseGitHash)).action(deployAction);
252096
+ 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)").addOption(new Option2("--git-hash <hash>", "Deploy by the commit the build came from, through the deployments API").argParser(parseGitHash)).action(deployAction);
252102
252097
  }
252103
252098
  async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
252104
252099
  const needsOAuth = filterPendingOAuth(connectorResults);
@@ -264801,7 +264796,13 @@ async function deployToDeploymentsApi(ctx, project, options) {
264801
264796
  const { runTask, log, jsonMode } = ctx;
264802
264797
  const projectRoot = project.root;
264803
264798
  const outputDir = siteOutputDir(project);
264804
- const gitHash = await resolveGitHash(projectRoot, options.gitHash);
264799
+ const gitHash = options.gitHash;
264800
+ if (!gitHash) {
264801
+ if (await detectFullStackArtifact(projectRoot)) {
264802
+ throw workerBuildNeedsGitHashError();
264803
+ }
264804
+ return deployArchive(ctx, outputDir);
264805
+ }
264805
264806
  const progressLines = [];
264806
264807
  const warnings = [];
264807
264808
  const { deploymentId } = await runTask("Deploying site...", async (updateMessage) => await deployToDeployments({
@@ -264835,6 +264836,8 @@ async function deployToDeploymentsApi(ctx, project, options) {
264835
264836
  const published = options.publish ? await runTask("Publishing site...", async () => await publishDeployment(gitHash), { successMessage: "Site published", errorMessage: "Publish failed" }) : undefined;
264836
264837
  if (published) {
264837
264838
  log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(published.appUrl)}`);
264839
+ } else {
264840
+ log.info("Not published: production still serves its previous build. Run again with --publish to serve this one.");
264838
264841
  }
264839
264842
  return {
264840
264843
  outroMessage: `Deployment ${deploymentId} (commit ${gitHash.slice(0, 12)})`,
@@ -264842,12 +264845,23 @@ async function deployToDeploymentsApi(ctx, project, options) {
264842
264845
  ` : undefined
264843
264846
  };
264844
264847
  }
264848
+ async function deployArchive({ runTask, jsonMode }, outputDir) {
264849
+ const { appUrl } = await runTask("Creating archive and deploying site...", async () => await deploySite(outputDir), {
264850
+ successMessage: "Site deployed successfully",
264851
+ errorMessage: "Deployment failed"
264852
+ });
264853
+ return {
264854
+ outroMessage: `Visit your site at: ${appUrl}`,
264855
+ stdout: jsonMode ? `${JSON.stringify({ appUrl, published: true }, null, 2)}
264856
+ ` : undefined
264857
+ };
264858
+ }
264845
264859
  function siteOutputDir(project) {
264846
264860
  const { outputDirectory = DEFAULT_SITE.outputDirectory } = siteOrDefault(project);
264847
264861
  return resolve16(project.root, outputDirectory);
264848
264862
  }
264849
264863
  function getSiteDeployCommand() {
264850
- 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(parseGitHash)).addOption(new Option2("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency)).action(deployAction2);
264864
+ 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>", "Deploy by the commit the build came from, through the deployments API").argParser(parseGitHash)).addOption(new Option2("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency)).action(deployAction2);
264851
264865
  }
264852
264866
  function parseConcurrency(value) {
264853
264867
  const parsed = Number(value);
@@ -273992,4 +274006,4 @@ export {
273992
274006
  runCLI
273993
274007
  };
273994
274008
 
273995
- //# debugId=F146228674371CF664756E2164756E21
274009
+ //# debugId=5C430C51A4BFB55664756E2164756E21