betterstart-cli 0.0.41 → 0.0.42

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
@@ -1508,8 +1508,15 @@ function runDrizzlePush(cwd, options = {}) {
1508
1508
  });
1509
1509
  let stdout = "";
1510
1510
  let stderr = "";
1511
+ let outputNotified = false;
1512
+ const notifyOutput = () => {
1513
+ if (outputNotified) return;
1514
+ outputNotified = true;
1515
+ options.onOutput?.();
1516
+ };
1511
1517
  const stderrFilter = createDrizzleNoiseFilter((chunk) => {
1512
1518
  if (options.interactive) {
1519
+ notifyOutput();
1513
1520
  process.stderr.write(chunk);
1514
1521
  return;
1515
1522
  }
@@ -1517,6 +1524,7 @@ function runDrizzlePush(cwd, options = {}) {
1517
1524
  });
1518
1525
  const stdoutFilter = createDrizzleNoiseFilter((chunk) => {
1519
1526
  if (options.interactive) {
1527
+ notifyOutput();
1520
1528
  process.stdout.write(chunk);
1521
1529
  return;
1522
1530
  }
@@ -26072,24 +26080,35 @@ async function runInitCommand(name, options) {
26072
26080
  }
26073
26081
  if (driverReady) {
26074
26082
  const useTerminalForDbPush = shouldUseTerminalForDbPush(options);
26075
- if (!useTerminalForDbPush) {
26076
- s.start("Pushing database schema (drizzle-kit push)");
26077
- }
26078
- const pushResult = await runDrizzlePush(cwd, { interactive: useTerminalForDbPush });
26083
+ let dbSpinnerVisible = true;
26084
+ const clearDbSpinner = () => {
26085
+ if (!dbSpinnerVisible) return;
26086
+ dbSpinnerVisible = false;
26087
+ s.clear();
26088
+ };
26089
+ s.start(
26090
+ useTerminalForDbPush ? "Setting up database" : "Pushing database schema (drizzle-kit push)"
26091
+ );
26092
+ const pushResult = await runDrizzlePush(cwd, {
26093
+ interactive: useTerminalForDbPush,
26094
+ onOutput: clearDbSpinner
26095
+ });
26079
26096
  if (pushResult.success) {
26080
26097
  if (useTerminalForDbPush) {
26081
26098
  const verification = await verifyDatabaseReachable(cwd);
26099
+ clearDbSpinner();
26082
26100
  if (!verification.success) {
26083
26101
  p18.log.warning(verification.error);
26084
26102
  p18.log.error("Database was not reachable. Aborting setup.");
26085
26103
  process.exit(1);
26086
26104
  }
26087
26105
  } else {
26088
- s.clear();
26106
+ clearDbSpinner();
26089
26107
  }
26090
26108
  dbPushed = true;
26091
26109
  } else {
26092
- if (!useTerminalForDbPush) {
26110
+ if (dbSpinnerVisible) {
26111
+ dbSpinnerVisible = false;
26093
26112
  s.stop("Database push failed");
26094
26113
  }
26095
26114
  const pushError = pushResult.error ?? "Unknown error";
@@ -26115,7 +26134,9 @@ async function runInitCommand(name, options) {
26115
26134
  const adminDir = config.paths?.admin ?? "./admin";
26116
26135
  const authBasePath = `${resolveAdminNamespace(namespace).apiPath}/auth`;
26117
26136
  let replaceExistingAdmin = false;
26137
+ s.start("Setting up database");
26118
26138
  const adminCheck = await checkExistingAdmin(cwd, adminDir, authBasePath);
26139
+ s.clear();
26119
26140
  if (adminCheck.error) {
26120
26141
  p18.log.warning(`Could not verify existing admin account ${pc7.dim(`(${adminCheck.error})`)}`);
26121
26142
  if (isDatabaseReachabilityError(adminCheck.error)) {