betterstart-cli 0.0.32 → 0.0.33

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.js CHANGED
@@ -19775,6 +19775,14 @@ function fitSpinnerMessage(message) {
19775
19775
  if (visible.length <= max) return message;
19776
19776
  return `${visible.slice(0, max - 1)}\u2026`;
19777
19777
  }
19778
+ var CLACK_LINE_ROWS = 2;
19779
+ function eraseClackLine(options = {}) {
19780
+ if (!process.stdout.isTTY || process.env.CI === "true") return;
19781
+ const below = (options.linesBelow ?? 0) * CLACK_LINE_ROWS;
19782
+ const up = below + CLACK_LINE_ROWS;
19783
+ const restore = below > 0 ? `\x1B[${below}B` : "";
19784
+ process.stdout.write(`\x1B[${up}A\x1B[${CLACK_LINE_ROWS}M${restore}`);
19785
+ }
19778
19786
  function spinner2(options) {
19779
19787
  const inner = p5.spinner(options);
19780
19788
  const guided = options?.withGuide !== false;
@@ -24235,10 +24243,10 @@ async function ensureVercelAuth(runner, cwd, options) {
24235
24243
  if (existing.authed) {
24236
24244
  if (options.quietIfAuthed) {
24237
24245
  checkSpinner.clear();
24238
- } else {
24239
- checkSpinner.stop(signedInMessage(existing.username));
24246
+ return existing;
24240
24247
  }
24241
- return existing;
24248
+ checkSpinner.stop(signedInMessage(existing.username));
24249
+ return { ...existing, dismissNote: eraseClackLine };
24242
24250
  }
24243
24251
  if (env.VERCEL_TOKEN) {
24244
24252
  checkSpinner.stop("Could not verify VERCEL_TOKEN with Vercel");
@@ -24263,7 +24271,7 @@ async function ensureVercelAuth(runner, cwd, options) {
24263
24271
  const after = await checkVercelAuth(runner, cwd, env);
24264
24272
  if (after.authed) {
24265
24273
  verifySpinner.stop(signedInMessage(after.username));
24266
- return after;
24274
+ return { ...after, dismissNote: eraseClackLine };
24267
24275
  }
24268
24276
  verifySpinner.stop("Could not verify your Vercel sign-in");
24269
24277
  return { authed: false, reason: "login-failed" };
@@ -24710,7 +24718,7 @@ async function provisionNeonInteractive(runner, cwd, options) {
24710
24718
  if (!add.success) {
24711
24719
  return { failure: add.timedOut ? "timeout" : "provision-failed" };
24712
24720
  }
24713
- return {};
24721
+ return { usedTerminalFallback: true };
24714
24722
  }
24715
24723
  async function provisionNeon(runner, cwd, options) {
24716
24724
  const provisionSpinner = spinner2();
@@ -24773,7 +24781,7 @@ async function runVercelNeonFlow(options) {
24773
24781
  p16.log.warn(authFailureMessage(auth.reason));
24774
24782
  return { ok: false };
24775
24783
  }
24776
- await ensureLinkedProject(runner, options.cwd, options.projectName, env);
24784
+ const linkLinePrinted = await ensureLinkedProject(runner, options.cwd, options.projectName, env);
24777
24785
  const neon = await provisionNeonForMode(runner, options);
24778
24786
  if (neon.failure) {
24779
24787
  p16.log.warn(neonFailureMessage(neon.failure));
@@ -24781,11 +24789,13 @@ async function runVercelNeonFlow(options) {
24781
24789
  return { ok: false };
24782
24790
  }
24783
24791
  const databaseUrl = await pullNeonDatabaseUrl(runner, options.cwd, env);
24792
+ const dismissSignedInNote = databaseUrl && auth.dismissNote && !neon.usedTerminalFallback ? () => auth.dismissNote?.({ linesBelow: linkLinePrinted ? 1 : 0 }) : void 0;
24784
24793
  return {
24785
24794
  ok: true,
24786
24795
  databaseUrl,
24787
24796
  dashboardUrl: neon.dashboardUrl,
24788
- resourceUrl: neon.resourceUrl
24797
+ resourceUrl: neon.resourceUrl,
24798
+ dismissSignedInNote
24789
24799
  };
24790
24800
  } catch (error) {
24791
24801
  p16.log.warn(
@@ -24899,13 +24909,14 @@ function printManualDeployHint() {
24899
24909
  p16.log.info(`You can deploy manually: ${pc6.cyan("vercel deploy --prod")}`);
24900
24910
  }
24901
24911
  async function ensureLinkedProject(runner, cwd, projectName, env) {
24902
- if (readLinkedProjectId(cwd)) return;
24912
+ if (readLinkedProjectId(cwd)) return false;
24903
24913
  const projectSpinner = spinner2();
24904
24914
  projectSpinner.start(`Creating a Vercel project ${pc6.cyan(projectName)}`);
24905
24915
  const project2 = await createVercelProject(runner, cwd, projectName, env);
24906
24916
  projectSpinner.stop(
24907
24917
  project2.linked ? `Linked Vercel project ${pc6.cyan(project2.name)}` : `Using Vercel project ${pc6.cyan(project2.name)}`
24908
24918
  );
24919
+ return true;
24909
24920
  }
24910
24921
  async function pullNeonDatabaseUrl(runner, cwd, env) {
24911
24922
  const neonSpinner = spinner2();
@@ -25541,6 +25552,7 @@ async function runInitCommand(name, options) {
25541
25552
  isFreshProject = true;
25542
25553
  }
25543
25554
  let databaseUrl;
25555
+ let dismissVercelSignedInNote;
25544
25556
  const existingDbUrl = readExistingDbUrl(cwd);
25545
25557
  if (options.yes) {
25546
25558
  if (options.databaseUrl) {
@@ -25564,10 +25576,9 @@ async function runInitCommand(name, options) {
25564
25576
  if (flow.ok && flow.databaseUrl) {
25565
25577
  databaseUrl = flow.databaseUrl;
25566
25578
  persistDatabaseUrl(cwd, databaseUrl);
25567
- p17.log.success(`Saved DATABASE_URL to ${pc7.cyan(".env.local")}`);
25568
25579
  } else if (flow.ok) {
25569
25580
  p17.log.warn("Created a Neon database, but DATABASE_URL could not be retrieved from Vercel.");
25570
- const resourceUrl = flow.resourceUrl ?? flow.dashboardUrl;
25581
+ const resourceUrl = flow.dashboardUrl ?? flow.resourceUrl;
25571
25582
  if (resourceUrl) {
25572
25583
  p17.log.info(
25573
25584
  `Open ${pc7.cyan(resourceUrl)} to copy DATABASE_URL, then rerun ${pc7.cyan("betterstart init --database-url <url> --yes")}.`
@@ -25598,12 +25609,11 @@ async function runInitCommand(name, options) {
25598
25609
  if (flow.ok && flow.databaseUrl) {
25599
25610
  databaseUrl = flow.databaseUrl;
25600
25611
  persistDatabaseUrl(cwd, databaseUrl);
25601
- p17.log.success(`Saved DATABASE_URL to ${pc7.cyan(".env.local")}`);
25612
+ dismissVercelSignedInNote = flow.dismissSignedInNote;
25602
25613
  } else if (flow.ok) {
25603
- openBrowserVercelNeonResource(flow.resourceUrl ?? flow.dashboardUrl);
25614
+ openBrowserVercelNeonResource(flow.dashboardUrl ?? flow.resourceUrl);
25604
25615
  databaseUrl = await promptConnectionString();
25605
25616
  persistDatabaseUrl(cwd, databaseUrl);
25606
- p17.log.success(`Saved DATABASE_URL to ${pc7.cyan(".env.local")}`);
25607
25617
  } else {
25608
25618
  p17.log.info("Falling back to a manual database connection string.");
25609
25619
  openBrowserVercelNeon();
@@ -25666,6 +25676,7 @@ async function runInitCommand(name, options) {
25666
25676
  } else if (options.yes) {
25667
25677
  pluginSelection = { plugins: [], integrations: [], storage: "local" };
25668
25678
  } else {
25679
+ dismissVercelSignedInNote?.();
25669
25680
  const promptResult = await promptPlugins(cwd, {
25670
25681
  provisionVercelBlob: vercelBlobAllowed ? () => runVercelBlobFlow({ cwd, projectName, interactive: true, env: process.env }) : void 0
25671
25682
  });