betterstart-cli 0.0.83 → 0.0.84

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
@@ -25696,12 +25696,25 @@ function runVercel(runner, args, options) {
25696
25696
  let stdout = "";
25697
25697
  let stderr = "";
25698
25698
  let timedOut = false;
25699
+ let closed = false;
25700
+ let effectiveTimeoutMs = timeoutMs;
25701
+ let timeout;
25702
+ const armTimeout = (ms) => {
25703
+ if (closed) return;
25704
+ clearTimeout(timeout);
25705
+ effectiveTimeoutMs = ms;
25706
+ timeout = setTimeout(() => {
25707
+ timedOut = true;
25708
+ child.kill("SIGTERM");
25709
+ }, ms);
25710
+ };
25711
+ const runControl = { extendTimeout: armTimeout };
25699
25712
  const onOutputLine = options.onOutputLine;
25700
25713
  const createOutputObserver = () => {
25701
25714
  if (!onOutputLine) return void 0;
25702
25715
  return createFilteredLineForwarder(
25703
25716
  (line) => line.length > 0,
25704
- (text7) => onOutputLine(stripVTControlCharacters3(text7).trim())
25717
+ (text7) => onOutputLine(stripVTControlCharacters3(text7).trim(), runControl)
25705
25718
  );
25706
25719
  };
25707
25720
  const stdoutObserver = createOutputObserver();
@@ -25748,11 +25761,9 @@ function runVercel(runner, args, options) {
25748
25761
  errForwarder.flush();
25749
25762
  });
25750
25763
  }
25751
- const timeout = setTimeout(() => {
25752
- timedOut = true;
25753
- child.kill("SIGTERM");
25754
- }, timeoutMs);
25764
+ armTimeout(timeoutMs);
25755
25765
  child.on("close", (code, signal) => {
25766
+ closed = true;
25756
25767
  clearTimeout(timeout);
25757
25768
  stdoutObserver?.flush();
25758
25769
  stderrObserver?.flush();
@@ -25764,7 +25775,7 @@ function runVercel(runner, args, options) {
25764
25775
  stdout,
25765
25776
  stderr,
25766
25777
  timedOut: true,
25767
- errorMessage: `Vercel command timed out after ${Math.floor(timeoutMs / 1e3)}s`
25778
+ errorMessage: `Vercel command timed out after ${Math.floor(effectiveTimeoutMs / 1e3)}s`
25768
25779
  });
25769
25780
  return;
25770
25781
  }
@@ -25779,6 +25790,7 @@ function runVercel(runner, args, options) {
25779
25790
  });
25780
25791
  });
25781
25792
  child.on("error", (err) => {
25793
+ closed = true;
25782
25794
  clearTimeout(timeout);
25783
25795
  stdoutObserver?.flush();
25784
25796
  stderrObserver?.flush();
@@ -26348,14 +26360,36 @@ import * as p20 from "@clack/prompts";
26348
26360
  import pc7 from "picocolors";
26349
26361
  var PROVISION_TIMEOUT_MS2 = 18e4;
26350
26362
  var INTERACTIVE_PROVISION_TIMEOUT_MS2 = 6e5;
26363
+ var ACCEPT_TERMS_URL_PATTERN = /https:\/\/vercel\.com\/\S+\/integrations\/accept-terms\/\S+/i;
26364
+ var TERMS_ACCEPTED_PATTERN = /terms accepted/i;
26365
+ function findAcceptTermsUrl(line) {
26366
+ return ACCEPT_TERMS_URL_PATTERN.exec(line)?.[0];
26367
+ }
26351
26368
  async function provisionNeonInteractive(runner, cwd, options) {
26352
26369
  const quietSpinner = spinner2();
26353
26370
  quietSpinner.start("Creating your Neon database");
26371
+ let waitingOnTerms = false;
26354
26372
  const quiet = await runVercel(runner, neonAddArgs(options), {
26355
26373
  cwd,
26356
26374
  mode: "capture",
26357
26375
  timeoutMs: PROVISION_TIMEOUT_MS2,
26358
- env: options.env
26376
+ env: options.env,
26377
+ onOutputLine: (line, run) => {
26378
+ if (!waitingOnTerms) {
26379
+ const termsUrl = findAcceptTermsUrl(line);
26380
+ if (!termsUrl) return;
26381
+ waitingOnTerms = true;
26382
+ run.extendTimeout(INTERACTIVE_PROVISION_TIMEOUT_MS2);
26383
+ quietSpinner.clear();
26384
+ p20.log.info(`Please accept the Neon terms in your browser
26385
+ ${pc7.dim(termsUrl)}`);
26386
+ quietSpinner.start("Waiting for the terms to be accepted");
26387
+ return;
26388
+ }
26389
+ if (TERMS_ACCEPTED_PATTERN.test(line)) {
26390
+ quietSpinner.message("Creating your Neon database");
26391
+ }
26392
+ }
26359
26393
  });
26360
26394
  if (quiet.success) {
26361
26395
  quietSpinner.clear();