betterstart-cli 0.0.46 → 0.0.47

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
@@ -3468,7 +3468,7 @@ function schemaManifestContainsMailchimpImports(cwd, config, schemaName) {
3468
3468
  return false;
3469
3469
  }
3470
3470
  const content = fs14.readFileSync(fullPath, "utf-8");
3471
- return markers.some((marker2) => content.includes(marker2));
3471
+ return markers.some((marker) => content.includes(marker));
3472
3472
  });
3473
3473
  }
3474
3474
  function findBlockingIntegrationDependencies(cwd, config, integrationId) {
@@ -21868,80 +21868,20 @@ var GREEN_CHECK = "\x1B[32m\u2713\x1B[39m";
21868
21868
  function restyleStepSubmitSymbols(text7) {
21869
21869
  return text7.split(GREEN_STEP_SUBMIT).join(GREEN_CHECK);
21870
21870
  }
21871
- var ROW_ESCAPES = /\u001B\[(\d*)([ABEF])/g;
21872
- function rowDelta(text7) {
21873
- let delta = text7.split("\n").length - 1;
21874
- for (const match of text7.matchAll(ROW_ESCAPES)) {
21875
- const n = match[1] === "" ? 1 : Number(match[1]);
21876
- delta += match[2] === "A" || match[2] === "F" ? -n : n;
21877
- }
21878
- return delta;
21879
- }
21880
21871
  var installed = false;
21881
- var armed = false;
21882
- var marker = null;
21883
- var generation = 0;
21884
- var rawStdoutWrite;
21885
21872
  function installPromptCheckmarks() {
21886
21873
  if (installed || !process.stdout.isTTY || process.env.CI === "true") return () => {
21887
21874
  };
21888
21875
  installed = true;
21889
- const unpatchedOut = process.stdout.write;
21890
- const unpatchedErr = process.stderr.write;
21891
- const writeOut = unpatchedOut.bind(process.stdout);
21892
- const writeErr = unpatchedErr.bind(process.stderr);
21893
- rawStdoutWrite = writeOut;
21876
+ const unpatched = process.stdout.write;
21877
+ const write = unpatched.bind(process.stdout);
21894
21878
  process.stdout.write = ((chunk, encoding, callback) => {
21895
- if (typeof chunk !== "string") return writeOut(chunk, encoding, callback);
21896
- const idx = armed ? chunk.indexOf(GREEN_STEP_SUBMIT) : -1;
21897
- if (idx === -1) {
21898
- if (marker) marker.rowsAbove += rowDelta(chunk);
21899
- return writeOut(restyleStepSubmitSymbols(chunk), encoding, callback);
21900
- }
21901
- armed = false;
21902
- const rest = chunk.slice(idx + GREEN_STEP_SUBMIT.length);
21903
- marker = { rowsAbove: rowDelta(rest) };
21904
- return writeOut(
21905
- restyleStepSubmitSymbols(chunk.slice(0, idx)) + GREEN_STEP_SUBMIT + restyleStepSubmitSymbols(rest),
21906
- encoding,
21907
- callback
21908
- );
21909
- });
21910
- process.stderr.write = ((chunk, encoding, callback) => {
21911
- if (typeof chunk === "string" && marker) marker.rowsAbove += rowDelta(chunk);
21912
- return writeErr(chunk, encoding, callback);
21879
+ if (typeof chunk !== "string") return write(chunk, encoding, callback);
21880
+ return write(restyleStepSubmitSymbols(chunk), encoding, callback);
21913
21881
  });
21914
21882
  return () => {
21915
- process.stdout.write = unpatchedOut;
21916
- process.stderr.write = unpatchedErr;
21917
- rawStdoutWrite = void 0;
21883
+ process.stdout.write = unpatched;
21918
21884
  installed = false;
21919
- armed = false;
21920
- marker = null;
21921
- };
21922
- }
21923
- function deferNextPromptCheck() {
21924
- if (!installed) return { confirm() {
21925
- }, skip() {
21926
- } };
21927
- generation += 1;
21928
- const token = generation;
21929
- armed = true;
21930
- marker = null;
21931
- return {
21932
- confirm() {
21933
- if (token !== generation) return;
21934
- armed = false;
21935
- const rows = marker?.rowsAbove;
21936
- marker = null;
21937
- if (rows === void 0 || rows <= 0 || rows >= (process.stdout.rows ?? 24)) return;
21938
- rawStdoutWrite?.(`\x1B[${rows}A\r${GREEN_CHECK}\x1B[${rows}B\r`);
21939
- },
21940
- skip() {
21941
- if (token !== generation) return;
21942
- armed = false;
21943
- marker = null;
21944
- }
21945
21885
  };
21946
21886
  }
21947
21887
 
@@ -22198,7 +22138,6 @@ async function promptPresets(cwd, options = {}) {
22198
22138
  overwriteKeys.add(key);
22199
22139
  }
22200
22140
  };
22201
- const storageStep = deferNextPromptCheck();
22202
22141
  const storage = await p12.select({
22203
22142
  message: "Choose a file storage",
22204
22143
  options: [
@@ -22224,7 +22163,6 @@ async function promptPresets(cwd, options = {}) {
22224
22163
  }
22225
22164
  if (storage === "r2") {
22226
22165
  mergeIntegrationConfig(await collectIntegrationConfig(cwd, ["r2"]));
22227
- storageStep.confirm();
22228
22166
  } else if (storage === "vercel-blob") {
22229
22167
  const existingToken = readEnvVar(cwd, "BLOB_READ_WRITE_TOKEN")?.trim();
22230
22168
  const flow = !existingToken && options.provisionVercelBlob ? await options.provisionVercelBlob() : void 0;
@@ -22235,8 +22173,6 @@ async function promptPresets(cwd, options = {}) {
22235
22173
  vars: [{ key: "BLOB_READ_WRITE_TOKEN", value: flow.token }]
22236
22174
  });
22237
22175
  overwriteKeys.add("BLOB_READ_WRITE_TOKEN");
22238
- if (flow.usedTerminalFallback) storageStep.skip();
22239
- else storageStep.confirm();
22240
22176
  } else if (flow) {
22241
22177
  p12.log.warn(
22242
22178
  "Continuing without a Blob token \u2014 add BLOB_READ_WRITE_TOKEN to .env.local from the store on vercel.com/dashboard/stores."
@@ -22245,7 +22181,6 @@ async function promptPresets(cwd, options = {}) {
22245
22181
  header: "Storage (Vercel Blob)",
22246
22182
  vars: [{ key: "BLOB_READ_WRITE_TOKEN", value: "" }]
22247
22183
  });
22248
- storageStep.skip();
22249
22184
  } else {
22250
22185
  if (existingToken) {
22251
22186
  p12.log.info(
@@ -22256,10 +22191,7 @@ async function promptPresets(cwd, options = {}) {
22256
22191
  );
22257
22192
  }
22258
22193
  mergeIntegrationConfig(await collectIntegrationConfig(cwd, ["vercel-blob"]));
22259
- storageStep.confirm();
22260
22194
  }
22261
- } else {
22262
- storageStep.confirm();
22263
22195
  }
22264
22196
  const selectedPresets = await p12.multiselect({
22265
22197
  message: "Select presets",
@@ -24592,11 +24524,7 @@ async function provisionBlobStoreInteractive(runner, cwd, options) {
24592
24524
  return { ...storeName && { storeName }, failure: "env-pull-empty" };
24593
24525
  }
24594
24526
  activeSpinner.clear();
24595
- return {
24596
- token,
24597
- ...storeName && { storeName },
24598
- ...terminalFallbackRan && { usedTerminalFallback: true }
24599
- };
24527
+ return { token, ...storeName && { storeName } };
24600
24528
  };
24601
24529
  for (let attempt = 1; attempt <= MAX_STORE_NAME_ATTEMPTS; attempt++) {
24602
24530
  const storeName = candidateStoreName(options.name, attempt);
@@ -24980,7 +24908,7 @@ async function runVercelNeonFlow(options) {
24980
24908
  p17.log.warn(authFailureMessage(auth.reason));
24981
24909
  return { ok: false };
24982
24910
  }
24983
- const linkLinePrinted = await ensureLinkedProject(runner, options.cwd, options.projectName, env);
24911
+ await ensureLinkedProject(runner, options.cwd, options.projectName, env);
24984
24912
  const neon = await provisionNeonForMode(runner, options);
24985
24913
  if (neon.failure) {
24986
24914
  p17.log.warn(neonFailureMessage(neon.failure));
@@ -24988,7 +24916,7 @@ async function runVercelNeonFlow(options) {
24988
24916
  return { ok: false };
24989
24917
  }
24990
24918
  const databaseUrl = await pullNeonDatabaseUrl(runner, options.cwd, env);
24991
- const dismissSignedInNote = databaseUrl && auth.dismissNote && !neon.usedTerminalFallback ? () => auth.dismissNote?.({ linesBelow: linkLinePrinted ? 1 : 0 }) : void 0;
24919
+ const dismissSignedInNote = databaseUrl && auth.dismissNote && !neon.usedTerminalFallback ? () => auth.dismissNote?.({ linesBelow: 0 }) : void 0;
24992
24920
  return {
24993
24921
  ok: true,
24994
24922
  databaseUrl,
@@ -25028,8 +24956,7 @@ async function runVercelBlobFlow(options) {
25028
24956
  return {
25029
24957
  ok: true,
25030
24958
  token: blob.token,
25031
- blobStoreName: blob.storeName,
25032
- usedTerminalFallback: blob.usedTerminalFallback
24959
+ blobStoreName: blob.storeName
25033
24960
  };
25034
24961
  } catch (error) {
25035
24962
  p17.log.warn(
@@ -25065,9 +24992,7 @@ async function runVercelDeployFlow(options) {
25065
24992
  } else {
25066
24993
  envSpinner.clear();
25067
24994
  }
25068
- let printedWarnings = false;
25069
24995
  for (const key of sync.failed) {
25070
- printedWarnings = true;
25071
24996
  p17.log.warn(
25072
24997
  `Could not set ${pc6.cyan(key)} on Vercel \u2014 add it in the project's environment settings.`
25073
24998
  );
@@ -25077,7 +25002,6 @@ async function runVercelDeployFlow(options) {
25077
25002
  }
25078
25003
  const packageGuard = guardProjectForDeploy(options.cwd);
25079
25004
  for (const dep of packageGuard.localSpecDeps) {
25080
- printedWarnings = true;
25081
25005
  p17.log.warn(
25082
25006
  `Dependency ${pc6.cyan(dep)} uses a local spec that cannot install on Vercel \u2014 the remote build may fail.`
25083
25007
  );
@@ -25099,7 +25023,7 @@ async function runVercelDeployFlow(options) {
25099
25023
  const linkedName = readLinkedProjectName(options.cwd);
25100
25024
  const url = linkedName ? `https://${linkedName}.vercel.app` : deploy.url;
25101
25025
  deploySpinner.stop(url ? `Deployed ${pc6.cyan(url)}` : "Deployed to Vercel");
25102
- return { ok: true, url, syncedEnvKeys: sync.synced, cleanScreen: !printedWarnings };
25026
+ return { ok: true, url, syncedEnvKeys: sync.synced };
25103
25027
  } catch (error) {
25104
25028
  p17.log.warn(`Vercel deploy failed: ${error instanceof Error ? error.message : String(error)}`);
25105
25029
  printManualDeployHint();
@@ -25112,14 +25036,11 @@ function printManualDeployHint() {
25112
25036
  p17.log.info(`You can deploy manually: ${pc6.cyan("vercel deploy --prod")}`);
25113
25037
  }
25114
25038
  async function ensureLinkedProject(runner, cwd, projectName, env) {
25115
- if (readLinkedProjectId(cwd)) return false;
25039
+ if (readLinkedProjectId(cwd)) return;
25116
25040
  const projectSpinner = spinner2();
25117
25041
  projectSpinner.start(`Creating a Vercel project ${pc6.cyan(projectName)}`);
25118
- const project2 = await createVercelProject(runner, cwd, projectName, env);
25119
- projectSpinner.stop(
25120
- project2.linked ? `Linked Vercel project ${pc6.cyan(project2.name)}` : `Using Vercel project ${pc6.cyan(project2.name)}`
25121
- );
25122
- return true;
25042
+ await createVercelProject(runner, cwd, projectName, env);
25043
+ projectSpinner.clear();
25123
25044
  }
25124
25045
  async function pullNeonDatabaseUrl(runner, cwd, env) {
25125
25046
  const neonSpinner = spinner2();
@@ -25790,7 +25711,6 @@ async function runInitCommand(name, options) {
25790
25711
  p18.log.info(`Using the existing DATABASE_URL from .env.local ${pc7.dim(`(${masked})`)}`);
25791
25712
  databaseUrl = existingDbUrl;
25792
25713
  } else {
25793
- const databaseStep = deferNextPromptCheck();
25794
25714
  const servicesResult = await promptServices({ allowVercel: options.vercel !== false });
25795
25715
  if (servicesResult.provider === "vercel-cli") {
25796
25716
  const flow = await runVercelNeonFlow({
@@ -25804,22 +25724,17 @@ async function runInitCommand(name, options) {
25804
25724
  databaseUrl = flow.databaseUrl;
25805
25725
  persistDatabaseUrl(cwd, databaseUrl);
25806
25726
  dismissVercelSignedInNote = flow.dismissSignedInNote;
25807
- if (flow.dismissSignedInNote) databaseStep.confirm();
25808
- else databaseStep.skip();
25809
25727
  } else if (flow.ok) {
25810
- databaseStep.skip();
25811
25728
  openBrowserVercelNeonResource(flow.dashboardUrl ?? flow.resourceUrl);
25812
25729
  databaseUrl = await promptConnectionString();
25813
25730
  persistDatabaseUrl(cwd, databaseUrl);
25814
25731
  } else {
25815
- databaseStep.skip();
25816
25732
  p18.log.info("Falling back to a manual database connection string.");
25817
25733
  openBrowserVercelNeon();
25818
25734
  databaseUrl = await promptConnectionString();
25819
25735
  }
25820
25736
  } else {
25821
25737
  databaseUrl = servicesResult.url;
25822
- databaseStep.confirm();
25823
25738
  }
25824
25739
  }
25825
25740
  const selectedPresets = (() => {
@@ -26265,17 +26180,12 @@ Run manually: ${pc7.cyan(betterstartExecCommand(pm, "seed"))}`,
26265
26180
  if (options.vercel !== false && !options.skipDeploy) {
26266
26181
  const linkedVercelProject = Boolean(readLinkedProjectId(cwd));
26267
26182
  if (!options.yes) {
26268
- const deployStep = deferNextPromptCheck();
26269
26183
  const deployNow = await p18.confirm({
26270
26184
  message: "Deploy to Vercel now?",
26271
26185
  initialValue: linkedVercelProject
26272
26186
  });
26273
26187
  if (!p18.isCancel(deployNow) && deployNow) {
26274
- const deployFlow = await runVercelDeployFlow({ cwd, projectName, env: process.env });
26275
- if (deployFlow.ok && deployFlow.cleanScreen) deployStep.confirm();
26276
- else deployStep.skip();
26277
- } else {
26278
- deployStep.confirm();
26188
+ await runVercelDeployFlow({ cwd, projectName, env: process.env });
26279
26189
  }
26280
26190
  } else if (linkedVercelProject && process.env.VERCEL_TOKEN) {
26281
26191
  const deployFlow = await runVercelDeployFlow({