betterstart-cli 0.0.30 → 0.0.31

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
@@ -24692,15 +24692,7 @@ async function provisionNeonInteractive(runner, cwd, options) {
24692
24692
  if (!add.success) {
24693
24693
  return { failure: add.timedOut ? "timeout" : "provision-failed" };
24694
24694
  }
24695
- const pullSpinner = spinner2();
24696
- pullSpinner.start("Retrieving DATABASE_URL from Vercel");
24697
- const databaseUrl = await pullVercelEnvValue(runner, cwd, readDbUrlFromDotenv, options.env);
24698
- if (!databaseUrl) {
24699
- pullSpinner.stop(`${pc5.yellow("\u25B2")} No DATABASE_URL came back from Vercel`);
24700
- return {};
24701
- }
24702
- pullSpinner.clear();
24703
- return { databaseUrl };
24695
+ return {};
24704
24696
  }
24705
24697
  async function provisionNeon(runner, cwd, options) {
24706
24698
  const provisionSpinner = spinner2();
@@ -24723,20 +24715,6 @@ ${add.stderr}`.trim();
24723
24715
  provisionSpinner.clear();
24724
24716
  return readNeonProvisionInfo(add.stdout);
24725
24717
  }
24726
- async function connectNeonResourceToProject(runner, cwd, resourceName, env) {
24727
- const connect = await runVercel(
24728
- runner,
24729
- ["integration", "resource", "connect", resourceName, "--yes", "--format", "json"],
24730
- { cwd, mode: "capture", timeoutMs: PROVISION_TIMEOUT_MS2, env }
24731
- );
24732
- if (connect.success) return { ok: true };
24733
- const detail = `${connect.stdout}
24734
- ${connect.stderr}`.trim();
24735
- if (/already connected/i.test(detail)) {
24736
- return { ok: true, alreadyConnected: true, detail: detail || void 0 };
24737
- }
24738
- return { ok: false, detail: detail || void 0 };
24739
- }
24740
24718
  function readDbUrlFromDotenv(filePath) {
24741
24719
  const vars = parseDotenvFile(filePath);
24742
24720
  const isPg = (v) => !!v && (v.startsWith("postgres://") || v.startsWith("postgresql://"));
@@ -24747,14 +24725,13 @@ function readDbUrlFromDotenv(filePath) {
24747
24725
  function readNeonProvisionInfo(stdout) {
24748
24726
  const meta = parseVercelJson(stdout);
24749
24727
  if (!meta) return {};
24750
- return {
24751
- resourceName: meta.resource?.name,
24752
- dashboardUrl: meta.dashboardUrl,
24753
- resourceUrl: meta.ssoUrl?.resource
24754
- };
24728
+ const info = {};
24729
+ if (meta.dashboardUrl) info.dashboardUrl = meta.dashboardUrl;
24730
+ if (meta.ssoUrl?.resource) info.resourceUrl = meta.ssoUrl.resource;
24731
+ return info;
24755
24732
  }
24756
24733
  function neonAddArgs(options) {
24757
- const addArgs = ["integration", "add", "neon", "--no-connect", "--format", "json"];
24734
+ const addArgs = ["integration", "add", "neon", "--format", "json"];
24758
24735
  if (options.plan) addArgs.push("--plan", options.plan);
24759
24736
  return addArgs;
24760
24737
  }
@@ -24785,20 +24762,10 @@ async function runVercelNeonFlow(options) {
24785
24762
  if (neon.detail) p16.log.message(pc6.dim(neon.detail));
24786
24763
  return { ok: false };
24787
24764
  }
24788
- let databaseUrl = neon.databaseUrl;
24789
- if (neon.resourceName) {
24790
- const pulledDatabaseUrl = await connectNeonAndPullDatabaseUrl(
24791
- runner,
24792
- options.cwd,
24793
- neon.resourceName,
24794
- env
24795
- );
24796
- databaseUrl = pulledDatabaseUrl ?? databaseUrl;
24797
- }
24765
+ const databaseUrl = await pullNeonDatabaseUrl(runner, options.cwd, env);
24798
24766
  return {
24799
24767
  ok: true,
24800
24768
  databaseUrl,
24801
- neonResourceName: neon.resourceName,
24802
24769
  dashboardUrl: neon.dashboardUrl,
24803
24770
  resourceUrl: neon.resourceUrl
24804
24771
  };
@@ -24860,24 +24827,6 @@ async function runVercelDeployFlow(options) {
24860
24827
  return { ok: false };
24861
24828
  }
24862
24829
  await ensureLinkedProject(runner, options.cwd, options.projectName, env);
24863
- if (options.neonResourceName) {
24864
- const neonSpinner = spinner2();
24865
- neonSpinner.start("Connecting Neon database to Vercel project");
24866
- const connect = await connectNeonResourceToProject(
24867
- runner,
24868
- options.cwd,
24869
- options.neonResourceName,
24870
- env
24871
- );
24872
- if (connect.ok) {
24873
- neonSpinner.stop(
24874
- connect.alreadyConnected ? "Neon database already connected to Vercel project" : "Connected Neon database to Vercel project"
24875
- );
24876
- } else {
24877
- neonSpinner.stop(`${pc6.yellow("\u25B2")} Could not connect Neon database to Vercel project`);
24878
- if (connect.detail) p16.log.message(pc6.dim(connect.detail));
24879
- }
24880
- }
24881
24830
  const envSpinner = spinner2();
24882
24831
  envSpinner.start("Syncing environment variables to Vercel");
24883
24832
  const sync = await syncVercelProductionEnv(runner, options.cwd, env);
@@ -24940,16 +24889,9 @@ async function ensureLinkedProject(runner, cwd, projectName, env) {
24940
24889
  project2.linked ? `Linked Vercel project ${pc6.cyan(project2.name)}` : `Using Vercel project ${pc6.cyan(project2.name)}`
24941
24890
  );
24942
24891
  }
24943
- async function connectNeonAndPullDatabaseUrl(runner, cwd, resourceName, env) {
24892
+ async function pullNeonDatabaseUrl(runner, cwd, env) {
24944
24893
  const neonSpinner = spinner2();
24945
- neonSpinner.start("Connecting Neon database to Vercel project");
24946
- const connect = await connectNeonResourceToProject(runner, cwd, resourceName, env);
24947
- if (!connect.ok) {
24948
- neonSpinner.stop(`${pc6.yellow("\u25B2")} Could not connect Neon database to Vercel project`);
24949
- if (connect.detail) p16.log.message(pc6.dim(connect.detail));
24950
- return void 0;
24951
- }
24952
- neonSpinner.message("Retrieving DATABASE_URL from Vercel");
24894
+ neonSpinner.start("Retrieving DATABASE_URL from Vercel");
24953
24895
  const databaseUrl = await pullVercelEnvValue(runner, cwd, readDbUrlFromDotenv, env);
24954
24896
  if (!databaseUrl) {
24955
24897
  neonSpinner.stop(`${pc6.yellow("\u25B2")} No DATABASE_URL came back from Vercel`);
@@ -25581,7 +25523,6 @@ async function runInitCommand(name, options) {
25581
25523
  isFreshProject = true;
25582
25524
  }
25583
25525
  let databaseUrl;
25584
- let neonResourceName;
25585
25526
  const existingDbUrl = readExistingDbUrl(cwd);
25586
25527
  if (options.yes) {
25587
25528
  if (options.databaseUrl) {
@@ -25603,12 +25544,10 @@ async function runInitCommand(name, options) {
25603
25544
  env: process.env
25604
25545
  });
25605
25546
  if (flow.ok && flow.databaseUrl) {
25606
- neonResourceName = flow.neonResourceName;
25607
25547
  databaseUrl = flow.databaseUrl;
25608
25548
  persistDatabaseUrl(cwd, databaseUrl);
25609
25549
  p17.log.success(`Saved DATABASE_URL to ${pc7.cyan(".env.local")}`);
25610
25550
  } else if (flow.ok) {
25611
- neonResourceName = flow.neonResourceName;
25612
25551
  p17.log.warn("Created a Neon database, but DATABASE_URL could not be retrieved from Vercel.");
25613
25552
  const resourceUrl = flow.resourceUrl ?? flow.dashboardUrl;
25614
25553
  if (resourceUrl) {
@@ -25639,12 +25578,10 @@ async function runInitCommand(name, options) {
25639
25578
  env: process.env
25640
25579
  });
25641
25580
  if (flow.ok && flow.databaseUrl) {
25642
- neonResourceName = flow.neonResourceName;
25643
25581
  databaseUrl = flow.databaseUrl;
25644
25582
  persistDatabaseUrl(cwd, databaseUrl);
25645
25583
  p17.log.success(`Saved DATABASE_URL to ${pc7.cyan(".env.local")}`);
25646
25584
  } else if (flow.ok) {
25647
- neonResourceName = flow.neonResourceName;
25648
25585
  openBrowserVercelNeonResource(flow.resourceUrl ?? flow.dashboardUrl);
25649
25586
  databaseUrl = await promptConnectionString();
25650
25587
  persistDatabaseUrl(cwd, databaseUrl);
@@ -26172,13 +26109,12 @@ Run manually: ${pc7.cyan(betterstartExecCommand(pm, "seed"))}`,
26172
26109
  initialValue: linkedVercelProject
26173
26110
  });
26174
26111
  if (!p17.isCancel(deployNow) && deployNow) {
26175
- await runVercelDeployFlow({ cwd, projectName, neonResourceName, env: process.env });
26112
+ await runVercelDeployFlow({ cwd, projectName, env: process.env });
26176
26113
  }
26177
26114
  } else if (linkedVercelProject && process.env.VERCEL_TOKEN) {
26178
26115
  const deployFlow = await runVercelDeployFlow({
26179
26116
  cwd,
26180
26117
  projectName,
26181
- neonResourceName,
26182
26118
  env: process.env
26183
26119
  });
26184
26120
  if (!deployFlow.ok) {