create-better-schemic 0.1.0-beta.5 → 0.1.0-beta.6

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.
Files changed (2) hide show
  1. package/lib/index.js +196 -219
  2. package/package.json +3 -3
package/lib/index.js CHANGED
@@ -1,96 +1,4 @@
1
1
  #!/usr/bin/env node
2
- var __create = Object.create;
3
- var __getProtoOf = Object.getPrototypeOf;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- function __accessProp(key) {
8
- return this[key];
9
- }
10
- var __toESMCache_node;
11
- var __toESMCache_esm;
12
- var __toESM = (mod, isNodeMode, target) => {
13
- var canCache = mod != null && typeof mod === "object";
14
- if (canCache) {
15
- var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
- var cached = cache.get(mod);
17
- if (cached)
18
- return cached;
19
- }
20
- target = mod != null ? __create(__getProtoOf(mod)) : {};
21
- const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
- if (mod && typeof mod === "object" || typeof mod === "function") {
23
- for (let key of __getOwnPropNames(mod))
24
- if (!__hasOwnProp.call(to, key))
25
- __defProp(to, key, {
26
- get: __accessProp.bind(mod, key),
27
- enumerable: true
28
- });
29
- }
30
- if (canCache)
31
- cache.set(mod, to);
32
- return to;
33
- };
34
- var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
35
-
36
- // ../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
37
- var require_src = __commonJS(function(exports, module) {
38
- var ESC = "\x1B";
39
- var CSI = `${ESC}[`;
40
- var beep = "\x07";
41
- var cursor = {
42
- to(x, y) {
43
- if (!y)
44
- return `${CSI}${x + 1}G`;
45
- return `${CSI}${y + 1};${x + 1}H`;
46
- },
47
- move(x, y) {
48
- let ret = "";
49
- if (x < 0)
50
- ret += `${CSI}${-x}D`;
51
- else if (x > 0)
52
- ret += `${CSI}${x}C`;
53
- if (y < 0)
54
- ret += `${CSI}${-y}A`;
55
- else if (y > 0)
56
- ret += `${CSI}${y}B`;
57
- return ret;
58
- },
59
- up: (count = 1) => `${CSI}${count}A`,
60
- down: (count = 1) => `${CSI}${count}B`,
61
- forward: (count = 1) => `${CSI}${count}C`,
62
- backward: (count = 1) => `${CSI}${count}D`,
63
- nextLine: (count = 1) => `${CSI}E`.repeat(count),
64
- prevLine: (count = 1) => `${CSI}F`.repeat(count),
65
- left: `${CSI}G`,
66
- hide: `${CSI}?25l`,
67
- show: `${CSI}?25h`,
68
- save: `${ESC}7`,
69
- restore: `${ESC}8`
70
- };
71
- var scroll = {
72
- up: (count = 1) => `${CSI}S`.repeat(count),
73
- down: (count = 1) => `${CSI}T`.repeat(count)
74
- };
75
- var erase = {
76
- screen: `${CSI}2J`,
77
- up: (count = 1) => `${CSI}1J`.repeat(count),
78
- down: (count = 1) => `${CSI}J`.repeat(count),
79
- line: `${CSI}2K`,
80
- lineEnd: `${CSI}K`,
81
- lineStart: `${CSI}1K`,
82
- lines(count) {
83
- let clear = "";
84
- for (let i = 0;i < count; i++)
85
- clear += this.line + (i < count - 1 ? cursor.up() : "");
86
- if (count)
87
- clear += cursor.left;
88
- return clear;
89
- }
90
- };
91
- module.exports = { cursor, scroll, erase, beep };
92
- });
93
-
94
2
  // src/index.ts
95
3
  import { spawnSync } from "node:child_process";
