create-vorma 0.85.0-pre.9 → 0.86.0-pre.1
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/main.mjs +382 -414
- package/.dist/main.mjs.map +1 -1
- package/LICENSE +19 -0
- package/package.json +28 -32
package/.dist/main.mjs
CHANGED
|
@@ -7,27 +7,34 @@ import * as path from "node:path";
|
|
|
7
7
|
import { dirname } from "node:path";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
9
|
import { stripVTControlCharacters, styleText } from "node:util";
|
|
10
|
-
import
|
|
11
|
-
import * as
|
|
12
|
-
import
|
|
10
|
+
import V, { stdin, stdout } from "node:process";
|
|
11
|
+
import * as b from "node:readline";
|
|
12
|
+
import E from "node:readline";
|
|
13
13
|
import { ReadStream } from "node:tty";
|
|
14
14
|
//#region \0rolldown/runtime.js
|
|
15
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
15
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
16
16
|
//#endregion
|
|
17
|
-
//#region
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
//#region node_modules/fast-string-truncated-width/dist/utils.js
|
|
18
|
+
const getCodePointsLength = (() => {
|
|
19
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
20
|
+
return (input) => {
|
|
21
|
+
let surrogatePairsNr = 0;
|
|
22
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
23
|
+
while (SURROGATE_PAIR_RE.test(input)) surrogatePairsNr += 1;
|
|
24
|
+
return input.length - surrogatePairsNr;
|
|
25
|
+
};
|
|
26
|
+
})();
|
|
21
27
|
const isFullWidth = (x) => {
|
|
22
28
|
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
23
29
|
};
|
|
24
|
-
const
|
|
25
|
-
return x
|
|
30
|
+
const isWideNotCJKTNotEmoji = (x) => {
|
|
31
|
+
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
26
32
|
};
|
|
27
33
|
//#endregion
|
|
28
|
-
//#region
|
|
29
|
-
const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
34
|
+
//#region node_modules/fast-string-truncated-width/dist/index.js
|
|
35
|
+
const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
30
36
|
const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
37
|
+
const CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy;
|
|
31
38
|
const TAB_RE = /\t{1,1000}/y;
|
|
32
39
|
const EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy;
|
|
33
40
|
const LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
@@ -40,14 +47,21 @@ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {
|
|
|
40
47
|
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
41
48
|
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
42
49
|
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION$1, widthOptions).width : 0);
|
|
43
|
-
const ANSI_WIDTH =
|
|
50
|
+
const ANSI_WIDTH = 0;
|
|
44
51
|
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
45
52
|
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
46
|
-
const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
|
|
47
53
|
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
48
|
-
const FULL_WIDTH_WIDTH =
|
|
54
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
49
55
|
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
50
|
-
const WIDE_WIDTH = widthOptions.wideWidth ??
|
|
56
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
57
|
+
const PARSE_BLOCKS = [
|
|
58
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
59
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
60
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
61
|
+
[TAB_RE, TAB_WIDTH],
|
|
62
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
63
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
64
|
+
];
|
|
51
65
|
let indexPrev = 0;
|
|
52
66
|
let index = 0;
|
|
53
67
|
let length = input.length;
|
|
@@ -66,8 +80,7 @@ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {
|
|
|
66
80
|
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
67
81
|
const codePoint = char.codePointAt(0) || 0;
|
|
68
82
|
if (isFullWidth(codePoint)) widthExtra = FULL_WIDTH_WIDTH;
|
|
69
|
-
else if (
|
|
70
|
-
else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) widthExtra = AMBIGUOUS_WIDTH;
|
|
83
|
+
else if (isWideNotCJKTNotEmoji(codePoint)) widthExtra = WIDE_WIDTH;
|
|
71
84
|
else widthExtra = REGULAR_WIDTH;
|
|
72
85
|
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
73
86
|
if (width + widthExtra > LIMIT) {
|
|
@@ -79,77 +92,24 @@ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {
|
|
|
79
92
|
}
|
|
80
93
|
unmatchedStart = unmatchedEnd = 0;
|
|
81
94
|
}
|
|
82
|
-
if (index >= length) break;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (ANSI_RE.test(input)) {
|
|
100
|
-
if (width + ANSI_WIDTH > truncationLimit) truncationIndex = Math.min(truncationIndex, index);
|
|
101
|
-
if (width + ANSI_WIDTH > LIMIT) {
|
|
102
|
-
truncationEnabled = true;
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
width += ANSI_WIDTH;
|
|
106
|
-
unmatchedStart = indexPrev;
|
|
107
|
-
unmatchedEnd = index;
|
|
108
|
-
index = indexPrev = ANSI_RE.lastIndex;
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
CONTROL_RE.lastIndex = index;
|
|
112
|
-
if (CONTROL_RE.test(input)) {
|
|
113
|
-
lengthExtra = CONTROL_RE.lastIndex - index;
|
|
114
|
-
widthExtra = lengthExtra * CONTROL_WIDTH;
|
|
115
|
-
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));
|
|
116
|
-
if (width + widthExtra > LIMIT) {
|
|
117
|
-
truncationEnabled = true;
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
width += widthExtra;
|
|
121
|
-
unmatchedStart = indexPrev;
|
|
122
|
-
unmatchedEnd = index;
|
|
123
|
-
index = indexPrev = CONTROL_RE.lastIndex;
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
TAB_RE.lastIndex = index;
|
|
127
|
-
if (TAB_RE.test(input)) {
|
|
128
|
-
lengthExtra = TAB_RE.lastIndex - index;
|
|
129
|
-
widthExtra = lengthExtra * TAB_WIDTH;
|
|
130
|
-
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
|
|
131
|
-
if (width + widthExtra > LIMIT) {
|
|
132
|
-
truncationEnabled = true;
|
|
133
|
-
break;
|
|
134
|
-
}
|
|
135
|
-
width += widthExtra;
|
|
136
|
-
unmatchedStart = indexPrev;
|
|
137
|
-
unmatchedEnd = index;
|
|
138
|
-
index = indexPrev = TAB_RE.lastIndex;
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
EMOJI_RE.lastIndex = index;
|
|
142
|
-
if (EMOJI_RE.test(input)) {
|
|
143
|
-
if (width + EMOJI_WIDTH > truncationLimit) truncationIndex = Math.min(truncationIndex, index);
|
|
144
|
-
if (width + EMOJI_WIDTH > LIMIT) {
|
|
145
|
-
truncationEnabled = true;
|
|
146
|
-
break;
|
|
95
|
+
if (index >= length) break outer;
|
|
96
|
+
for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {
|
|
97
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
|
|
98
|
+
BLOCK_RE.lastIndex = index;
|
|
99
|
+
if (BLOCK_RE.test(input)) {
|
|
100
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
101
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
102
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
103
|
+
if (width + widthExtra > LIMIT) {
|
|
104
|
+
truncationEnabled = true;
|
|
105
|
+
break outer;
|
|
106
|
+
}
|
|
107
|
+
width += widthExtra;
|
|
108
|
+
unmatchedStart = indexPrev;
|
|
109
|
+
unmatchedEnd = index;
|
|
110
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
111
|
+
continue outer;
|
|
147
112
|
}
|
|
148
|
-
width += EMOJI_WIDTH;
|
|
149
|
-
unmatchedStart = indexPrev;
|
|
150
|
-
unmatchedEnd = index;
|
|
151
|
-
index = indexPrev = EMOJI_RE.lastIndex;
|
|
152
|
-
continue;
|
|
153
113
|
}
|
|
154
114
|
index += 1;
|
|
155
115
|
}
|
|
@@ -161,7 +121,7 @@ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {
|
|
|
161
121
|
};
|
|
162
122
|
};
|
|
163
123
|
//#endregion
|
|
164
|
-
//#region
|
|
124
|
+
//#region node_modules/fast-string-width/dist/index.js
|
|
165
125
|
const NO_TRUNCATION = {
|
|
166
126
|
limit: Infinity,
|
|
167
127
|
ellipsis: "",
|
|
@@ -171,7 +131,7 @@ const fastStringWidth = (input, options = {}) => {
|
|
|
171
131
|
return getStringTruncatedWidth(input, NO_TRUNCATION, options).width;
|
|
172
132
|
};
|
|
173
133
|
//#endregion
|
|
174
|
-
//#region
|
|
134
|
+
//#region node_modules/fast-wrap-ansi/lib/main.js
|
|
175
135
|
const ESC = "\x1B";
|
|
176
136
|
const CSI = "";
|
|
177
137
|
const END_CODE = 39;
|
|
@@ -308,8 +268,10 @@ const exec = (string, columns, options = {}) => {
|
|
|
308
268
|
for (let i = 0; i < preString.length; i++) {
|
|
309
269
|
const character = preString[i];
|
|
310
270
|
returnValue += character;
|
|
311
|
-
if (!inSurrogate)
|
|
312
|
-
|
|
271
|
+
if (!inSurrogate) {
|
|
272
|
+
inSurrogate = character >= "\ud800" && character <= "\udbff";
|
|
273
|
+
if (inSurrogate) continue;
|
|
274
|
+
} else inSurrogate = false;
|
|
313
275
|
if (character === ESC || character === CSI) {
|
|
314
276
|
GROUP_REGEX.lastIndex = i + 1;
|
|
315
277
|
const groups = GROUP_REGEX.exec(preString)?.groups;
|
|
@@ -334,7 +296,7 @@ function wrapAnsi(string, columns, options) {
|
|
|
334
296
|
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
335
297
|
}
|
|
336
298
|
//#endregion
|
|
337
|
-
//#region
|
|
299
|
+
//#region node_modules/@clack/core/dist/index.mjs
|
|
338
300
|
var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
339
301
|
const ESC = "\x1B";
|
|
340
302
|
const CSI = `${ESC}[`;
|
|
@@ -387,12 +349,12 @@ var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
387
349
|
beep
|
|
388
350
|
};
|
|
389
351
|
})))();
|
|
390
|
-
function
|
|
391
|
-
if (!
|
|
392
|
-
const
|
|
393
|
-
return
|
|
352
|
+
function f(r, t, s) {
|
|
353
|
+
if (!s.some((o) => !o.disabled)) return r;
|
|
354
|
+
const e = r + t, i = Math.max(s.length - 1, 0), n = e < 0 ? i : e > i ? 0 : e;
|
|
355
|
+
return s[n].disabled ? f(n, t < 0 ? -1 : 1, s) : n;
|
|
394
356
|
}
|
|
395
|
-
const
|
|
357
|
+
const h = {
|
|
396
358
|
actions: new Set([
|
|
397
359
|
"up",
|
|
398
360
|
"down",
|
|
@@ -439,71 +401,74 @@ const u = {
|
|
|
439
401
|
}
|
|
440
402
|
}
|
|
441
403
|
};
|
|
442
|
-
function
|
|
443
|
-
if (typeof r == "string") return
|
|
444
|
-
for (const
|
|
404
|
+
function C(r, t) {
|
|
405
|
+
if (typeof r == "string") return h.aliases.get(r) === t;
|
|
406
|
+
for (const s of r) if (s !== void 0 && C(s, t)) return !0;
|
|
445
407
|
return !1;
|
|
446
408
|
}
|
|
447
|
-
function
|
|
409
|
+
function z$1(r, t) {
|
|
448
410
|
if (r === t) return;
|
|
449
|
-
const
|
|
450
|
-
`),
|
|
451
|
-
`), i = Math.max(
|
|
452
|
-
for (let o = 0; o < i; o++)
|
|
411
|
+
const s = r.split(`
|
|
412
|
+
`), e = t.split(`
|
|
413
|
+
`), i = Math.max(s.length, e.length), n = [];
|
|
414
|
+
for (let o = 0; o < i; o++) s[o] !== e[o] && n.push(o);
|
|
453
415
|
return {
|
|
454
416
|
lines: n,
|
|
455
|
-
numLinesBefore:
|
|
456
|
-
numLinesAfter:
|
|
417
|
+
numLinesBefore: s.length,
|
|
418
|
+
numLinesAfter: e.length,
|
|
457
419
|
numLines: i
|
|
458
420
|
};
|
|
459
421
|
}
|
|
460
|
-
const Y$1 = globalThis.process.platform.startsWith("win"),
|
|
461
|
-
function q(r) {
|
|
462
|
-
return r ===
|
|
422
|
+
const Y$1 = globalThis.process.platform.startsWith("win"), k = Symbol("clack:cancel");
|
|
423
|
+
function q$1(r) {
|
|
424
|
+
return r === k;
|
|
463
425
|
}
|
|
464
426
|
function w$1(r, t) {
|
|
465
|
-
const
|
|
466
|
-
|
|
427
|
+
const s = r;
|
|
428
|
+
s.isTTY && s.setRawMode(t);
|
|
467
429
|
}
|
|
468
|
-
function
|
|
469
|
-
const i =
|
|
430
|
+
function R$1({ input: r = stdin, output: t = stdout, overwrite: s = !0, hideCursor: e = !0 } = {}) {
|
|
431
|
+
const i = b.createInterface({
|
|
470
432
|
input: r,
|
|
471
433
|
output: t,
|
|
472
434
|
prompt: "",
|
|
473
435
|
tabSize: 1
|
|
474
436
|
});
|
|
475
|
-
|
|
476
|
-
const n = (o, { name:
|
|
477
|
-
if (
|
|
437
|
+
b.emitKeypressEvents(r, i), r instanceof ReadStream && r.isTTY && r.setRawMode(!0);
|
|
438
|
+
const n = (o, { name: u, sequence: a }) => {
|
|
439
|
+
if (C([
|
|
478
440
|
String(o),
|
|
479
|
-
|
|
480
|
-
|
|
441
|
+
u,
|
|
442
|
+
a
|
|
481
443
|
], "cancel")) {
|
|
482
|
-
|
|
444
|
+
e && t.write(import_src.cursor.show), process.exit(0);
|
|
483
445
|
return;
|
|
484
446
|
}
|
|
485
|
-
if (!
|
|
486
|
-
const
|
|
487
|
-
|
|
488
|
-
|
|
447
|
+
if (!s) return;
|
|
448
|
+
const c = u === "return" ? 0 : -1, y = u === "return" ? -1 : 0;
|
|
449
|
+
b.moveCursor(t, c, y, () => {
|
|
450
|
+
b.clearLine(t, 1, () => {
|
|
489
451
|
r.once("keypress", n);
|
|
490
452
|
});
|
|
491
453
|
});
|
|
492
454
|
};
|
|
493
|
-
return
|
|
494
|
-
r.off("keypress", n),
|
|
455
|
+
return e && t.write(import_src.cursor.hide), r.once("keypress", n), () => {
|
|
456
|
+
r.off("keypress", n), e && t.write(import_src.cursor.show), r instanceof ReadStream && r.isTTY && !Y$1 && r.setRawMode(!1), i.terminal = !1, i.close();
|
|
495
457
|
};
|
|
496
458
|
}
|
|
497
|
-
const
|
|
498
|
-
function
|
|
499
|
-
return wrapAnsi(t,
|
|
459
|
+
const A = (r) => "columns" in r && typeof r.columns == "number" ? r.columns : 80, L = (r) => "rows" in r && typeof r.rows == "number" ? r.rows : 20;
|
|
460
|
+
function W(r, t, s, e = s, i = s, n) {
|
|
461
|
+
return wrapAnsi(t, A(r ?? stdout) - s.length, {
|
|
500
462
|
hard: !0,
|
|
501
463
|
trim: !1
|
|
502
464
|
}).split(`
|
|
503
|
-
`).map((
|
|
465
|
+
`).map((u, a, l) => {
|
|
466
|
+
const c = n ? n(u, a) : u;
|
|
467
|
+
return a === 0 ? `${e}${c}` : a === l.length - 1 ? `${i}${c}` : `${s}${c}`;
|
|
468
|
+
}).join(`
|
|
504
469
|
`);
|
|
505
470
|
}
|
|
506
|
-
let
|
|
471
|
+
let m = class {
|
|
507
472
|
input;
|
|
508
473
|
output;
|
|
509
474
|
_abortSignal;
|
|
@@ -518,40 +483,40 @@ let p = class {
|
|
|
518
483
|
error = "";
|
|
519
484
|
value;
|
|
520
485
|
userInput = "";
|
|
521
|
-
constructor(t,
|
|
522
|
-
const { input:
|
|
523
|
-
this.opts =
|
|
486
|
+
constructor(t, s = !0) {
|
|
487
|
+
const { input: e = stdin, output: i = stdout, render: n, signal: o, ...u } = t;
|
|
488
|
+
this.opts = u, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = o, this.input = e, this.output = i;
|
|
524
489
|
}
|
|
525
490
|
unsubscribe() {
|
|
526
491
|
this._subscribers.clear();
|
|
527
492
|
}
|
|
528
|
-
setSubscriber(t,
|
|
529
|
-
const
|
|
530
|
-
|
|
493
|
+
setSubscriber(t, s) {
|
|
494
|
+
const e = this._subscribers.get(t) ?? [];
|
|
495
|
+
e.push(s), this._subscribers.set(t, e);
|
|
531
496
|
}
|
|
532
|
-
on(t,
|
|
533
|
-
this.setSubscriber(t, { cb:
|
|
497
|
+
on(t, s) {
|
|
498
|
+
this.setSubscriber(t, { cb: s });
|
|
534
499
|
}
|
|
535
|
-
once(t,
|
|
500
|
+
once(t, s) {
|
|
536
501
|
this.setSubscriber(t, {
|
|
537
|
-
cb:
|
|
502
|
+
cb: s,
|
|
538
503
|
once: !0
|
|
539
504
|
});
|
|
540
505
|
}
|
|
541
|
-
emit(t, ...
|
|
542
|
-
const
|
|
543
|
-
for (const n of
|
|
506
|
+
emit(t, ...s) {
|
|
507
|
+
const e = this._subscribers.get(t) ?? [], i = [];
|
|
508
|
+
for (const n of e) n.cb(...s), n.once && i.push(() => e.splice(e.indexOf(n), 1));
|
|
544
509
|
for (const n of i) n();
|
|
545
510
|
}
|
|
546
511
|
prompt() {
|
|
547
512
|
return new Promise((t) => {
|
|
548
513
|
if (this._abortSignal) {
|
|
549
|
-
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t(
|
|
514
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t(k);
|
|
550
515
|
this._abortSignal.addEventListener("abort", () => {
|
|
551
516
|
this.state = "cancel", this.close();
|
|
552
517
|
}, { once: !0 });
|
|
553
518
|
}
|
|
554
|
-
this.rl =
|
|
519
|
+
this.rl = E.createInterface({
|
|
555
520
|
input: this.input,
|
|
556
521
|
tabSize: 2,
|
|
557
522
|
prompt: "",
|
|
@@ -560,18 +525,21 @@ let p = class {
|
|
|
560
525
|
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), w$1(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
561
526
|
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), w$1(this.input, !1), t(this.value);
|
|
562
527
|
}), this.once("cancel", () => {
|
|
563
|
-
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), w$1(this.input, !1), t(
|
|
528
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), w$1(this.input, !1), t(k);
|
|
564
529
|
});
|
|
565
530
|
});
|
|
566
531
|
}
|
|
567
|
-
_isActionKey(t,
|
|
532
|
+
_isActionKey(t, s) {
|
|
568
533
|
return t === " ";
|
|
569
534
|
}
|
|
535
|
+
_shouldSubmit(t, s) {
|
|
536
|
+
return !0;
|
|
537
|
+
}
|
|
570
538
|
_setValue(t) {
|
|
571
539
|
this.value = t, this.emit("value", this.value);
|
|
572
540
|
}
|
|
573
|
-
_setUserInput(t,
|
|
574
|
-
this.userInput = t ?? "", this.emit("userInput", this.userInput),
|
|
541
|
+
_setUserInput(t, s) {
|
|
542
|
+
this.userInput = t ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
575
543
|
}
|
|
576
544
|
_clearUserInput() {
|
|
577
545
|
this.rl?.write(null, {
|
|
@@ -579,21 +547,21 @@ let p = class {
|
|
|
579
547
|
name: "u"
|
|
580
548
|
}), this._setUserInput("");
|
|
581
549
|
}
|
|
582
|
-
onKeypress(t,
|
|
583
|
-
if (this._track &&
|
|
550
|
+
onKeypress(t, s) {
|
|
551
|
+
if (this._track && s.name !== "return" && (s.name && this._isActionKey(t, s) && this.rl?.write(null, {
|
|
584
552
|
ctrl: !0,
|
|
585
553
|
name: "h"
|
|
586
|
-
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"),
|
|
554
|
+
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), s?.name && (!this._track && h.aliases.has(s.name) && this.emit("cursor", h.aliases.get(s.name)), h.actions.has(s.name) && this.emit("cursor", s.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t?.toLowerCase(), s), s?.name === "return" && this._shouldSubmit(t, s)) {
|
|
587
555
|
if (this.opts.validate) {
|
|
588
|
-
const
|
|
589
|
-
|
|
556
|
+
const e = this.opts.validate(this.value);
|
|
557
|
+
e && (this.error = e instanceof Error ? e.message : e, this.state = "error", this.rl?.write(this.userInput));
|
|
590
558
|
}
|
|
591
559
|
this.state !== "error" && (this.state = "submit");
|
|
592
560
|
}
|
|
593
|
-
|
|
561
|
+
C([
|
|
594
562
|
t,
|
|
595
|
-
|
|
596
|
-
|
|
563
|
+
s?.name,
|
|
564
|
+
s?.sequence
|
|
597
565
|
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
598
566
|
}
|
|
599
567
|
close() {
|
|
@@ -616,30 +584,30 @@ let p = class {
|
|
|
616
584
|
if (t !== this._prevFrame) {
|
|
617
585
|
if (this.state === "initial") this.output.write(import_src.cursor.hide);
|
|
618
586
|
else {
|
|
619
|
-
const
|
|
620
|
-
if (this.restoreCursor(),
|
|
621
|
-
const i = Math.max(0,
|
|
622
|
-
let o =
|
|
587
|
+
const s = z$1(this._prevFrame, t), e = L(this.output);
|
|
588
|
+
if (this.restoreCursor(), s) {
|
|
589
|
+
const i = Math.max(0, s.numLinesAfter - e), n = Math.max(0, s.numLinesBefore - e);
|
|
590
|
+
let o = s.lines.find((u) => u >= i);
|
|
623
591
|
if (o === void 0) {
|
|
624
592
|
this._prevFrame = t;
|
|
625
593
|
return;
|
|
626
594
|
}
|
|
627
|
-
if (
|
|
595
|
+
if (s.lines.length === 1) {
|
|
628
596
|
this.output.write(import_src.cursor.move(0, o - n)), this.output.write(import_src.erase.lines(1));
|
|
629
|
-
const
|
|
597
|
+
const u = t.split(`
|
|
630
598
|
`);
|
|
631
|
-
this.output.write(
|
|
599
|
+
this.output.write(u[o]), this._prevFrame = t, this.output.write(import_src.cursor.move(0, u.length - o - 1));
|
|
632
600
|
return;
|
|
633
|
-
} else if (
|
|
601
|
+
} else if (s.lines.length > 1) {
|
|
634
602
|
if (i < n) o = i;
|
|
635
603
|
else {
|
|
636
|
-
const
|
|
637
|
-
|
|
604
|
+
const a = o - n;
|
|
605
|
+
a > 0 && this.output.write(import_src.cursor.move(0, a));
|
|
638
606
|
}
|
|
639
607
|
this.output.write(import_src.erase.down());
|
|
640
|
-
const
|
|
608
|
+
const u = t.split(`
|
|
641
609
|
`).slice(o);
|
|
642
|
-
this.output.write(
|
|
610
|
+
this.output.write(u.join(`
|
|
643
611
|
`)), this._prevFrame = t;
|
|
644
612
|
return;
|
|
645
613
|
}
|
|
@@ -650,7 +618,7 @@ let p = class {
|
|
|
650
618
|
}
|
|
651
619
|
}
|
|
652
620
|
};
|
|
653
|
-
var
|
|
621
|
+
var X = class extends m {
|
|
654
622
|
get cursor() {
|
|
655
623
|
return this.value ? 0 : 1;
|
|
656
624
|
}
|
|
@@ -660,14 +628,14 @@ var Q$1 = class extends p {
|
|
|
660
628
|
constructor(t) {
|
|
661
629
|
super(t, !1), this.value = !!t.initialValue, this.on("userInput", () => {
|
|
662
630
|
this.value = this._value;
|
|
663
|
-
}), this.on("confirm", (
|
|
664
|
-
this.output.write(import_src.cursor.move(0, -1)), this.value =
|
|
631
|
+
}), this.on("confirm", (s) => {
|
|
632
|
+
this.output.write(import_src.cursor.move(0, -1)), this.value = s, this.state = "submit", this.close();
|
|
665
633
|
}), this.on("cursor", () => {
|
|
666
634
|
this.value = !this.value;
|
|
667
635
|
});
|
|
668
636
|
}
|
|
669
637
|
};
|
|
670
|
-
var
|
|
638
|
+
var ut$1 = class extends m {
|
|
671
639
|
options;
|
|
672
640
|
cursor = 0;
|
|
673
641
|
get _selectedValue() {
|
|
@@ -678,29 +646,29 @@ var nt$1 = class extends p {
|
|
|
678
646
|
}
|
|
679
647
|
constructor(t) {
|
|
680
648
|
super(t, !1), this.options = t.options;
|
|
681
|
-
const
|
|
682
|
-
this.cursor = this.options[
|
|
649
|
+
const s = this.options.findIndex(({ value: i }) => i === t.initialValue), e = s === -1 ? 0 : s;
|
|
650
|
+
this.cursor = this.options[e].disabled ? f(e, 1, this.options) : e, this.changeValue(), this.on("cursor", (i) => {
|
|
683
651
|
switch (i) {
|
|
684
652
|
case "left":
|
|
685
653
|
case "up":
|
|
686
|
-
this.cursor =
|
|
654
|
+
this.cursor = f(this.cursor, -1, this.options);
|
|
687
655
|
break;
|
|
688
656
|
case "down":
|
|
689
657
|
case "right":
|
|
690
|
-
this.cursor =
|
|
658
|
+
this.cursor = f(this.cursor, 1, this.options);
|
|
691
659
|
break;
|
|
692
660
|
}
|
|
693
661
|
this.changeValue();
|
|
694
662
|
});
|
|
695
663
|
}
|
|
696
664
|
};
|
|
697
|
-
var
|
|
665
|
+
var ht$1 = class extends m {
|
|
698
666
|
get userInputWithCursor() {
|
|
699
667
|
if (this.state === "submit") return this.userInput;
|
|
700
668
|
const t = this.userInput;
|
|
701
669
|
if (this.cursor >= t.length) return `${this.userInput}\u2588`;
|
|
702
|
-
const
|
|
703
|
-
return `${
|
|
670
|
+
const s = t.slice(0, this.cursor), [e, ...i] = t.slice(this.cursor);
|
|
671
|
+
return `${s}${styleText("inverse", e)}${i.join("")}`;
|
|
704
672
|
}
|
|
705
673
|
get cursor() {
|
|
706
674
|
return this._cursor;
|
|
@@ -709,22 +677,22 @@ var at$1 = class extends p {
|
|
|
709
677
|
super({
|
|
710
678
|
...t,
|
|
711
679
|
initialUserInput: t.initialUserInput ?? t.initialValue
|
|
712
|
-
}), this.on("userInput", (
|
|
713
|
-
this._setValue(
|
|
680
|
+
}), this.on("userInput", (s) => {
|
|
681
|
+
this._setValue(s);
|
|
714
682
|
}), this.on("finalize", () => {
|
|
715
683
|
this.value || (this.value = t.defaultValue), this.value === void 0 && (this.value = "");
|
|
716
684
|
});
|
|
717
685
|
}
|
|
718
686
|
};
|
|
719
687
|
//#endregion
|
|
720
|
-
//#region
|
|
721
|
-
function
|
|
722
|
-
return
|
|
688
|
+
//#region node_modules/@clack/prompts/dist/index.mjs
|
|
689
|
+
function ee() {
|
|
690
|
+
return V.platform !== "win32" ? V.env.TERM !== "linux" : !!V.env.CI || !!V.env.WT_SESSION || !!V.env.TERMINUS_SUBLIME || V.env.ConEmuTask === "{cmd::Cmder}" || V.env.TERM_PROGRAM === "Terminus-Sublime" || V.env.TERM_PROGRAM === "vscode" || V.env.TERM === "xterm-256color" || V.env.TERM === "alacritty" || V.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
723
691
|
}
|
|
724
|
-
const
|
|
692
|
+
const tt = ee(), ot = () => process.env.CI === "true", w = (t, i) => tt ? t : i, Tt = w("◆", "*"), at = w("■", "x"), ut = w("▲", "x"), H = w("◇", "o"), lt = w("┌", "T"), $ = w("│", "|"), x = w("└", "—");
|
|
725
693
|
w("┐", "T");
|
|
726
694
|
w("┘", "—");
|
|
727
|
-
const z = w("●", ">"),
|
|
695
|
+
const z = w("●", ">"), U = w("○", " ");
|
|
728
696
|
w("◻", "[•]");
|
|
729
697
|
w("◼", "[+]");
|
|
730
698
|
w("◻", "[ ]");
|
|
@@ -735,145 +703,145 @@ w("├", "+");
|
|
|
735
703
|
w("╯", "+");
|
|
736
704
|
w("╰", "+");
|
|
737
705
|
w("╭", "+");
|
|
738
|
-
const
|
|
739
|
-
switch (
|
|
706
|
+
const ht = w("●", "•"), pt = w("◆", "*"), mt = w("▲", "!"), gt = w("■", "x"), P = (t) => {
|
|
707
|
+
switch (t) {
|
|
740
708
|
case "initial":
|
|
741
|
-
case "active": return styleText("cyan",
|
|
742
|
-
case "cancel": return styleText("red",
|
|
743
|
-
case "error": return styleText("yellow",
|
|
744
|
-
case "submit": return styleText("green",
|
|
709
|
+
case "active": return styleText("cyan", Tt);
|
|
710
|
+
case "cancel": return styleText("red", at);
|
|
711
|
+
case "error": return styleText("yellow", ut);
|
|
712
|
+
case "submit": return styleText("green", H);
|
|
745
713
|
}
|
|
746
|
-
},
|
|
747
|
-
switch (
|
|
714
|
+
}, yt = (t) => {
|
|
715
|
+
switch (t) {
|
|
748
716
|
case "initial":
|
|
749
|
-
case "active": return styleText("cyan",
|
|
750
|
-
case "cancel": return styleText("red",
|
|
751
|
-
case "error": return styleText("yellow",
|
|
752
|
-
case "submit": return styleText("green",
|
|
753
|
-
}
|
|
754
|
-
}, et = (e, i, s, r, u) => {
|
|
755
|
-
let n = i, o = 0;
|
|
756
|
-
for (let c = s; c < r; c++) {
|
|
757
|
-
const a = e[c];
|
|
758
|
-
if (n = n - a.length, o++, n <= u) break;
|
|
717
|
+
case "active": return styleText("cyan", $);
|
|
718
|
+
case "cancel": return styleText("red", $);
|
|
719
|
+
case "error": return styleText("yellow", $);
|
|
720
|
+
case "submit": return styleText("green", $);
|
|
759
721
|
}
|
|
722
|
+
}, Ot = (t, i, s, r, u, n = !1) => {
|
|
723
|
+
let a = i, c = 0;
|
|
724
|
+
if (n) for (let o = r - 1; o >= s && (a -= t[o].length, c++, !(a <= u)); o--);
|
|
725
|
+
else for (let o = s; o < r && (a -= t[o].length, c++, !(a <= u)); o++);
|
|
760
726
|
return {
|
|
761
|
-
lineCount:
|
|
762
|
-
removals:
|
|
727
|
+
lineCount: a,
|
|
728
|
+
removals: c
|
|
763
729
|
};
|
|
764
|
-
},
|
|
765
|
-
const c =
|
|
730
|
+
}, F = ({ cursor: t, options: i, style: s, output: r = process.stdout, maxItems: u = Number.POSITIVE_INFINITY, columnPadding: n = 0, rowPadding: a = 4 }) => {
|
|
731
|
+
const c = A(r) - n, o = L(r), l = styleText("dim", "..."), d = Math.max(o - a, 0), g = Math.max(Math.min(u, d), 5);
|
|
766
732
|
let p = 0;
|
|
767
|
-
|
|
768
|
-
let
|
|
769
|
-
const
|
|
770
|
-
let
|
|
771
|
-
|
|
772
|
-
const v = p + (
|
|
773
|
-
for (let b = v; b <
|
|
774
|
-
const
|
|
733
|
+
t >= g - 3 && (p = Math.max(Math.min(t - g + 3, i.length - g), 0));
|
|
734
|
+
let f = g < i.length && p > 0, h = g < i.length && p + g < i.length;
|
|
735
|
+
const I = Math.min(p + g, i.length), m = [];
|
|
736
|
+
let y = 0;
|
|
737
|
+
f && y++, h && y++;
|
|
738
|
+
const v = p + (f ? 1 : 0), C = I - (h ? 1 : 0);
|
|
739
|
+
for (let b = v; b < C; b++) {
|
|
740
|
+
const G = wrapAnsi(s(i[b], b === t), c, {
|
|
775
741
|
hard: !0,
|
|
776
742
|
trim: !1
|
|
777
743
|
}).split(`
|
|
778
744
|
`);
|
|
779
|
-
|
|
745
|
+
m.push(G), y += G.length;
|
|
780
746
|
}
|
|
781
|
-
if (
|
|
782
|
-
let b = 0,
|
|
783
|
-
const
|
|
784
|
-
|
|
747
|
+
if (y > d) {
|
|
748
|
+
let b = 0, G = 0, M = y;
|
|
749
|
+
const N = t - v;
|
|
750
|
+
let O = d;
|
|
751
|
+
const j = () => Ot(m, M, 0, N, O), k = () => Ot(m, M, N + 1, m.length, O, !0);
|
|
752
|
+
f ? ({lineCount: M, removals: b} = j(), M > O && (h || (O -= 1), {lineCount: M, removals: G} = k())) : (h || (O -= 1), {lineCount: M, removals: G} = k(), M > O && (O -= 1, {lineCount: M, removals: b} = j())), b > 0 && (f = !0, m.splice(0, b)), G > 0 && (h = !0, m.splice(m.length - G, G));
|
|
785
753
|
}
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
-
for (const b of
|
|
789
|
-
return
|
|
754
|
+
const S = [];
|
|
755
|
+
f && S.push(l);
|
|
756
|
+
for (const b of m) for (const G of b) S.push(G);
|
|
757
|
+
return h && S.push(l), S;
|
|
790
758
|
};
|
|
791
|
-
const
|
|
792
|
-
const i =
|
|
793
|
-
return new
|
|
759
|
+
const ue = (t) => {
|
|
760
|
+
const i = t.active ?? "Yes", s = t.inactive ?? "No";
|
|
761
|
+
return new X({
|
|
794
762
|
active: i,
|
|
795
763
|
inactive: s,
|
|
796
|
-
signal:
|
|
797
|
-
input:
|
|
798
|
-
output:
|
|
799
|
-
initialValue:
|
|
764
|
+
signal: t.signal,
|
|
765
|
+
input: t.input,
|
|
766
|
+
output: t.output,
|
|
767
|
+
initialValue: t.initialValue ?? !0,
|
|
800
768
|
render() {
|
|
801
|
-
const r =
|
|
802
|
-
` : ""}${
|
|
803
|
-
`,
|
|
769
|
+
const r = t.withGuide ?? h.withGuide, u = `${P(this.state)} `, n = r ? `${styleText("gray", $)} ` : "", a = W(t.output, t.message, n, u), c = `${r ? `${styleText("gray", $)}
|
|
770
|
+
` : ""}${a}
|
|
771
|
+
`, o = this.value ? i : s;
|
|
804
772
|
switch (this.state) {
|
|
805
|
-
case "submit": return `${c}${r ? `${styleText("gray",
|
|
806
|
-
case "cancel": return `${c}${r ? `${styleText("gray",
|
|
807
|
-
${styleText("gray",
|
|
773
|
+
case "submit": return `${c}${r ? `${styleText("gray", $)} ` : ""}${styleText("dim", o)}`;
|
|
774
|
+
case "cancel": return `${c}${r ? `${styleText("gray", $)} ` : ""}${styleText(["strikethrough", "dim"], o)}${r ? `
|
|
775
|
+
${styleText("gray", $)}` : ""}`;
|
|
808
776
|
default: {
|
|
809
|
-
const l = r ? `${styleText("cyan",
|
|
810
|
-
return `${c}${l}${this.value ? `${styleText("green", z)} ${i}` : `${styleText("dim",
|
|
811
|
-
${styleText("cyan",
|
|
812
|
-
` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim",
|
|
813
|
-
${
|
|
777
|
+
const l = r ? `${styleText("cyan", $)} ` : "", d = r ? styleText("cyan", x) : "";
|
|
778
|
+
return `${c}${l}${this.value ? `${styleText("green", z)} ${i}` : `${styleText("dim", U)} ${styleText("dim", i)}`}${t.vertical ? r ? `
|
|
779
|
+
${styleText("cyan", $)} ` : `
|
|
780
|
+
` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", U)} ${styleText("dim", s)}` : `${styleText("green", z)} ${s}`}
|
|
781
|
+
${d}
|
|
814
782
|
`;
|
|
815
783
|
}
|
|
816
784
|
}
|
|
817
785
|
}
|
|
818
786
|
}).prompt();
|
|
819
|
-
},
|
|
820
|
-
message: (
|
|
821
|
-
const
|
|
822
|
-
for (let p = 0; p < u
|
|
823
|
-
const
|
|
787
|
+
}, R = {
|
|
788
|
+
message: (t = [], { symbol: i = styleText("gray", $), secondarySymbol: s = styleText("gray", $), output: r = process.stdout, spacing: u = 1, withGuide: n } = {}) => {
|
|
789
|
+
const a = [], c = n ?? h.withGuide, o = c ? s : "", l = c ? `${i} ` : "", d = c ? `${s} ` : "";
|
|
790
|
+
for (let p = 0; p < u; p++) a.push(o);
|
|
791
|
+
const g = Array.isArray(t) ? t : t.split(`
|
|
824
792
|
`);
|
|
825
|
-
if (
|
|
826
|
-
const [p, ...
|
|
827
|
-
p.length > 0 ?
|
|
828
|
-
for (const
|
|
793
|
+
if (g.length > 0) {
|
|
794
|
+
const [p, ...f] = g;
|
|
795
|
+
p.length > 0 ? a.push(`${l}${p}`) : a.push(c ? i : "");
|
|
796
|
+
for (const h of f) h.length > 0 ? a.push(`${d}${h}`) : a.push(c ? s : "");
|
|
829
797
|
}
|
|
830
|
-
r.write(`${
|
|
798
|
+
r.write(`${a.join(`
|
|
831
799
|
`)}
|
|
832
800
|
`);
|
|
833
801
|
},
|
|
834
|
-
info: (
|
|
835
|
-
|
|
802
|
+
info: (t, i) => {
|
|
803
|
+
R.message(t, {
|
|
836
804
|
...i,
|
|
837
|
-
symbol: styleText("blue",
|
|
805
|
+
symbol: styleText("blue", ht)
|
|
838
806
|
});
|
|
839
807
|
},
|
|
840
|
-
success: (
|
|
841
|
-
|
|
808
|
+
success: (t, i) => {
|
|
809
|
+
R.message(t, {
|
|
842
810
|
...i,
|
|
843
|
-
symbol: styleText("green",
|
|
811
|
+
symbol: styleText("green", pt)
|
|
844
812
|
});
|
|
845
813
|
},
|
|
846
|
-
step: (
|
|
847
|
-
|
|
814
|
+
step: (t, i) => {
|
|
815
|
+
R.message(t, {
|
|
848
816
|
...i,
|
|
849
|
-
symbol: styleText("green",
|
|
817
|
+
symbol: styleText("green", H)
|
|
850
818
|
});
|
|
851
819
|
},
|
|
852
|
-
warn: (
|
|
853
|
-
|
|
820
|
+
warn: (t, i) => {
|
|
821
|
+
R.message(t, {
|
|
854
822
|
...i,
|
|
855
|
-
symbol: styleText("yellow",
|
|
823
|
+
symbol: styleText("yellow", mt)
|
|
856
824
|
});
|
|
857
825
|
},
|
|
858
|
-
warning: (
|
|
859
|
-
|
|
826
|
+
warning: (t, i) => {
|
|
827
|
+
R.warn(t, i);
|
|
860
828
|
},
|
|
861
|
-
error: (
|
|
862
|
-
|
|
829
|
+
error: (t, i) => {
|
|
830
|
+
R.message(t, {
|
|
863
831
|
...i,
|
|
864
|
-
symbol: styleText("red",
|
|
832
|
+
symbol: styleText("red", gt)
|
|
865
833
|
});
|
|
866
834
|
}
|
|
867
|
-
},
|
|
868
|
-
const s = i?.output ?? process.stdout, r = i?.withGuide ??
|
|
869
|
-
s.write(`${r}${styleText("red",
|
|
835
|
+
}, me = (t = "", i) => {
|
|
836
|
+
const s = i?.output ?? process.stdout, r = i?.withGuide ?? h.withGuide ? `${styleText("gray", x)} ` : "";
|
|
837
|
+
s.write(`${r}${styleText("red", t)}
|
|
870
838
|
|
|
871
839
|
`);
|
|
872
|
-
},
|
|
873
|
-
const s = i?.output ?? process.stdout, r = i?.withGuide ??
|
|
874
|
-
s.write(`${r}${
|
|
840
|
+
}, ge = (t = "", i) => {
|
|
841
|
+
const s = i?.output ?? process.stdout, r = i?.withGuide ?? h.withGuide ? `${styleText("gray", lt)} ` : "";
|
|
842
|
+
s.write(`${r}${t}
|
|
875
843
|
`);
|
|
876
|
-
},
|
|
844
|
+
}, Te = (t) => styleText("magenta", t), ft = ({ indicator: t = "dots", onCancel: i, output: s = process.stdout, cancelMessage: r, errorMessage: u, frames: n = tt ? [
|
|
877
845
|
"◒",
|
|
878
846
|
"◐",
|
|
879
847
|
"◓",
|
|
@@ -883,232 +851,232 @@ ${$}
|
|
|
883
851
|
"o",
|
|
884
852
|
"O",
|
|
885
853
|
"0"
|
|
886
|
-
], delay:
|
|
887
|
-
const l =
|
|
888
|
-
let
|
|
889
|
-
const
|
|
890
|
-
const A = _ > 1 ? u
|
|
891
|
-
|
|
892
|
-
},
|
|
893
|
-
process.on("uncaughtExceptionMonitor",
|
|
894
|
-
}, G = () => {
|
|
895
|
-
process.removeListener("uncaughtExceptionMonitor", C), process.removeListener("unhandledRejection", C), process.removeListener("SIGINT", b), process.removeListener("SIGTERM", b), process.removeListener("exit", T), c && c.removeEventListener("abort", b);
|
|
854
|
+
], delay: a = tt ? 80 : 120, signal: c, ...o } = {}) => {
|
|
855
|
+
const l = ot();
|
|
856
|
+
let d, g, p = !1, f = !1, h$2 = "", I, m = performance.now();
|
|
857
|
+
const y = A(s), v = o?.styleFrame ?? Te, C = (_) => {
|
|
858
|
+
const A = _ > 1 ? u ?? h.messages.error : r ?? h.messages.cancel;
|
|
859
|
+
f = _ === 1, p && (W(A, _), f && typeof i == "function" && i());
|
|
860
|
+
}, S = () => C(2), b = () => C(1), G = () => {
|
|
861
|
+
process.on("uncaughtExceptionMonitor", S), process.on("unhandledRejection", S), process.on("SIGINT", b), process.on("SIGTERM", b), process.on("exit", C), c && c.addEventListener("abort", b);
|
|
896
862
|
}, M = () => {
|
|
897
|
-
|
|
863
|
+
process.removeListener("uncaughtExceptionMonitor", S), process.removeListener("unhandledRejection", S), process.removeListener("SIGINT", b), process.removeListener("SIGTERM", b), process.removeListener("exit", C), c && c.removeEventListener("abort", b);
|
|
864
|
+
}, N = () => {
|
|
865
|
+
if (I === void 0) return;
|
|
898
866
|
l && s.write(`
|
|
899
867
|
`);
|
|
900
|
-
const _ = wrapAnsi(
|
|
868
|
+
const _ = wrapAnsi(I, y, {
|
|
901
869
|
hard: !0,
|
|
902
870
|
trim: !1
|
|
903
871
|
}).split(`
|
|
904
872
|
`);
|
|
905
873
|
_.length > 1 && s.write(import_src.cursor.up(_.length - 1)), s.write(import_src.cursor.to(0)), s.write(import_src.erase.down());
|
|
906
|
-
},
|
|
907
|
-
const A = (performance.now() - _) / 1e3,
|
|
908
|
-
return
|
|
909
|
-
},
|
|
910
|
-
p = !0,
|
|
874
|
+
}, O = (_) => _.replace(/\.+$/, ""), j = (_) => {
|
|
875
|
+
const A = (performance.now() - _) / 1e3, L = Math.floor(A / 60), D = Math.floor(A % 60);
|
|
876
|
+
return L > 0 ? `[${L}m ${D}s]` : `[${D}s]`;
|
|
877
|
+
}, k = o.withGuide ?? h.withGuide, rt = (_ = "") => {
|
|
878
|
+
p = !0, d = R$1({ output: s }), h$2 = O(_), m = performance.now(), k && s.write(`${styleText("gray", $)}
|
|
911
879
|
`);
|
|
912
|
-
let A = 0,
|
|
913
|
-
|
|
914
|
-
if (l &&
|
|
915
|
-
|
|
916
|
-
const
|
|
880
|
+
let A = 0, L = 0;
|
|
881
|
+
G(), g = setInterval(() => {
|
|
882
|
+
if (l && h$2 === I) return;
|
|
883
|
+
N(), I = h$2;
|
|
884
|
+
const D = v(n[A]);
|
|
917
885
|
let Z;
|
|
918
|
-
if (l) Z = `${
|
|
919
|
-
else if (
|
|
886
|
+
if (l) Z = `${D} ${h$2}...`;
|
|
887
|
+
else if (t === "timer") Z = `${D} ${h$2} ${j(m)}`;
|
|
920
888
|
else {
|
|
921
|
-
const
|
|
922
|
-
Z = `${
|
|
889
|
+
const kt = ".".repeat(Math.floor(L)).slice(0, 3);
|
|
890
|
+
Z = `${D} ${h$2}${kt}`;
|
|
923
891
|
}
|
|
924
|
-
const
|
|
892
|
+
const Bt = wrapAnsi(Z, y, {
|
|
925
893
|
hard: !0,
|
|
926
894
|
trim: !1
|
|
927
895
|
});
|
|
928
|
-
s.write(
|
|
929
|
-
},
|
|
930
|
-
}, W = (_ = "", A = 0,
|
|
896
|
+
s.write(Bt), A = A + 1 < n.length ? A + 1 : 0, L = L < 4 ? L + .125 : 0;
|
|
897
|
+
}, a);
|
|
898
|
+
}, W = (_ = "", A = 0, L = !1) => {
|
|
931
899
|
if (!p) return;
|
|
932
|
-
p = !1, clearInterval(
|
|
933
|
-
const
|
|
934
|
-
|
|
935
|
-
`) : s.write(`${
|
|
936
|
-
`)),
|
|
900
|
+
p = !1, clearInterval(g), N();
|
|
901
|
+
const D = A === 0 ? styleText("green", H) : A === 1 ? styleText("red", at) : styleText("red", ut);
|
|
902
|
+
h$2 = _ ?? h$2, L || (t === "timer" ? s.write(`${D} ${h$2} ${j(m)}
|
|
903
|
+
`) : s.write(`${D} ${h$2}
|
|
904
|
+
`)), M(), d();
|
|
937
905
|
};
|
|
938
906
|
return {
|
|
939
|
-
start:
|
|
907
|
+
start: rt,
|
|
940
908
|
stop: (_ = "") => W(_, 0),
|
|
941
909
|
message: (_ = "") => {
|
|
942
|
-
|
|
910
|
+
h$2 = O(_ ?? h$2);
|
|
943
911
|
},
|
|
944
912
|
cancel: (_ = "") => W(_, 1),
|
|
945
913
|
error: (_ = "") => W(_, 2),
|
|
946
914
|
clear: () => W("", 0, !0),
|
|
947
915
|
get isCancelled() {
|
|
948
|
-
return
|
|
916
|
+
return f;
|
|
949
917
|
}
|
|
950
918
|
};
|
|
951
919
|
};
|
|
952
920
|
w("─", "-"), w("━", "="), w("█", "#");
|
|
953
|
-
const
|
|
954
|
-
`) ?
|
|
921
|
+
const it = (t, i) => t.includes(`
|
|
922
|
+
`) ? t.split(`
|
|
955
923
|
`).map((s) => i(s)).join(`
|
|
956
|
-
`) : i(
|
|
924
|
+
`) : i(t), xe = (t) => {
|
|
957
925
|
const i = (s, r) => {
|
|
958
926
|
const u = s.label ?? String(s.value);
|
|
959
927
|
switch (r) {
|
|
960
|
-
case "disabled": return `${styleText("gray",
|
|
961
|
-
case "selected": return `${
|
|
928
|
+
case "disabled": return `${styleText("gray", U)} ${it(u, (n) => styleText("gray", n))}${s.hint ? ` ${styleText("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
|
|
929
|
+
case "selected": return `${it(u, (n) => styleText("dim", n))}`;
|
|
962
930
|
case "active": return `${styleText("green", z)} ${u}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
|
|
963
|
-
case "cancelled": return `${
|
|
964
|
-
default: return `${styleText("dim",
|
|
931
|
+
case "cancelled": return `${it(u, (n) => styleText(["strikethrough", "dim"], n))}`;
|
|
932
|
+
default: return `${styleText("dim", U)} ${it(u, (n) => styleText("dim", n))}`;
|
|
965
933
|
}
|
|
966
934
|
};
|
|
967
|
-
return new
|
|
968
|
-
options:
|
|
969
|
-
signal:
|
|
970
|
-
input:
|
|
971
|
-
output:
|
|
972
|
-
initialValue:
|
|
935
|
+
return new ut$1({
|
|
936
|
+
options: t.options,
|
|
937
|
+
signal: t.signal,
|
|
938
|
+
input: t.input,
|
|
939
|
+
output: t.output,
|
|
940
|
+
initialValue: t.initialValue,
|
|
973
941
|
render() {
|
|
974
|
-
const s =
|
|
942
|
+
const s = t.withGuide ?? h.withGuide, r = `${P(this.state)} `, u = `${yt(this.state)} `, n = W(t.output, t.message, u, r), a = `${s ? `${styleText("gray", $)}
|
|
975
943
|
` : ""}${n}
|
|
976
944
|
`;
|
|
977
945
|
switch (this.state) {
|
|
978
946
|
case "submit": {
|
|
979
|
-
const c = s ? `${styleText("gray",
|
|
980
|
-
return `${
|
|
947
|
+
const c = s ? `${styleText("gray", $)} ` : "";
|
|
948
|
+
return `${a}${W(t.output, i(this.options[this.cursor], "selected"), c)}`;
|
|
981
949
|
}
|
|
982
950
|
case "cancel": {
|
|
983
|
-
const c = s ? `${styleText("gray",
|
|
984
|
-
return `${
|
|
985
|
-
${styleText("gray",
|
|
951
|
+
const c = s ? `${styleText("gray", $)} ` : "";
|
|
952
|
+
return `${a}${W(t.output, i(this.options[this.cursor], "cancelled"), c)}${s ? `
|
|
953
|
+
${styleText("gray", $)}` : ""}`;
|
|
986
954
|
}
|
|
987
955
|
default: {
|
|
988
|
-
const c = s ? `${styleText("cyan",
|
|
989
|
-
`).length,
|
|
990
|
-
return `${
|
|
991
|
-
output:
|
|
956
|
+
const c = s ? `${styleText("cyan", $)} ` : "", o = s ? styleText("cyan", x) : "", l = a.split(`
|
|
957
|
+
`).length, d = s ? 2 : 1;
|
|
958
|
+
return `${a}${c}${F({
|
|
959
|
+
output: t.output,
|
|
992
960
|
cursor: this.cursor,
|
|
993
961
|
options: this.options,
|
|
994
|
-
maxItems:
|
|
962
|
+
maxItems: t.maxItems,
|
|
995
963
|
columnPadding: c.length,
|
|
996
|
-
rowPadding: l +
|
|
997
|
-
style: (
|
|
964
|
+
rowPadding: l + d,
|
|
965
|
+
style: (g, p) => i(g, g.disabled ? "disabled" : p ? "active" : "inactive")
|
|
998
966
|
}).join(`
|
|
999
967
|
${c}`)}
|
|
1000
|
-
${
|
|
968
|
+
${o}
|
|
1001
969
|
`;
|
|
1002
970
|
}
|
|
1003
971
|
}
|
|
1004
972
|
}
|
|
1005
973
|
}).prompt();
|
|
1006
|
-
},
|
|
1007
|
-
message: async (
|
|
1008
|
-
process.stdout.write(`${styleText("gray",
|
|
974
|
+
}, Nt = `${styleText("gray", $)} `, q = {
|
|
975
|
+
message: async (t, { symbol: i = styleText("gray", $) } = {}) => {
|
|
976
|
+
process.stdout.write(`${styleText("gray", $)}
|
|
1009
977
|
${i} `);
|
|
1010
978
|
let s = 3;
|
|
1011
|
-
for await (let r of
|
|
979
|
+
for await (let r of t) {
|
|
1012
980
|
r = r.replace(/\n/g, `
|
|
1013
|
-
${
|
|
981
|
+
${Nt}`), r.includes(`
|
|
1014
982
|
`) && (s = 3 + stripVTControlCharacters(r.slice(r.lastIndexOf(`
|
|
1015
983
|
`))).length);
|
|
1016
984
|
const u = stripVTControlCharacters(r).length;
|
|
1017
985
|
s + u < process.stdout.columns ? (s += u, process.stdout.write(r)) : (process.stdout.write(`
|
|
1018
|
-
${
|
|
986
|
+
${Nt}${r.trimStart()}`), s = 3 + stripVTControlCharacters(r.trimStart()).length);
|
|
1019
987
|
}
|
|
1020
988
|
process.stdout.write(`
|
|
1021
989
|
`);
|
|
1022
990
|
},
|
|
1023
|
-
info: (
|
|
1024
|
-
success: (
|
|
1025
|
-
step: (
|
|
1026
|
-
warn: (
|
|
1027
|
-
warning: (
|
|
1028
|
-
error: (
|
|
1029
|
-
},
|
|
1030
|
-
validate:
|
|
1031
|
-
placeholder:
|
|
1032
|
-
defaultValue:
|
|
1033
|
-
initialValue:
|
|
1034
|
-
output:
|
|
1035
|
-
signal:
|
|
1036
|
-
input:
|
|
991
|
+
info: (t) => q.message(t, { symbol: styleText("blue", ht) }),
|
|
992
|
+
success: (t) => q.message(t, { symbol: styleText("green", pt) }),
|
|
993
|
+
step: (t) => q.message(t, { symbol: styleText("green", H) }),
|
|
994
|
+
warn: (t) => q.message(t, { symbol: styleText("yellow", mt) }),
|
|
995
|
+
warning: (t) => q.warn(t),
|
|
996
|
+
error: (t) => q.message(t, { symbol: styleText("red", gt) })
|
|
997
|
+
}, Pe = (t) => new ht$1({
|
|
998
|
+
validate: t.validate,
|
|
999
|
+
placeholder: t.placeholder,
|
|
1000
|
+
defaultValue: t.defaultValue,
|
|
1001
|
+
initialValue: t.initialValue,
|
|
1002
|
+
output: t.output,
|
|
1003
|
+
signal: t.signal,
|
|
1004
|
+
input: t.input,
|
|
1037
1005
|
render() {
|
|
1038
|
-
const i =
|
|
1039
|
-
` : ""}${
|
|
1040
|
-
`, r =
|
|
1006
|
+
const i = t?.withGuide ?? h.withGuide, s = `${`${i ? `${styleText("gray", $)}
|
|
1007
|
+
` : ""}${P(this.state)} `}${t.message}
|
|
1008
|
+
`, r = t.placeholder ? styleText("inverse", t.placeholder[0]) + styleText("dim", t.placeholder.slice(1)) : styleText(["inverse", "hidden"], "_"), u = this.userInput ? this.userInputWithCursor : r, n = this.value ?? "";
|
|
1041
1009
|
switch (this.state) {
|
|
1042
1010
|
case "error": {
|
|
1043
|
-
const
|
|
1011
|
+
const a = this.error ? ` ${styleText("yellow", this.error)}` : "", c = i ? `${styleText("yellow", $)} ` : "", o = i ? styleText("yellow", x) : "";
|
|
1044
1012
|
return `${s.trim()}
|
|
1045
|
-
${c}${u
|
|
1046
|
-
${
|
|
1013
|
+
${c}${u}
|
|
1014
|
+
${o}${a}
|
|
1047
1015
|
`;
|
|
1048
1016
|
}
|
|
1049
1017
|
case "submit": {
|
|
1050
|
-
const
|
|
1051
|
-
return `${s}${i ? styleText("gray",
|
|
1018
|
+
const a = n ? ` ${styleText("dim", n)}` : "";
|
|
1019
|
+
return `${s}${i ? styleText("gray", $) : ""}${a}`;
|
|
1052
1020
|
}
|
|
1053
1021
|
case "cancel": {
|
|
1054
|
-
const
|
|
1055
|
-
return `${s}${c}${
|
|
1022
|
+
const a = n ? ` ${styleText(["strikethrough", "dim"], n)}` : "", c = i ? styleText("gray", $) : "";
|
|
1023
|
+
return `${s}${c}${a}${n.trim() ? `
|
|
1056
1024
|
${c}` : ""}`;
|
|
1057
1025
|
}
|
|
1058
|
-
default: return `${s}${i ? `${styleText("cyan",
|
|
1059
|
-
${i ? styleText("cyan",
|
|
1026
|
+
default: return `${s}${i ? `${styleText("cyan", $)} ` : ""}${u}
|
|
1027
|
+
${i ? styleText("cyan", x) : ""}
|
|
1060
1028
|
`;
|
|
1061
1029
|
}
|
|
1062
1030
|
}
|
|
1063
1031
|
}).prompt();
|
|
1064
1032
|
//#endregion
|
|
1065
|
-
//#region
|
|
1033
|
+
//#region packages/create-vorma/main.ts
|
|
1066
1034
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
1067
1035
|
async function main() {
|
|
1068
1036
|
const isLocalTest = process.argv.slice(2).includes("--local-test");
|
|
1069
1037
|
console.log();
|
|
1070
|
-
|
|
1038
|
+
ge("Welcome to the Vorma new app creator!");
|
|
1071
1039
|
let goVersion = "";
|
|
1072
1040
|
try {
|
|
1073
1041
|
goVersion = execSync("go version", { encoding: "utf8" }).trim();
|
|
1074
1042
|
const versionMatch = goVersion.match(/go(\d+)\.(\d+)/);
|
|
1075
1043
|
if (versionMatch) {
|
|
1076
1044
|
if (!versionMatch[1] || !versionMatch[2]) {
|
|
1077
|
-
|
|
1045
|
+
me("Go version not recognized. Please ensure Go is installed correctly. See https://go.dev/doc/install for installation instructions.");
|
|
1078
1046
|
process.exit(1);
|
|
1079
1047
|
}
|
|
1080
1048
|
const major = parseInt(versionMatch[1]);
|
|
1081
1049
|
const minor = parseInt(versionMatch[2]);
|
|
1082
1050
|
if (major < 1 || major === 1 && minor < 24) {
|
|
1083
|
-
|
|
1051
|
+
me("Go version 1.24 or higher is required. See https://go.dev/doc/install for installation instructions.");
|
|
1084
1052
|
process.exit(1);
|
|
1085
1053
|
}
|
|
1086
1054
|
}
|
|
1087
1055
|
} catch {
|
|
1088
|
-
|
|
1056
|
+
me("Go is not installed. See https://go.dev/doc/install for installation instructions.");
|
|
1089
1057
|
process.exit(1);
|
|
1090
1058
|
}
|
|
1091
1059
|
const firstPart = process.version.split(".")[0];
|
|
1092
1060
|
if (!firstPart || firstPart.length < 2 || !firstPart.startsWith("v")) {
|
|
1093
|
-
|
|
1061
|
+
me("Node.js version not recognized. Please ensure Node.js is installed correctly.");
|
|
1094
1062
|
process.exit(1);
|
|
1095
1063
|
}
|
|
1096
1064
|
const nodeMajor = parseInt(firstPart.substring(1));
|
|
1097
1065
|
if (nodeMajor < 22) {
|
|
1098
|
-
|
|
1066
|
+
me("Node.js version 22.11 or higher is required");
|
|
1099
1067
|
process.exit(1);
|
|
1100
1068
|
}
|
|
1101
|
-
const createNewDir = await
|
|
1069
|
+
const createNewDir = await ue({
|
|
1102
1070
|
message: "Create a new directory for your Vorma app?",
|
|
1103
1071
|
initialValue: true
|
|
1104
1072
|
});
|
|
1105
|
-
if (q(createNewDir)) {
|
|
1106
|
-
|
|
1073
|
+
if (q$1(createNewDir)) {
|
|
1074
|
+
me("Operation cancelled");
|
|
1107
1075
|
process.exit(0);
|
|
1108
1076
|
}
|
|
1109
1077
|
let targetDir = process.cwd();
|
|
1110
1078
|
if (createNewDir) {
|
|
1111
|
-
const dirName = await
|
|
1079
|
+
const dirName = await Pe({
|
|
1112
1080
|
message: "Enter directory name:",
|
|
1113
1081
|
validate: (value) => {
|
|
1114
1082
|
if (!value || value.trim() === "") return "Directory name is required";
|
|
@@ -1117,14 +1085,14 @@ async function main() {
|
|
|
1117
1085
|
if (fs.existsSync(proposedPath)) return `Directory "${value}" already exists`;
|
|
1118
1086
|
}
|
|
1119
1087
|
});
|
|
1120
|
-
if (q(dirName)) {
|
|
1121
|
-
|
|
1088
|
+
if (q$1(dirName)) {
|
|
1089
|
+
me("Operation cancelled");
|
|
1122
1090
|
process.exit(0);
|
|
1123
1091
|
}
|
|
1124
1092
|
targetDir = path.join(process.cwd(), dirName);
|
|
1125
1093
|
fs.mkdirSync(targetDir, { recursive: true });
|
|
1126
1094
|
process.chdir(targetDir);
|
|
1127
|
-
|
|
1095
|
+
R.success(`Created directory: ${dirName}`);
|
|
1128
1096
|
}
|
|
1129
1097
|
let goModPath = null;
|
|
1130
1098
|
let moduleRoot = null;
|
|
@@ -1143,7 +1111,7 @@ async function main() {
|
|
|
1143
1111
|
if (goModPath) {
|
|
1144
1112
|
const moduleMatch = fs.readFileSync(goModPath, "utf8").match(/^module\s+(.+)$/m);
|
|
1145
1113
|
if (moduleMatch && moduleMatch[1]) moduleName = moduleMatch[1].trim();
|
|
1146
|
-
const moduleChoice = await
|
|
1114
|
+
const moduleChoice = await xe({
|
|
1147
1115
|
message: `Found parent Go module: ${moduleName}`,
|
|
1148
1116
|
options: [{
|
|
1149
1117
|
value: "new",
|
|
@@ -1153,8 +1121,8 @@ async function main() {
|
|
|
1153
1121
|
label: "Use parent go.mod"
|
|
1154
1122
|
}]
|
|
1155
1123
|
});
|
|
1156
|
-
if (q(moduleChoice)) {
|
|
1157
|
-
|
|
1124
|
+
if (q$1(moduleChoice)) {
|
|
1125
|
+
me("Operation cancelled");
|
|
1158
1126
|
process.exit(0);
|
|
1159
1127
|
}
|
|
1160
1128
|
if (moduleChoice === "new") {
|
|
@@ -1165,36 +1133,36 @@ async function main() {
|
|
|
1165
1133
|
}
|
|
1166
1134
|
} else createNewModule = true;
|
|
1167
1135
|
if (createNewModule) {
|
|
1168
|
-
const modNameInput = await
|
|
1136
|
+
const modNameInput = await Pe({
|
|
1169
1137
|
message: "Enter module name (e.g., \"myapp\" or \"github.com/user/myapp\"):",
|
|
1170
1138
|
validate: (value) => {
|
|
1171
1139
|
if (!value || value.trim() === "") return "Module name is required";
|
|
1172
1140
|
}
|
|
1173
1141
|
});
|
|
1174
|
-
if (q(modNameInput)) {
|
|
1175
|
-
|
|
1142
|
+
if (q$1(modNameInput)) {
|
|
1143
|
+
me("Operation cancelled");
|
|
1176
1144
|
process.exit(0);
|
|
1177
1145
|
}
|
|
1178
1146
|
moduleName = modNameInput;
|
|
1179
1147
|
moduleRoot = process.cwd();
|
|
1180
|
-
const s =
|
|
1148
|
+
const s = ft();
|
|
1181
1149
|
s.start("Initializing Go module");
|
|
1182
1150
|
try {
|
|
1183
1151
|
execSync(`go mod init ${moduleName}`, { cwd: moduleRoot });
|
|
1184
1152
|
if (isLocalTest) {
|
|
1185
1153
|
execSync(`go mod edit -replace github.com/vormadev/vorma=${path.resolve(__dirname, "../../../../../")}`, { cwd: moduleRoot });
|
|
1186
|
-
|
|
1154
|
+
R.info("Using local Vorma code for testing");
|
|
1187
1155
|
}
|
|
1188
1156
|
s.stop("Go module initialized");
|
|
1189
1157
|
} catch (error) {
|
|
1190
1158
|
s.stop("Failed to initialize module");
|
|
1191
|
-
|
|
1159
|
+
me(`Error: ${error}`);
|
|
1192
1160
|
process.exit(1);
|
|
1193
1161
|
}
|
|
1194
1162
|
}
|
|
1195
1163
|
const underscoreSegments = (moduleRoot ? path.relative(moduleRoot, process.cwd()) : "").split(path.sep).filter((seg) => seg.length > 0).filter((seg) => seg.startsWith("_"));
|
|
1196
1164
|
if (underscoreSegments.length > 0) {
|
|
1197
|
-
|
|
1165
|
+
me(`Cannot create Vorma app in a path containing directories that start with underscores:\n ${underscoreSegments.join(", ")}\n Go ignores directories starting with underscores, which will cause build issues.`);
|
|
1198
1166
|
process.exit(1);
|
|
1199
1167
|
}
|
|
1200
1168
|
let importPath = moduleName;
|
|
@@ -1202,7 +1170,7 @@ async function main() {
|
|
|
1202
1170
|
const relativePath = path.relative(moduleRoot, process.cwd());
|
|
1203
1171
|
importPath = path.posix.join(moduleName, ...relativePath.split(path.sep));
|
|
1204
1172
|
}
|
|
1205
|
-
const uiVariant = await
|
|
1173
|
+
const uiVariant = await xe({
|
|
1206
1174
|
message: "Choose frontend UI library:",
|
|
1207
1175
|
options: [
|
|
1208
1176
|
{
|
|
@@ -1219,11 +1187,11 @@ async function main() {
|
|
|
1219
1187
|
}
|
|
1220
1188
|
]
|
|
1221
1189
|
});
|
|
1222
|
-
if (q(uiVariant)) {
|
|
1223
|
-
|
|
1190
|
+
if (q$1(uiVariant)) {
|
|
1191
|
+
me("Operation cancelled");
|
|
1224
1192
|
process.exit(0);
|
|
1225
1193
|
}
|
|
1226
|
-
const packageManager = await
|
|
1194
|
+
const packageManager = await xe({
|
|
1227
1195
|
message: "Choose JS package manager:",
|
|
1228
1196
|
options: [
|
|
1229
1197
|
{
|
|
@@ -1244,11 +1212,11 @@ async function main() {
|
|
|
1244
1212
|
}
|
|
1245
1213
|
]
|
|
1246
1214
|
});
|
|
1247
|
-
if (q(packageManager)) {
|
|
1248
|
-
|
|
1215
|
+
if (q$1(packageManager)) {
|
|
1216
|
+
me("Operation cancelled");
|
|
1249
1217
|
process.exit(0);
|
|
1250
1218
|
}
|
|
1251
|
-
const deploymentTarget = await
|
|
1219
|
+
const deploymentTarget = await xe({
|
|
1252
1220
|
message: "Choose deployment target:",
|
|
1253
1221
|
options: [
|
|
1254
1222
|
{
|
|
@@ -1265,16 +1233,16 @@ async function main() {
|
|
|
1265
1233
|
}
|
|
1266
1234
|
]
|
|
1267
1235
|
});
|
|
1268
|
-
if (q(deploymentTarget)) {
|
|
1269
|
-
|
|
1236
|
+
if (q$1(deploymentTarget)) {
|
|
1237
|
+
me("Operation cancelled");
|
|
1270
1238
|
process.exit(0);
|
|
1271
1239
|
}
|
|
1272
|
-
const includeTailwind = await
|
|
1240
|
+
const includeTailwind = await ue({
|
|
1273
1241
|
message: "Include Tailwind CSS?",
|
|
1274
1242
|
initialValue: false
|
|
1275
1243
|
});
|
|
1276
|
-
if (q(includeTailwind)) {
|
|
1277
|
-
|
|
1244
|
+
if (q$1(includeTailwind)) {
|
|
1245
|
+
me("Operation cancelled");
|
|
1278
1246
|
process.exit(0);
|
|
1279
1247
|
}
|
|
1280
1248
|
console.log();
|
|
@@ -1322,7 +1290,7 @@ func main() {
|
|
|
1322
1290
|
throw error;
|
|
1323
1291
|
}
|
|
1324
1292
|
} catch (error) {
|
|
1325
|
-
|
|
1293
|
+
me(`Error: ${error}`);
|
|
1326
1294
|
process.exit(1);
|
|
1327
1295
|
} finally {
|
|
1328
1296
|
try {
|