betterstart-cli 0.0.60 → 0.0.62

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
@@ -19785,6 +19785,11 @@ function fitSpinnerMessage(message) {
19785
19785
  }
19786
19786
  var CLACK_LINE_ROWS = 2;
19787
19787
  var LOG_PREFIX_WIDTH = 3;
19788
+ function clackPromptRows(message, value) {
19789
+ const columns = process.stdout.columns ?? 80;
19790
+ const rows = (text7) => Math.max(1, Math.ceil((stripVTControlCharacters(text7).length + LOG_PREFIX_WIDTH) / columns));
19791
+ return 1 + rows(message) + rows(value);
19792
+ }
19788
19793
  function clackLogRows(message) {
19789
19794
  const columns = process.stdout.columns ?? 80;
19790
19795
  const width = stripVTControlCharacters(message).length + LOG_PREFIX_WIDTH;
@@ -19794,6 +19799,14 @@ function eraseRows(rows) {
19794
19799
  if (rows <= 0 || !process.stdout.isTTY || process.env.CI === "true") return;
19795
19800
  process.stdout.write(`\x1B[${rows}A\x1B[${rows}M`);
19796
19801
  }
19802
+ function eraseRowsAbove(rows, rowsBelow) {
19803
+ if (rows <= 0 || rowsBelow < 0 || !process.stdout.isTTY || process.env.CI === "true") {
19804
+ return;
19805
+ }
19806
+ const up = rows + rowsBelow;
19807
+ const restore = rowsBelow > 0 ? `\x1B[${rowsBelow}B` : "";
19808
+ process.stdout.write(`\x1B[${up}A\x1B[${rows}M${restore}`);
19809
+ }
19797
19810
  function eraseClackLine(options = {}) {
19798
19811
  if (!process.stdout.isTTY || process.env.CI === "true") return;
19799
19812
  const below = (options.linesBelow ?? 0) * CLACK_LINE_ROWS;
@@ -26066,7 +26079,7 @@ async function runInitCommand(name, options) {
26066
26079
  );
26067
26080
  } else {
26068
26081
  driverReady = hasDrizzleKitPostgresDriverDependency(cwd);
26069
- s.stop(`${pc6.green("\u2713")} Drizzle Kit Postgres driver dependency installed`);
26082
+ s.stop(`Drizzle Kit Postgres driver dependency installed`);
26070
26083
  }
26071
26084
  }
26072
26085
  if (driverReady) {
@@ -26187,6 +26200,8 @@ async function runInitCommand(name, options) {
26187
26200
  );
26188
26201
  seedEmail = credentials.email;
26189
26202
  seedPassword = credentials.password;
26203
+ const credentialPromptRows = clackPromptRows("Admin email", credentials.email) + clackPromptRows("Admin password", p18.S_PASSWORD_MASK.repeat(credentials.password.length));
26204
+ let rowsBelowCredentialPrompts = 0;
26190
26205
  let seedOverwriteMode = replaceExistingAdmin ? "admin" : void 0;
26191
26206
  s.start(replaceExistingAdmin ? "Replacing admin user" : "Creating admin user");
26192
26207
  let seedResult = await runSeed(
@@ -26198,11 +26213,18 @@ async function runInitCommand(name, options) {
26198
26213
  seedOverwriteMode
26199
26214
  );
26200
26215
  if (seedResult.existingUser) {
26201
- s.stop(`${pc6.yellow("\u25B2")} An account already exists for ${credentials.email}`);
26216
+ const existingAccountMessage = `${pc6.yellow("\u25B2")} An account already exists for ${credentials.email}`;
26217
+ s.stop(existingAccountMessage);
26218
+ rowsBelowCredentialPrompts += clackLogRows(existingAccountMessage);
26219
+ const replaceAccountMessage = "Replace the existing account with this email?";
26202
26220
  const replace = await p18.confirm({
26203
- message: "Replace the existing account with this email?",
26221
+ message: replaceAccountMessage,
26204
26222
  initialValue: false
26205
26223
  });
26224
+ rowsBelowCredentialPrompts += clackPromptRows(
26225
+ replaceAccountMessage,
26226
+ replace === true ? "Yes" : "No"
26227
+ );
26206
26228
  if (!p18.isCancel(replace) && replace) {
26207
26229
  seedOverwriteMode = "email";
26208
26230
  s.start("Replacing admin user");
@@ -26217,13 +26239,14 @@ async function runInitCommand(name, options) {
26217
26239
  }
26218
26240
  }
26219
26241
  if (seedResult.success) {
26220
- s.stop(
26221
- seedOverwriteMode === "admin" ? `${pc6.green("\u2713")} Admin user replaced` : `${pc6.green("\u2713")} Admin user created`
26222
- );
26242
+ const seedSuccessMessage = seedOverwriteMode === "admin" ? `Admin user replaced` : `Admin user ${pc6.green(seedEmail)} successfully created`;
26243
+ s.stop(seedSuccessMessage);
26244
+ rowsBelowCredentialPrompts += clackLogRows(seedSuccessMessage);
26245
+ eraseRowsAbove(credentialPromptRows, rowsBelowCredentialPrompts);
26223
26246
  seedSuccess = true;
26224
26247
  adminAccountReady = true;
26225
26248
  } else if (seedResult.error) {
26226
- s.stop(`${pc6.red("\u2717")} Failed to create admin user`);
26249
+ s.stop(`Failed to create admin user`);
26227
26250
  p18.note(
26228
26251
  `${pc6.red(seedResult.error)}
26229
26252
 
@@ -26246,7 +26269,7 @@ Run manually: ${pc6.cyan(betterstartExecCommand(pm, "seed"))}`,
26246
26269
  cwd,
26247
26270
  stdio: "pipe"
26248
26271
  });
26249
- s.stop("Created initial git commit");
26272
+ s.clear();
26250
26273
  } catch {
26251
26274
  s.stop("Git commit skipped");
26252
26275
  }