96
4
  import {
@@ -103,11 +11,11 @@ import {
103
11
  import { createRequire } from "node:module";
104
12
  import { basename, dirname, join, resolve } from "node:path";
105
13
 
106
- // ../../node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
14
+ // ../../node_modules/.bun/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs
107
15
  import { styleText } from "node:util";
108
16
  import { stdout, stdin } from "node:process";
109
- import * as l from "node:readline";
110
- import l__default from "node:readline";
17
+ import * as f$1 from "node:readline";
18
+ import f__default from "node:readline";
111
19
 
112
20
  // ../../node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
113
21
  var getCodePointsLength = (() => {
@@ -450,14 +358,66 @@ function wrapAnsi(string, columns, options) {
450
358
  `);
451
359
  }
452
360
 
453
- // ../../node_modules/.bun/@clack+core@1.5.1/node_modules/@clack/core/dist/index.mjs
454
- var import_sisteransi = __toESM(require_src(), 1);
361
+ // ../../node_modules/.bun/sisteransi@2.0.0/node_modules/sisteransi/dist/index.js
362
+ var ESC2 = "\x1B";
363
+ var CSI2 = `${ESC2}[`;
364
+ var cursor = {
365
+ to(x, y) {
366
+ if (!y)
367
+ return `${CSI2}${x + 1}G`;
368
+ return `${CSI2}${y + 1};${x + 1}H`;
369
+ },
370
+ move(x, y) {
371
+ let ret = "";
372
+ if (x < 0)
373
+ ret += `${CSI2}${-x}D`;
374
+ else if (x > 0)
375
+ ret += `${CSI2}${x}C`;
376
+ if (y < 0)
377
+ ret += `${CSI2}${-y}A`;
378
+ else if (y > 0)
379
+ ret += `${CSI2}${y}B`;
380
+ return ret;
381
+ },
382
+ up: (count = 1) => `${CSI2}${count}A`,
383
+ down: (count = 1) => `${CSI2}${count}B`,
384
+ forward: (count = 1) => `${CSI2}${count}C`,
385
+ backward: (count = 1) => `${CSI2}${count}D`,
386
+ nextLine: (count = 1) => `${CSI2}E`.repeat(count),
387
+ prevLine: (count = 1) => `${CSI2}F`.repeat(count),
388
+ left: `${CSI2}G`,
389
+ hide: `${CSI2}?25l`,
390
+ show: `${CSI2}?25h`,
391
+ save: `${ESC2}7`,
392
+ restore: `${ESC2}8`
393
+ };
394
+ var erase = {
395
+ screen: `${CSI2}2J`,
396
+ up: (count = 1) => `${CSI2}1J`.repeat(count),
397
+ down: (count = 1) => `${CSI2}J`.repeat(count),
398
+ line: `${CSI2}2K`,
399
+ lineEnd: `${CSI2}K`,
400
+ lineStart: `${CSI2}1K`,
401
+ lines(count) {
402
+ let clear = "";
403
+ for (let i = 0;i < count; i++)
404
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
405
+ if (count)
406
+ clear += cursor.left;
407
+ return clear;
408
+ }
409
+ };
410
+ var clear = {
411
+ screen: `${ESC2}c`
412
+ };
413
+
414
+ // ../../node_modules/.bun/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs
455
415
  import { ReadStream } from "node:tty";
456
- function findCursor(s, o, l) {
416
+ function findCursor(o, s, l) {
457
417
  if (!l.some((r) => !r.disabled))
458
- return s;
459
- const t = s + o, n = Math.max(l.length - 1, 0), e = t < 0 ? n : t > n ? 0 : t;
460
- return l[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l) : e;
418
+ return o;
419
+ const t = o + s, n = Math.max(l.length - 1, 0), e = t < 0 ? n : t > n ? 0 : t;
420
+ return l[e]?.disabled ? findCursor(e, s < 0 ? -1 : 1, l) : e;
461
421
  }
462
422
  var a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
463
423
  var t = [
@@ -547,43 +507,43 @@ function block({
547
507
  overwrite: o = true,
548
508
  hideCursor: n = true
549
509
  } = {}) {
550
- const s = l.createInterface({
510
+ const s = f$1.createInterface({
551
511
  input: e,
552
512
  output: r,
553
513
  prompt: "",
554
514
  tabSize: 1
555
515
  });
556
- l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
557
- const t = (f, { name: a, sequence: w }) => {
558
- const c = String(f);
559
- if (isActionKey([c, a, w], "cancel")) {
560
- n && r.write(import_sisteransi.cursor.show), process.exit(0);
516
+ f$1.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
517
+ const t = (l, { name: i, sequence: p }) => {
518
+ const w = String(l);
519
+ if (isActionKey([w, i, p], "cancel")) {
520
+ n && r.write(cursor.show), process.exit(0);
561
521
  return;
562
522
  }
563
523
  if (!o)
564
524
  return;
565
- const i = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
566
- l.moveCursor(r, i, m, () => {
567
- l.clearLine(r, 1, () => {
525
+ const c = i === "return" ? 0 : -1, a = i === "return" ? -1 : 0;
526
+ f$1.moveCursor(r, c, a, () => {
527
+ f$1.clearLine(r, 1, () => {
568
528
  e.once("keypress", t);
569
529
  });
570
530
  });
571
531
  };
572
- return n && r.write(import_sisteransi.cursor.hide), e.once("keypress", t), () => {
573
- e.off("keypress", t), n && r.write(import_sisteransi.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
532
+ return n && r.write(cursor.hide), e.once("keypress", t), () => {
533
+ e.off("keypress", t), n && r.write(cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
574
534
  };
575
535
  }
576
536
  var getColumns = (e) => ("columns" in e) && typeof e.columns == "number" ? e.columns : 80;
577
537
  var getRows = (e) => ("rows" in e) && typeof e.rows == "number" ? e.rows : 20;
578
538
  function wrapTextWithPrefix(e, r, o, n = o, s = o, t) {
579
- const f = getColumns(e ?? stdout);
580
- return wrapAnsi(r, f - o.length, {
539
+ const l = getColumns(e ?? stdout), i = dist_default2(o);
540
+ return wrapAnsi(r, l - i, {
581
541
  hard: true,
582
542
  trim: false
583
543
  }).split(`
584
- `).map((c, i, m) => {
585
- const d = t ? t(c, i) : c;
586
- return i === 0 ? `${n}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;
544
+ `).map((c, a, g) => {
545
+ const m = t ? t(c, a) : c;
546
+ return a === 0 ? `${n}${m}` : a === g.length - 1 ? `${s}${m}` : `${o}${m}`;
587
547
  }).join(`
588
548
  `);
589
549
  }
@@ -594,8 +554,7 @@ function runValidation(e, a) {
594
554
  }
595
555
  return e(a);
596
556
  }
597
-
598
- class y {
557
+ var C$1 = class C {
599
558
  input;
600
559
  output;
601
560
  _abortSignal;
@@ -646,16 +605,16 @@ class y {
646
605
  this.state = "cancel", this.close();
647
606
  }, { once: true });
648
607
  }
649
- this.rl = l__default.createInterface({
608
+ this.rl = f__default.createInterface({
650
609
  input: this.input,
651
610
  tabSize: 2,
652
611
  prompt: "",
653
612
  escapeCodeTimeout: 50,
654
613
  terminal: true
655
614
  }), this.rl.prompt(), this.opts.initialUserInput !== undefined && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
656
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(this.value);
615
+ this.output.write(cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(this.value);
657
616
  }), this.once("cancel", () => {
658
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(CANCEL_SYMBOL);
617
+ this.output.write(cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(CANCEL_SYMBOL);
659
618
  });
660
619
  });
661
620
  }
@@ -692,18 +651,18 @@ class y {
692
651
  `), setRawMode(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
693
652
  }
694
653
  restoreCursor() {
695
- const t = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
654
+ const t = wrapAnsi(this._prevFrame, getColumns(this.output), { hard: true, trim: false }).split(`
696
655
  `).length - 1;
697
- this.output.write(import_sisteransi.cursor.move(-999, t * -1));
656
+ this.output.write(cursor.move(-999, t * -1));
698
657
  }
699
658
  render() {
700
- const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
659
+ const t = wrapAnsi(this._render(this) ?? "", getColumns(this.output), {
701
660
  hard: true,
702
661
  trim: false
703
662
  });
704
663
  if (t !== this._prevFrame) {
705
664
  if (this.state === "initial")
706
- this.output.write(import_sisteransi.cursor.hide);
665
+ this.output.write(cursor.hide);
707
666
  else {
708
667
  const e = diffLines(this._prevFrame, t), i = getRows(this.output);
709
668
  if (this.restoreCursor(), e) {
@@ -714,33 +673,33 @@ class y {
714
673
  return;
715
674
  }
716
675
  if (e.lines.length === 1) {
717
- this.output.write(import_sisteransi.cursor.move(0, n - r)), this.output.write(import_sisteransi.erase.lines(1));
676
+ this.output.write(cursor.move(0, n - r)), this.output.write(erase.lines(1));
718
677
  const o = t.split(`
719
678
  `);
720
- this.output.write(o[n]), this._prevFrame = t, this.output.write(import_sisteransi.cursor.move(0, o.length - n - 1));
679
+ this.output.write(o[n]), this._prevFrame = t, this.output.write(cursor.move(0, o.length - n - 1));
721
680
  return;
722
681
  } else if (e.lines.length > 1) {
723
682
  if (s < r)
724
683
  n = s;
725
684
  else {
726
685
  const h = n - r;
727
- h > 0 && this.output.write(import_sisteransi.cursor.move(0, h));
686
+ h > 0 && this.output.write(cursor.move(0, h));
728
687
  }
729
- this.output.write(import_sisteransi.erase.down());
730
- const f = t.split(`
688
+ this.output.write(erase.down());
689
+ const m = t.split(`
731
690
  `).slice(n);
732
- this.output.write(f.join(`
691
+ this.output.write(m.join(`
733
692
  `)), this._prevFrame = t;
734
693
  return;
735
694
  }
736
695
  }
737
- this.output.write(import_sisteransi.erase.down());
696
+ this.output.write(erase.down());
738
697
  }
739
698
  this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
740
699
  }
741
700
  }
742
- }
743
- class r extends y {
701
+ };
702
+ class r extends C$1 {
744
703
  get cursor() {
745
704
  return this.value ? 0 : 1;
746
705
  }
@@ -751,13 +710,13 @@ class r extends y {
751
710
  super(t, false), this.value = !!t.initialValue, this.on("userInput", () => {
752
711
  this.value = this._value;
753
712
  }), this.on("confirm", (i) => {
754
- this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = i, this.state = "submit", this.close();
713
+ this.output.write(cursor.move(0, -1)), this.value = i, this.state = "submit", this.close();
755
714
  }), this.on("cursor", () => {
756
715
  this.value = !this.value;
757
716
  });
758
717
  }
759
718
  }
760
- var n$1 = class n extends y {
719
+ var n$1 = class n extends C$1 {
761
720
  options;
762
721
  cursor = 0;
763
722
  get _selectedValue() {
@@ -785,7 +744,7 @@ var n$1 = class n extends y {
785
744
  });
786
745
  }
787
746
  };
788
- class n extends y {
747
+ class n extends C$1 {
789
748
  get userInputWithCursor() {
790
749
  if (this.state === "submit")
791
750
  return this.userInput;
@@ -810,10 +769,9 @@ class n extends y {
810
769
  }
811
770
  }
812
771
 
813
- // ../../node_modules/.bun/@clack+prompts@1.8.1/node_modules/@clack/prompts/dist/index.mjs
772
+ // ../../node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs
814
773
  import { styleText as styleText2, stripVTControlCharacters } from "node:util";
815
774
  import process$1 from "node:process";
816
- var import_sisteransi2 = __toESM(require_src(), 1);
817
775
  function isUnicodeSupported() {
818
776
  if (process$1.platform !== "win32") {
819
777
  return process$1.env.TERM !== "linux";
@@ -822,7 +780,7 @@ function isUnicodeSupported() {
822
780
  }
823
781
  var unicode = isUnicodeSupported();
824
782
  var isCI = () => process.env.CI === "true";
825
- var unicodeOr = (o, e) => unicode ? o : e;
783
+ var unicodeOr = (e, o) => unicode ? e : o;
826
784
  var S_STEP_ACTIVE = unicodeOr("◆", "*");
827
785
  var S_STEP_CANCEL = unicodeOr("■", "x");
828
786
  var S_STEP_ERROR = unicodeOr("▲", "x");
@@ -848,8 +806,8 @@ var S_INFO = unicodeOr("●", "•");
848
806
  var S_SUCCESS = unicodeOr("◆", "*");
849
807
  var S_WARN = unicodeOr("▲", "!");
850
808
  var S_ERROR = unicodeOr("■", "x");
851
- var symbol = (o) => {
852
- switch (o) {
809
+ var symbol = (e) => {
810
+ switch (e) {
853
811
  case "initial":
854
812
  case "active":
855
813
  return styleText2("cyan", S_STEP_ACTIVE);
@@ -863,8 +821,8 @@ var symbol = (o) => {
863
821
  return styleText2("dim", S_STEP_ACTIVE);
864
822
  }
865
823
  };
866
- var symbolBar = (o) => {
867
- switch (o) {
824
+ var symbolBar = (e) => {
825
+ switch (e) {
868
826
  case "initial":
869
827
  case "active":
870
828
  return styleText2("cyan", S_BAR);
@@ -876,11 +834,12 @@ var symbolBar = (o) => {
876
834
  return styleText2("green", S_BAR);
877
835
  }
878
836
  };
879
- function formatInstructionFooter(o, e) {
880
- const r = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o.join(" • ")}`];
881
- return e && r.push(styleText2("cyan", S_BAR_END)), r;
837
+ function formatInstructionFooter(e, o, r) {
838
+ const s = r ? `${styleText2("cyan", S_BAR)} ` : "", n = wrapTextWithPrefix(e, o.join(" • "), s).split(`
839
+ `);
840
+ return r && n.push(styleText2("cyan", S_BAR_END)), n;
882
841
  }
883
- var I = (l, e, w, p, b, C = false) => {
842
+ var E$1 = (l, e, w, p, b, C = false) => {
884
843
  let r = e, O = 0;
885
844
  if (C)
886
845
  for (let i = p - 1;i >= w; i--) {
@@ -909,12 +868,12 @@ var limitOptions = ({
909
868
  let f = 0;
910
869
  l >= a - 3 && (f = Math.max(Math.min(l - a + 3, e.length - a), 0));
911
870
  let d = a < e.length && f > 0, c = a < e.length && f + a < e.length;
912
- const W = Math.min(f + a, e.length), s = [];
871
+ const I = Math.min(f + a, e.length), s = [];
913
872
  let g = 0;
914
873
  d && g++, c && g++;
915
- const T = f + (d ? 1 : 0), y = W - (c ? 1 : 0);
916
- for (let t = T;t < y; t++) {
917
- const n = e[t], o = n ? w(n, t === l) : "", h = wrapAnsi(o, i, {
874
+ const T = f + (d ? 1 : 0), W = I - (c ? 1 : 0);
875
+ for (let t = T;t < W; t++) {
876
+ const n = e[t], o = n !== undefined ? w(n, t === l) : "", h = wrapAnsi(o, i, {
918
877
  hard: true,
919
878
  trim: false
920
879
  }).split(`
@@ -925,8 +884,8 @@ var limitOptions = ({
925
884
  let t = 0, n = 0, o = g;
926
885
  const h = l - T;
927
886
  let u = v;
928
- const L = () => I(s, o, 0, h, u), E = () => I(s, o, h + 1, s.length, u, true);
929
- d ? ({ lineCount: o, removals: t } = L(), o > u && (c || (u -= 1), { lineCount: o, removals: n } = E())) : (c || (u -= 1), { lineCount: o, removals: n } = E(), o > u && (u -= 1, { lineCount: o, removals: t } = L())), t > 0 && (d = true, s.splice(0, t)), n > 0 && (c = true, s.splice(s.length - n, n));
887
+ const L = () => E$1(s, o, 0, h, u), y = () => E$1(s, o, h + 1, s.length, u, true);
888
+ d ? ({ lineCount: o, removals: t } = L(), o > u && (c || (u -= 1), { lineCount: o, removals: n } = y())) : (c || (u -= 1), { lineCount: o, removals: n } = y(), o > u && (u -= 1, { lineCount: o, removals: t } = L())), t > 0 && (d = true, s.splice(0, t)), n > 0 && (c = true, s.splice(s.length - n, n));
930
889
  }
931
890
  const x = [];
932
891
  d && x.push(M);
@@ -1035,7 +994,7 @@ ${styleText2("gray", S_BAR_END)} ` : "";
1035
994
 
1036
995
  `);
1037
996
  };
1038
- var W$1 = (o) => o;
997
+ var W = (o) => o;
1039
998
  var C = (o, e, s) => {
1040
999
  const a = {
1041
1000
  hard: true,
@@ -1045,7 +1004,7 @@ var C = (o, e, s) => {
1045
1004
  return wrapAnsi(o, g, a);
1046
1005
  };
1047
1006
  var note = (o = "", e = "", s) => {
1048
- const a = s?.output ?? process$1.stdout, i = s?.withGuide ?? settings.withGuide, c = s?.format ?? W$1, g = ["", ...C(o, getColumns(a) - 6, c).split(`
1007
+ const a = s?.output ?? process$1.stdout, i = s?.withGuide ?? settings.withGuide, c = s?.format ?? W, g = ["", ...C(o, getColumns(a) - 6, c).split(`
1049
1008
  `).map(c), ""], n = dist_default2(e), t = Math.max(g.reduce((m, F) => {
1050
1009
  const O = dist_default2(F);
1051
1010
  return O > m ? O : m;
@@ -1057,85 +1016,103 @@ ${h}
1057
1016
  ${styleText2("gray", l$1 + S_BAR_H.repeat(t + 2) + S_CORNER_BOTTOM_RIGHT)}
1058
1017
  `);
1059
1018
  };
1060
- var W = (l) => styleText2("magenta", l);
1019
+ var Y = 30000;
1020
+ var Z = (c) => styleText2("magenta", c);
1061
1021
  var spinner = ({
1062
- indicator: l = "dots",
1063
- onCancel: h,
1022
+ indicator: c = "dots",
1023
+ onCancel: b,
1064
1024
  output: n = process.stdout,
1065
- cancelMessage: G,
1066
- errorMessage: O,
1067
- frames: E = unicode ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"],
1068
- delay: F = unicode ? 80 : 120,
1069
- signal: m,
1070
- ...I
1025
+ cancelMessage: _,
1026
+ errorMessage: C,
1027
+ frames: M = unicode ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"],
1028
+ delay: O = unicode ? 80 : 120,
1029
+ signal: g,
1030
+ ...E
1071
1031
  } = {}) => {
1072
- const u = isCI();
1073
- let M, T, d = false, S = false, s = "", p, w = performance.now();
1074
- const x = getColumns(n), k = I?.styleFrame ?? W, g = (e) => {
1075
- const r = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
1076
- S = e === 1, d && (a(r, e), S && typeof h == "function" && h());
1077
- }, f = () => g(2), i = () => g(1), A = () => {
1078
- process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i), process.on("SIGTERM", i), process.on("exit", g), m && m.addEventListener("abort", i);
1079
- }, H = () => {
1080
- process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i), process.removeListener("SIGTERM", i), process.removeListener("exit", g), m && m.removeEventListener("abort", i);
1081
- }, y = () => {
1082
- if (p === undefined)
1032
+ const u = isCI(), h = isAccessible(E.accessible);
1033
+ let x, I, p = false, l = false, r = "", v, w = performance.now();
1034
+ const y = getColumns(n), F = E?.styleFrame ?? Z, S = (e) => {
1035
+ const s = e > 1 ? C ?? settings.messages.error : _ ?? settings.messages.cancel;
1036
+ l = e === 1, p && (m(s, e), l && typeof b == "function" && b());
1037
+ }, $ = () => S(2), a = () => S(1), H = () => {
1038
+ process.on("uncaughtExceptionMonitor", $), process.on("unhandledRejection", $), process.on("SIGINT", a), process.on("SIGTERM", a), process.on("exit", S), g && g.addEventListener("abort", a);
1039
+ }, B = () => {
1040
+ process.removeListener("uncaughtExceptionMonitor", $), process.removeListener("unhandledRejection", $), process.removeListener("SIGINT", a), process.removeListener("SIGTERM", a), process.removeListener("exit", S), g && g.removeEventListener("abort", a);
1041
+ }, R = () => {
1042
+ if (v === undefined)
1083
1043
  return;
1084
1044
  u && n.write(`
1085
1045
  `);
1086
- const r = wrapAnsi(p, x, {
1046
+ const s = wrapAnsi(v, y, {
1087
1047
  hard: true,
1088
1048
  trim: false
1089
1049
  }).split(`
1090
1050
  `);
1091
- r.length > 1 && n.write(import_sisteransi2.cursor.up(r.length - 1)), n.write(import_sisteransi2.cursor.to(0)), n.write(import_sisteransi2.erase.down());
1092
- }, C = (e) => e.replace(/\.+$/, ""), _ = (e) => {
1093
- const r = (performance.now() - e) / 1000, t = Math.floor(r / 60), o = Math.floor(r % 60);
1094
- return t > 0 ? `[${t}m ${o}s]` : `[${o}s]`;
1095
- }, N = I.withGuide ?? settings.withGuide, P = (e = "") => {
1096
- d = true, M = block({ output: n }), s = C(e), w = performance.now(), N && n.write(`${styleText2("gray", S_BAR)}
1051
+ s.length > 1 && n.write(cursor.up(s.length - 1)), n.write(cursor.to(0)), n.write(erase.down());
1052
+ }, L = (e) => e.replace(/\.+$/, ""), T = (e) => {
1053
+ const s = (performance.now() - e) / 1000, i = Math.floor(s / 60), t = Math.floor(s % 60);
1054
+ return i > 0 ? `[${i}m ${t}s]` : `[${t}s]`;
1055
+ }, N = E.withGuide ?? settings.withGuide, P = (e = "") => {
1056
+ if (p = true, l = false, r = L(e), w = performance.now(), H(), h) {
1057
+ r !== "" && n.write(`${r}
1058
+ `), I = setInterval(() => {
1059
+ n.write(r === "" ? `still working
1060
+ ` : `still working: ${r}
1097
1061
  `);
1098
- let r = 0, t = 0;
1099
- A(), T = setInterval(() => {
1100
- if (u && s === p)
1062
+ }, Y);
1063
+ return;
1064
+ }
1065
+ x = block({ output: n }), N && n.write(`${styleText2("gray", S_BAR)}
1066
+ `);
1067
+ let s = 0, i = 0;
1068
+ I = setInterval(() => {
1069
+ if (u && r === v)
1101
1070
  return;
1102
- y(), p = s;
1103
- const o = k(E[r]);
1104
- let v;
1071
+ R(), v = r;
1072
+ const t = F(M[s]);
1073
+ let o;
1105
1074
  if (u)
1106
- v = `${o} ${s}...`;
1107
- else if (l === "timer")
1108
- v = `${o} ${s} ${_(w)}`;
1075
+ o = `${t} ${r}...`;
1076
+ else if (c === "timer")
1077
+ o = `${t} ${r} ${T(w)}`;
1109
1078
  else {
1110
- const B = ".".repeat(Math.floor(t)).slice(0, 3);
1111
- v = `${o} ${s}${B}`;
1079
+ const j = ".".repeat(Math.floor(i)).slice(0, 3);
1080
+ o = `${t} ${r}${j}`;
1112
1081
  }
1113
- const j = wrapAnsi(v, x, {
1082
+ const D = wrapAnsi(o, y, {
1114
1083
  hard: true,
1115
1084
  trim: false
1116
1085
  });
1117
- n.write(j), r = r + 1 < E.length ? r + 1 : 0, t = t < 4 ? t + 0.125 : 0;
1118
- }, F);
1119
- }, a = (e = "", r = 0, t = false) => {
1120
- if (!d)
1121
- return;
1122
- d = false, clearInterval(T), y();
1123
- const o = r === 0 ? styleText2("green", S_STEP_SUBMIT) : r === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
1124
- s = e ?? s, t || (l === "timer" ? n.write(`${o} ${s} ${_(w)}
1125
- `) : n.write(`${o} ${s}
1126
- `)), H(), M();
1086
+ n.write(D), s = s + 1 < M.length ? s + 1 : 0, i = i < 4 ? i + 0.125 : 0;
1087
+ }, O);
1088
+ }, m = (e = "", s = 0, i = false) => {
1089
+ if (p) {
1090
+ if (p = false, l = s === 1, clearInterval(I), h || R(), r = e ?? r, !i)
1091
+ if (h) {
1092
+ const t = s === 1 ? _ ?? settings.messages.cancel : s === 2 ? C ?? settings.messages.error : "Done", o = r || t;
1093
+ c === "timer" ? n.write(`${o} ${T(w)}
1094
+ `) : n.write(`${o}
1095
+ `);
1096
+ } else {
1097
+ const t = s === 0 ? styleText2("green", S_STEP_SUBMIT) : s === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
1098
+ c === "timer" ? n.write(`${t} ${r} ${T(w)}
1099
+ `) : n.write(`${t} ${r}
1100
+ `);
1101
+ }
1102
+ B(), x?.();
1103
+ }
1127
1104
  };
1128
1105
  return {
1129
1106
  start: P,
1130
- stop: (e = "") => a(e, 0),
1107
+ stop: (e = "") => m(e, 0),
1131
1108
  message: (e = "") => {
1132
- s = C(e ?? s);
1109
+ r = L(e ?? r);
1133
1110
  },
1134
- cancel: (e = "") => a(e, 1),
1135
- error: (e = "") => a(e, 2),
1136
- clear: () => a("", 0, true),
1111
+ cancel: (e = "") => m(e, 1),
1112
+ error: (e = "") => m(e, 2),
1113
+ clear: () => m("", 0, true),
1137
1114
  get isCancelled() {
1138
- return S;
1115
+ return l;
1139
1116
  }
1140
1117
  };
1141
1118
  };
@@ -1148,7 +1125,7 @@ var SELECT_INSTRUCTIONS = [
1148
1125
  `${styleText2("dim", "↑/↓")} to navigate`,
1149
1126
  `${styleText2("dim", "Enter:")} confirm`
1150
1127
  ];
1151
- var c = (t, o) => t.includes(`
1128
+ var c2 = (t, o) => t.includes(`
1152
1129
  `) ? t.split(`
1153
1130
  `).map((d) => o(d)).join(`
1154
1131
  `) : o(t);
@@ -1159,15 +1136,15 @@ var select = (t) => {
1159
1136
  const s = n.label ?? String(n.value);
1160
1137
  switch (m) {
1161
1138
  case "disabled":
1162
- return `${styleText2("gray", S_RADIO_INACTIVE)} ${c(s, (i) => styleText2("gray", i))}${n.hint ? ` ${styleText2("dim", `(${n.hint ?? "disabled"})`)}` : ""}`;
1139
+ return `${styleText2("gray", S_RADIO_INACTIVE)} ${c2(s, (i) => styleText2("gray", i))}${n.hint ? ` ${styleText2("dim", `(${n.hint ?? "disabled"})`)}` : ""}`;
1163
1140
  case "selected":
1164
- return `${c(s, (i) => styleText2("dim", i))}`;
1141
+ return `${c2(s, (i) => styleText2("dim", i))}`;
1165
1142
  case "active":
1166
1143
  return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n.hint ? ` ${styleText2("dim", `(${n.hint})`)}` : ""}`;
1167
1144
  case "cancelled":
1168
- return `${c(s, (i) => styleText2(["strikethrough", "dim"], i))}`;
1145
+ return `${c2(s, (i) => styleText2(["strikethrough", "dim"], i))}`;
1169
1146
  default:
1170
- return `${styleText2("dim", S_RADIO_INACTIVE)} ${c(s, (i) => styleText2("dim", i))}`;
1147
+ return `${styleText2("dim", S_RADIO_INACTIVE)} ${c2(s, (i) => styleText2("dim", i))}`;
1171
1148
  }
1172
1149
  }, d = t.showInstructions ?? true;
1173
1150
  return new n$1({
@@ -1192,7 +1169,7 @@ ${styleText2("gray", S_BAR)}` : ""}`;
1192
1169
  }
1193
1170
  default: {
1194
1171
  const r = n ? `${styleText2("cyan", S_BAR)} ` : "", a = u.split(`
1195
- `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n) : n ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
1172
+ `).length, p = d ? formatInstructionFooter(t.output, SELECT_INSTRUCTIONS, n) : n ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
1196
1173
  `), b = p.length + 1;
1197
1174
  return `${u}${r}${limitOptions({
1198
1175
  output: t.output,
@@ -1257,7 +1234,7 @@ ${i}
1257
1234
  }
1258
1235
  }).prompt();
1259
1236
  // package.json
1260
- var version = "0.1.0-beta.5";
1237
+ var version = "0.1.0-beta.6";
1261
1238
 
1262
1239
  // src/index.ts
1263
1240
  var RANGE = `^${version}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-better-schemic",
3
- "version": "0.1.0-beta.5",
3
+ "version": "0.1.0-beta.6",
4
4
  "description": "Scaffold a new Better-schemic project — package.json, tsconfig, a driver, and the database/ schema, in one command.",
5
5
  "license": "MIT",
6
6
  "author": "NONSTANDARDCODE",
@@ -31,8 +31,8 @@
31
31
  "lint": "biome check ."
32
32
  },
33
33
  "devDependencies": {
34
- "@biomejs/biome": "^2.6.4",
35
- "@clack/prompts": "^1.8.1",
34
+ "@biomejs/biome": "^2.6.8",
35
+ "@clack/prompts": "^1.9.0",
36
36
  "@types/bun": "^1.4.4"
37
37
  }
38
38
  }