@wix/cli-app 1.1.58 → 1.1.60
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/build/{CreateVersionCommand-NNN5WEDG.js → CreateVersionCommand-Z6F5IKH5.js} +16 -16
- package/build/{DevCommand-DTV4QLZX.js → DevCommand-YFEZ4QV5.js} +15 -15
- package/build/DevCommand-YFEZ4QV5.js.map +1 -0
- package/build/{GenerateCommand-3EILY6GU.js → GenerateCommand-KCV4YDNN.js} +303 -183
- package/build/GenerateCommand-KCV4YDNN.js.map +1 -0
- package/build/{LogsCommand-GBLWWXA4.js → LogsCommand-VBMGVYNU.js} +4 -4
- package/build/PreviewCommand-3OMHWDW6.js +23 -0
- package/build/ReleaseCommand-5F3FPBXT.js +91 -0
- package/build/ReleaseCommand-5F3FPBXT.js.map +1 -0
- package/build/{ServeCommand-HBKGVBCD.js → ServeCommand-G4FF4PT3.js} +13 -13
- package/build/{build-NYCCEFPM.js → build-XZI3USNB.js} +10 -9
- package/build/build-XZI3USNB.js.map +1 -0
- package/build/{chunk-RFDDKVTR.js → chunk-2PTCXTKF.js} +5 -5
- package/build/{chunk-2ROHQF53.js → chunk-36W5H7IG.js} +484 -486
- package/build/chunk-36W5H7IG.js.map +1 -0
- package/build/{chunk-CDB46GX7.js → chunk-4VTDNX5T.js} +2 -2
- package/build/{chunk-FQ554CIC.js → chunk-5QZS3HT7.js} +3 -3
- package/build/{chunk-DKKXEKW7.js → chunk-7CGRTCDC.js} +3 -3
- package/build/{chunk-MVNY3M6D.js → chunk-CNZ3Q5PF.js} +5 -5
- package/build/{chunk-P5P6YINI.js → chunk-DGTJGIY2.js} +2466 -1175
- package/build/chunk-DGTJGIY2.js.map +1 -0
- package/build/{chunk-XIKZ45R2.js → chunk-FTC5AK3Y.js} +56 -12
- package/build/chunk-FTC5AK3Y.js.map +1 -0
- package/build/{chunk-UGZFZOEU.js → chunk-HUWYF2ET.js} +8 -8
- package/build/{chunk-ZDKKDXHS.js → chunk-IG6IV6VM.js} +3 -3
- package/build/{chunk-XRPBC4UX.js → chunk-O42QDBJU.js} +3 -3
- package/build/{chunk-PUIMS4NQ.js → chunk-PKSGXFYA.js} +3 -3
- package/build/{chunk-SE6QML7T.js → chunk-QVGYU6D4.js} +17 -7
- package/build/chunk-QVGYU6D4.js.map +1 -0
- package/build/{chunk-QVLKHYBX.js → chunk-USAOCISL.js} +3 -3
- package/build/{chunk-JSDDG7MC.js → chunk-VXE3IWKR.js} +2 -2
- package/build/{chunk-NTTJJSCK.js → chunk-VZJZSWRE.js} +3 -3
- package/build/{chunk-IWJPJJEU.js → chunk-WRPV7SLY.js} +2067 -370
- package/build/chunk-WRPV7SLY.js.map +1 -0
- package/build/{chunk-TQB6XTPS.js → chunk-WRWNJYKZ.js} +6 -3
- package/build/chunk-WRWNJYKZ.js.map +1 -0
- package/build/cloudflare-runtime/entry.js +314 -253
- package/build/cloudflare-runtime/getRegisteredExtensions.js +21 -273
- package/build/index.js +444 -134
- package/build/index.js.map +1 -1
- package/build/platform-sdk/chunk-42XIZ4MH.js +2 -0
- package/build/platform-sdk/chunk-42XIZ4MH.js.map +1 -0
- package/build/platform-sdk/chunk-7EYXEF6M.js +2 -0
- package/build/platform-sdk/chunk-7EYXEF6M.js.map +1 -0
- package/build/platform-sdk/chunk-EERHWVVD.js +2 -0
- package/build/platform-sdk/chunk-EERHWVVD.js.map +1 -0
- package/build/platform-sdk/chunk-QV4VBCJB.js +2 -0
- package/build/platform-sdk/chunk-QV4VBCJB.js.map +1 -0
- package/build/platform-sdk/dashboard.js +1 -1
- package/build/platform-sdk/dashboard.js.map +1 -1
- package/build/platform-sdk/editor.js +4 -4
- package/build/platform-sdk/editor.js.map +1 -1
- package/build/platform-sdk/sdk-context.js +2 -0
- package/build/platform-sdk/sdk-context.js.map +1 -0
- package/build/platform-sdk/site.js +1 -1
- package/build/platform-sdk/site.js.map +1 -1
- package/build/platform-sdk/web-methods.js +2 -0
- package/build/platform-sdk/web-methods.js.map +1 -0
- package/build/{preview-CCEFGOHW.js → preview-VAHHFTRZ.js} +13 -13
- package/build/preview-VAHHFTRZ.js.map +1 -0
- package/build/{render-command-T2HCJX3F.js → render-command-3AYSQXHN.js} +6 -6
- package/package.json +14 -11
- package/schemas/site-plugin.json +1 -1
- package/schemas/wix-config.json +1 -1
- package/templates/web-method/files/placeholder.ts.ejs +17 -0
- package/build/DevCommand-DTV4QLZX.js.map +0 -1
- package/build/GenerateCommand-3EILY6GU.js.map +0 -1
- package/build/PreviewCommand-A2C52TVM.js +0 -23
- package/build/build-NYCCEFPM.js.map +0 -1
- package/build/chunk-2ROHQF53.js.map +0 -1
- package/build/chunk-IWJPJJEU.js.map +0 -1
- package/build/chunk-P5P6YINI.js.map +0 -1
- package/build/chunk-SE6QML7T.js.map +0 -1
- package/build/chunk-TQB6XTPS.js.map +0 -1
- package/build/chunk-XIKZ45R2.js.map +0 -1
- package/build/platform-sdk/chunk-DGX4CFXG.js +0 -2
- package/build/platform-sdk/chunk-DGX4CFXG.js.map +0 -1
- package/build/platform-sdk/chunk-TN6HYRXL.js +0 -2
- package/build/platform-sdk/chunk-TN6HYRXL.js.map +0 -1
- package/build/preview-CCEFGOHW.js.map +0 -1
- /package/build/{CreateVersionCommand-NNN5WEDG.js.map → CreateVersionCommand-Z6F5IKH5.js.map} +0 -0
- /package/build/{LogsCommand-GBLWWXA4.js.map → LogsCommand-VBMGVYNU.js.map} +0 -0
- /package/build/{PreviewCommand-A2C52TVM.js.map → PreviewCommand-3OMHWDW6.js.map} +0 -0
- /package/build/{ServeCommand-HBKGVBCD.js.map → ServeCommand-G4FF4PT3.js.map} +0 -0
- /package/build/{chunk-RFDDKVTR.js.map → chunk-2PTCXTKF.js.map} +0 -0
- /package/build/{chunk-CDB46GX7.js.map → chunk-4VTDNX5T.js.map} +0 -0
- /package/build/{chunk-FQ554CIC.js.map → chunk-5QZS3HT7.js.map} +0 -0
- /package/build/{chunk-DKKXEKW7.js.map → chunk-7CGRTCDC.js.map} +0 -0
- /package/build/{chunk-MVNY3M6D.js.map → chunk-CNZ3Q5PF.js.map} +0 -0
- /package/build/{chunk-UGZFZOEU.js.map → chunk-HUWYF2ET.js.map} +0 -0
- /package/build/{chunk-ZDKKDXHS.js.map → chunk-IG6IV6VM.js.map} +0 -0
- /package/build/{chunk-XRPBC4UX.js.map → chunk-O42QDBJU.js.map} +0 -0
- /package/build/{chunk-PUIMS4NQ.js.map → chunk-PKSGXFYA.js.map} +0 -0
- /package/build/{chunk-QVLKHYBX.js.map → chunk-USAOCISL.js.map} +0 -0
- /package/build/{chunk-JSDDG7MC.js.map → chunk-VXE3IWKR.js.map} +0 -0
- /package/build/{chunk-NTTJJSCK.js.map → chunk-VZJZSWRE.js.map} +0 -0
- /package/build/{render-command-T2HCJX3F.js.map → render-command-3AYSQXHN.js.map} +0 -0
package/build/index.js
CHANGED
|
@@ -2,13 +2,13 @@ import { createRequire as _createRequire } from 'node:module';
|
|
|
2
2
|
const require = _createRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
createI18nT
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-O42QDBJU.js";
|
|
6
|
+
import "./chunk-QVGYU6D4.js";
|
|
7
7
|
import {
|
|
8
8
|
require_react,
|
|
9
9
|
version,
|
|
10
10
|
z
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-36W5H7IG.js";
|
|
12
12
|
import {
|
|
13
13
|
__commonJS,
|
|
14
14
|
__require,
|
|
@@ -191,10 +191,22 @@ var require_help = __commonJS({
|
|
|
191
191
|
var Help2 = class {
|
|
192
192
|
constructor() {
|
|
193
193
|
this.helpWidth = void 0;
|
|
194
|
+
this.minWidthToWrap = 40;
|
|
194
195
|
this.sortSubcommands = false;
|
|
195
196
|
this.sortOptions = false;
|
|
196
197
|
this.showGlobalOptions = false;
|
|
197
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* prepareContext is called by Commander after applying overrides from `Command.configureHelp()`
|
|
201
|
+
* and just before calling `formatHelp()`.
|
|
202
|
+
*
|
|
203
|
+
* Commander just uses the helpWidth and the rest is provided for optional use by more complex subclasses.
|
|
204
|
+
*
|
|
205
|
+
* @param {{ error?: boolean, helpWidth?: number, outputHasColors?: boolean }} contextOptions
|
|
206
|
+
*/
|
|
207
|
+
prepareContext(contextOptions) {
|
|
208
|
+
this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;
|
|
209
|
+
}
|
|
198
210
|
/**
|
|
199
211
|
* Get an array of the visible subcommands. Includes a placeholder for the implicit help command, if there is one.
|
|
200
212
|
*
|
|
@@ -331,7 +343,12 @@ var require_help = __commonJS({
|
|
|
331
343
|
*/
|
|
332
344
|
longestSubcommandTermLength(cmd, helper) {
|
|
333
345
|
return helper.visibleCommands(cmd).reduce((max, command) => {
|
|
334
|
-
return Math.max(
|
|
346
|
+
return Math.max(
|
|
347
|
+
max,
|
|
348
|
+
this.displayWidth(
|
|
349
|
+
helper.styleSubcommandTerm(helper.subcommandTerm(command))
|
|
350
|
+
)
|
|
351
|
+
);
|
|
335
352
|
}, 0);
|
|
336
353
|
}
|
|
337
354
|
/**
|
|
@@ -343,7 +360,10 @@ var require_help = __commonJS({
|
|
|
343
360
|
*/
|
|
344
361
|
longestOptionTermLength(cmd, helper) {
|
|
345
362
|
return helper.visibleOptions(cmd).reduce((max, option) => {
|
|
346
|
-
return Math.max(
|
|
363
|
+
return Math.max(
|
|
364
|
+
max,
|
|
365
|
+
this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option)))
|
|
366
|
+
);
|
|
347
367
|
}, 0);
|
|
348
368
|
}
|
|
349
369
|
/**
|
|
@@ -355,7 +375,10 @@ var require_help = __commonJS({
|
|
|
355
375
|
*/
|
|
356
376
|
longestGlobalOptionTermLength(cmd, helper) {
|
|
357
377
|
return helper.visibleGlobalOptions(cmd).reduce((max, option) => {
|
|
358
|
-
return Math.max(
|
|
378
|
+
return Math.max(
|
|
379
|
+
max,
|
|
380
|
+
this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option)))
|
|
381
|
+
);
|
|
359
382
|
}, 0);
|
|
360
383
|
}
|
|
361
384
|
/**
|
|
@@ -367,7 +390,12 @@ var require_help = __commonJS({
|
|
|
367
390
|
*/
|
|
368
391
|
longestArgumentTermLength(cmd, helper) {
|
|
369
392
|
return helper.visibleArguments(cmd).reduce((max, argument) => {
|
|
370
|
-
return Math.max(
|
|
393
|
+
return Math.max(
|
|
394
|
+
max,
|
|
395
|
+
this.displayWidth(
|
|
396
|
+
helper.styleArgumentTerm(helper.argumentTerm(argument))
|
|
397
|
+
)
|
|
398
|
+
);
|
|
371
399
|
}, 0);
|
|
372
400
|
}
|
|
373
401
|
/**
|
|
@@ -459,11 +487,11 @@ var require_help = __commonJS({
|
|
|
459
487
|
);
|
|
460
488
|
}
|
|
461
489
|
if (extraInfo.length > 0) {
|
|
462
|
-
const
|
|
490
|
+
const extraDescription = `(${extraInfo.join(", ")})`;
|
|
463
491
|
if (argument.description) {
|
|
464
|
-
return `${argument.description} ${
|
|
492
|
+
return `${argument.description} ${extraDescription}`;
|
|
465
493
|
}
|
|
466
|
-
return
|
|
494
|
+
return extraDescription;
|
|
467
495
|
}
|
|
468
496
|
return argument.description;
|
|
469
497
|
}
|
|
@@ -476,75 +504,148 @@ var require_help = __commonJS({
|
|
|
476
504
|
*/
|
|
477
505
|
formatHelp(cmd, helper) {
|
|
478
506
|
const termWidth = helper.padWidth(cmd, helper);
|
|
479
|
-
const helpWidth = helper.helpWidth
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
helpWidth - itemIndentWidth,
|
|
488
|
-
termWidth + itemSeparatorWidth
|
|
489
|
-
);
|
|
490
|
-
}
|
|
491
|
-
return term;
|
|
492
|
-
}
|
|
493
|
-
function formatList(textArray) {
|
|
494
|
-
return textArray.join("\n").replace(/^/gm, " ".repeat(itemIndentWidth));
|
|
495
|
-
}
|
|
496
|
-
let output = [`Usage: ${helper.commandUsage(cmd)}`, ""];
|
|
507
|
+
const helpWidth = helper.helpWidth ?? 80;
|
|
508
|
+
function callFormatItem(term, description) {
|
|
509
|
+
return helper.formatItem(term, termWidth, description, helper);
|
|
510
|
+
}
|
|
511
|
+
let output = [
|
|
512
|
+
`${helper.styleTitle("Usage:")} ${helper.styleUsage(helper.commandUsage(cmd))}`,
|
|
513
|
+
""
|
|
514
|
+
];
|
|
497
515
|
const commandDescription = helper.commandDescription(cmd);
|
|
498
516
|
if (commandDescription.length > 0) {
|
|
499
517
|
output = output.concat([
|
|
500
|
-
helper.
|
|
518
|
+
helper.boxWrap(
|
|
519
|
+
helper.styleCommandDescription(commandDescription),
|
|
520
|
+
helpWidth
|
|
521
|
+
),
|
|
501
522
|
""
|
|
502
523
|
]);
|
|
503
524
|
}
|
|
504
525
|
const argumentList = helper.visibleArguments(cmd).map((argument) => {
|
|
505
|
-
return
|
|
506
|
-
helper.argumentTerm(argument),
|
|
507
|
-
helper.argumentDescription(argument)
|
|
526
|
+
return callFormatItem(
|
|
527
|
+
helper.styleArgumentTerm(helper.argumentTerm(argument)),
|
|
528
|
+
helper.styleArgumentDescription(helper.argumentDescription(argument))
|
|
508
529
|
);
|
|
509
530
|
});
|
|
510
531
|
if (argumentList.length > 0) {
|
|
511
|
-
output = output.concat([
|
|
532
|
+
output = output.concat([
|
|
533
|
+
helper.styleTitle("Arguments:"),
|
|
534
|
+
...argumentList,
|
|
535
|
+
""
|
|
536
|
+
]);
|
|
512
537
|
}
|
|
513
538
|
const optionList = helper.visibleOptions(cmd).map((option) => {
|
|
514
|
-
return
|
|
515
|
-
helper.optionTerm(option),
|
|
516
|
-
helper.optionDescription(option)
|
|
539
|
+
return callFormatItem(
|
|
540
|
+
helper.styleOptionTerm(helper.optionTerm(option)),
|
|
541
|
+
helper.styleOptionDescription(helper.optionDescription(option))
|
|
517
542
|
);
|
|
518
543
|
});
|
|
519
544
|
if (optionList.length > 0) {
|
|
520
|
-
output = output.concat([
|
|
545
|
+
output = output.concat([
|
|
546
|
+
helper.styleTitle("Options:"),
|
|
547
|
+
...optionList,
|
|
548
|
+
""
|
|
549
|
+
]);
|
|
521
550
|
}
|
|
522
|
-
if (
|
|
551
|
+
if (helper.showGlobalOptions) {
|
|
523
552
|
const globalOptionList = helper.visibleGlobalOptions(cmd).map((option) => {
|
|
524
|
-
return
|
|
525
|
-
helper.optionTerm(option),
|
|
526
|
-
helper.optionDescription(option)
|
|
553
|
+
return callFormatItem(
|
|
554
|
+
helper.styleOptionTerm(helper.optionTerm(option)),
|
|
555
|
+
helper.styleOptionDescription(helper.optionDescription(option))
|
|
527
556
|
);
|
|
528
557
|
});
|
|
529
558
|
if (globalOptionList.length > 0) {
|
|
530
559
|
output = output.concat([
|
|
531
|
-
"Global Options:",
|
|
532
|
-
|
|
560
|
+
helper.styleTitle("Global Options:"),
|
|
561
|
+
...globalOptionList,
|
|
533
562
|
""
|
|
534
563
|
]);
|
|
535
564
|
}
|
|
536
565
|
}
|
|
537
566
|
const commandList = helper.visibleCommands(cmd).map((cmd2) => {
|
|
538
|
-
return
|
|
539
|
-
helper.subcommandTerm(cmd2),
|
|
540
|
-
helper.subcommandDescription(cmd2)
|
|
567
|
+
return callFormatItem(
|
|
568
|
+
helper.styleSubcommandTerm(helper.subcommandTerm(cmd2)),
|
|
569
|
+
helper.styleSubcommandDescription(helper.subcommandDescription(cmd2))
|
|
541
570
|
);
|
|
542
571
|
});
|
|
543
572
|
if (commandList.length > 0) {
|
|
544
|
-
output = output.concat([
|
|
573
|
+
output = output.concat([
|
|
574
|
+
helper.styleTitle("Commands:"),
|
|
575
|
+
...commandList,
|
|
576
|
+
""
|
|
577
|
+
]);
|
|
545
578
|
}
|
|
546
579
|
return output.join("\n");
|
|
547
580
|
}
|
|
581
|
+
/**
|
|
582
|
+
* Return display width of string, ignoring ANSI escape sequences. Used in padding and wrapping calculations.
|
|
583
|
+
*
|
|
584
|
+
* @param {string} str
|
|
585
|
+
* @returns {number}
|
|
586
|
+
*/
|
|
587
|
+
displayWidth(str) {
|
|
588
|
+
return stripColor(str).length;
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Style the title for displaying in the help. Called with 'Usage:', 'Options:', etc.
|
|
592
|
+
*
|
|
593
|
+
* @param {string} str
|
|
594
|
+
* @returns {string}
|
|
595
|
+
*/
|
|
596
|
+
styleTitle(str) {
|
|
597
|
+
return str;
|
|
598
|
+
}
|
|
599
|
+
styleUsage(str) {
|
|
600
|
+
return str.split(" ").map((word) => {
|
|
601
|
+
if (word === "[options]") return this.styleOptionText(word);
|
|
602
|
+
if (word === "[command]") return this.styleSubcommandText(word);
|
|
603
|
+
if (word[0] === "[" || word[0] === "<")
|
|
604
|
+
return this.styleArgumentText(word);
|
|
605
|
+
return this.styleCommandText(word);
|
|
606
|
+
}).join(" ");
|
|
607
|
+
}
|
|
608
|
+
styleCommandDescription(str) {
|
|
609
|
+
return this.styleDescriptionText(str);
|
|
610
|
+
}
|
|
611
|
+
styleOptionDescription(str) {
|
|
612
|
+
return this.styleDescriptionText(str);
|
|
613
|
+
}
|
|
614
|
+
styleSubcommandDescription(str) {
|
|
615
|
+
return this.styleDescriptionText(str);
|
|
616
|
+
}
|
|
617
|
+
styleArgumentDescription(str) {
|
|
618
|
+
return this.styleDescriptionText(str);
|
|
619
|
+
}
|
|
620
|
+
styleDescriptionText(str) {
|
|
621
|
+
return str;
|
|
622
|
+
}
|
|
623
|
+
styleOptionTerm(str) {
|
|
624
|
+
return this.styleOptionText(str);
|
|
625
|
+
}
|
|
626
|
+
styleSubcommandTerm(str) {
|
|
627
|
+
return str.split(" ").map((word) => {
|
|
628
|
+
if (word === "[options]") return this.styleOptionText(word);
|
|
629
|
+
if (word[0] === "[" || word[0] === "<")
|
|
630
|
+
return this.styleArgumentText(word);
|
|
631
|
+
return this.styleSubcommandText(word);
|
|
632
|
+
}).join(" ");
|
|
633
|
+
}
|
|
634
|
+
styleArgumentTerm(str) {
|
|
635
|
+
return this.styleArgumentText(str);
|
|
636
|
+
}
|
|
637
|
+
styleOptionText(str) {
|
|
638
|
+
return str;
|
|
639
|
+
}
|
|
640
|
+
styleArgumentText(str) {
|
|
641
|
+
return str;
|
|
642
|
+
}
|
|
643
|
+
styleSubcommandText(str) {
|
|
644
|
+
return str;
|
|
645
|
+
}
|
|
646
|
+
styleCommandText(str) {
|
|
647
|
+
return str;
|
|
648
|
+
}
|
|
548
649
|
/**
|
|
549
650
|
* Calculate the pad width from the maximum term length.
|
|
550
651
|
*
|
|
@@ -561,40 +662,94 @@ var require_help = __commonJS({
|
|
|
561
662
|
);
|
|
562
663
|
}
|
|
563
664
|
/**
|
|
564
|
-
*
|
|
565
|
-
* Do not wrap if insufficient room for wrapping (minColumnWidth), or string is manually formatted.
|
|
665
|
+
* Detect manually wrapped and indented strings by checking for line break followed by whitespace.
|
|
566
666
|
*
|
|
567
667
|
* @param {string} str
|
|
568
|
-
* @
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
668
|
+
* @returns {boolean}
|
|
669
|
+
*/
|
|
670
|
+
preformatted(str) {
|
|
671
|
+
return /\n[^\S\r\n]/.test(str);
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Format the "item", which consists of a term and description. Pad the term and wrap the description, indenting the following lines.
|
|
675
|
+
*
|
|
676
|
+
* So "TTT", 5, "DDD DDDD DD DDD" might be formatted for this.helpWidth=17 like so:
|
|
677
|
+
* TTT DDD DDDD
|
|
678
|
+
* DD DDD
|
|
572
679
|
*
|
|
680
|
+
* @param {string} term
|
|
681
|
+
* @param {number} termWidth
|
|
682
|
+
* @param {string} description
|
|
683
|
+
* @param {Help} helper
|
|
684
|
+
* @returns {string}
|
|
573
685
|
*/
|
|
574
|
-
|
|
575
|
-
const
|
|
576
|
-
const
|
|
577
|
-
if (
|
|
578
|
-
const
|
|
579
|
-
|
|
580
|
-
const leadingStr = str.slice(0, indent);
|
|
581
|
-
const columnText = str.slice(indent).replace("\r\n", "\n");
|
|
582
|
-
const indentString = " ".repeat(indent);
|
|
583
|
-
const zeroWidthSpace = "\u200B";
|
|
584
|
-
const breaks = `\\s${zeroWidthSpace}`;
|
|
585
|
-
const regex = new RegExp(
|
|
586
|
-
`
|
|
587
|
-
|.{1,${columnWidth - 1}}([${breaks}]|$)|[^${breaks}]+?([${breaks}]|$)`,
|
|
588
|
-
"g"
|
|
686
|
+
formatItem(term, termWidth, description, helper) {
|
|
687
|
+
const itemIndent = 2;
|
|
688
|
+
const itemIndentStr = " ".repeat(itemIndent);
|
|
689
|
+
if (!description) return itemIndentStr + term;
|
|
690
|
+
const paddedTerm = term.padEnd(
|
|
691
|
+
termWidth + term.length - helper.displayWidth(term)
|
|
589
692
|
);
|
|
590
|
-
const
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
693
|
+
const spacerWidth = 2;
|
|
694
|
+
const helpWidth = this.helpWidth ?? 80;
|
|
695
|
+
const remainingWidth = helpWidth - termWidth - spacerWidth - itemIndent;
|
|
696
|
+
let formattedDescription;
|
|
697
|
+
if (remainingWidth < this.minWidthToWrap || helper.preformatted(description)) {
|
|
698
|
+
formattedDescription = description;
|
|
699
|
+
} else {
|
|
700
|
+
const wrappedDescription = helper.boxWrap(description, remainingWidth);
|
|
701
|
+
formattedDescription = wrappedDescription.replace(
|
|
702
|
+
/\n/g,
|
|
703
|
+
"\n" + " ".repeat(termWidth + spacerWidth)
|
|
704
|
+
);
|
|
705
|
+
}
|
|
706
|
+
return itemIndentStr + paddedTerm + " ".repeat(spacerWidth) + formattedDescription.replace(/\n/g, `
|
|
707
|
+
${itemIndentStr}`);
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Wrap a string at whitespace, preserving existing line breaks.
|
|
711
|
+
* Wrapping is skipped if the width is less than `minWidthToWrap`.
|
|
712
|
+
*
|
|
713
|
+
* @param {string} str
|
|
714
|
+
* @param {number} width
|
|
715
|
+
* @returns {string}
|
|
716
|
+
*/
|
|
717
|
+
boxWrap(str, width) {
|
|
718
|
+
if (width < this.minWidthToWrap) return str;
|
|
719
|
+
const rawLines = str.split(/\r\n|\n/);
|
|
720
|
+
const chunkPattern = /[\s]*[^\s]+/g;
|
|
721
|
+
const wrappedLines = [];
|
|
722
|
+
rawLines.forEach((line) => {
|
|
723
|
+
const chunks = line.match(chunkPattern);
|
|
724
|
+
if (chunks === null) {
|
|
725
|
+
wrappedLines.push("");
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
728
|
+
let sumChunks = [chunks.shift()];
|
|
729
|
+
let sumWidth = this.displayWidth(sumChunks[0]);
|
|
730
|
+
chunks.forEach((chunk) => {
|
|
731
|
+
const visibleWidth = this.displayWidth(chunk);
|
|
732
|
+
if (sumWidth + visibleWidth <= width) {
|
|
733
|
+
sumChunks.push(chunk);
|
|
734
|
+
sumWidth += visibleWidth;
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
wrappedLines.push(sumChunks.join(""));
|
|
738
|
+
const nextChunk = chunk.trimStart();
|
|
739
|
+
sumChunks = [nextChunk];
|
|
740
|
+
sumWidth = this.displayWidth(nextChunk);
|
|
741
|
+
});
|
|
742
|
+
wrappedLines.push(sumChunks.join(""));
|
|
743
|
+
});
|
|
744
|
+
return wrappedLines.join("\n");
|
|
595
745
|
}
|
|
596
746
|
};
|
|
747
|
+
function stripColor(str) {
|
|
748
|
+
const sgrPattern = /\x1b\[\d*(;\d*)*m/g;
|
|
749
|
+
return str.replace(sgrPattern, "");
|
|
750
|
+
}
|
|
597
751
|
exports.Help = Help2;
|
|
752
|
+
exports.stripColor = stripColor;
|
|
598
753
|
}
|
|
599
754
|
});
|
|
600
755
|
|
|
@@ -784,12 +939,15 @@ var require_option = __commonJS({
|
|
|
784
939
|
}
|
|
785
940
|
/**
|
|
786
941
|
* Return option name, in a camelcase format that can be used
|
|
787
|
-
* as
|
|
942
|
+
* as an object attribute key.
|
|
788
943
|
*
|
|
789
944
|
* @return {string}
|
|
790
945
|
*/
|
|
791
946
|
attributeName() {
|
|
792
|
-
|
|
947
|
+
if (this.negate) {
|
|
948
|
+
return camelcase(this.name().replace(/^no-/, ""));
|
|
949
|
+
}
|
|
950
|
+
return camelcase(this.name());
|
|
793
951
|
}
|
|
794
952
|
/**
|
|
795
953
|
* Check if `arg` matches the short or long flag.
|
|
@@ -857,14 +1015,25 @@ var require_option = __commonJS({
|
|
|
857
1015
|
function splitOptionFlags(flags) {
|
|
858
1016
|
let shortFlag;
|
|
859
1017
|
let longFlag;
|
|
860
|
-
const
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
if (
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
1018
|
+
const shortFlagExp = /^-[^-]$/;
|
|
1019
|
+
const longFlagExp = /^--[^-]/;
|
|
1020
|
+
const flagParts = flags.split(/[ |,]+/).concat("guard");
|
|
1021
|
+
if (shortFlagExp.test(flagParts[0])) shortFlag = flagParts.shift();
|
|
1022
|
+
if (longFlagExp.test(flagParts[0])) longFlag = flagParts.shift();
|
|
1023
|
+
if (/^-[^-][^-]/.test(flagParts[0]))
|
|
1024
|
+
throw new Error(
|
|
1025
|
+
`invalid Option flags, short option is dash and single character: '${flags}'`
|
|
1026
|
+
);
|
|
1027
|
+
if (shortFlag && shortFlagExp.test(flagParts[0]))
|
|
1028
|
+
throw new Error(
|
|
1029
|
+
`invalid Option flags, more than one short flag: '${flags}'`
|
|
1030
|
+
);
|
|
1031
|
+
if (longFlag && longFlagExp.test(flagParts[0]))
|
|
1032
|
+
throw new Error(
|
|
1033
|
+
`invalid Option flags, more than one long flag: '${flags}'`
|
|
1034
|
+
);
|
|
1035
|
+
if (!(shortFlag || longFlag) || flagParts[0].startsWith("-"))
|
|
1036
|
+
throw new Error(`invalid Option flags: '${flags}'`);
|
|
868
1037
|
return { shortFlag, longFlag };
|
|
869
1038
|
}
|
|
870
1039
|
exports.Option = Option2;
|
|
@@ -966,7 +1135,7 @@ var require_command = __commonJS({
|
|
|
966
1135
|
var process = __require("node:process");
|
|
967
1136
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
968
1137
|
var { CommanderError: CommanderError2 } = require_error();
|
|
969
|
-
var { Help: Help2 } = require_help();
|
|
1138
|
+
var { Help: Help2, stripColor } = require_help();
|
|
970
1139
|
var { Option: Option2, DualOptions } = require_option();
|
|
971
1140
|
var { suggestSimilar } = require_suggestSimilar();
|
|
972
1141
|
var Command2 = class _Command extends EventEmitter {
|
|
@@ -981,7 +1150,7 @@ var require_command = __commonJS({
|
|
|
981
1150
|
this.options = [];
|
|
982
1151
|
this.parent = null;
|
|
983
1152
|
this._allowUnknownOption = false;
|
|
984
|
-
this._allowExcessArguments =
|
|
1153
|
+
this._allowExcessArguments = false;
|
|
985
1154
|
this.registeredArguments = [];
|
|
986
1155
|
this._args = this.registeredArguments;
|
|
987
1156
|
this.args = [];
|
|
@@ -1008,12 +1177,16 @@ var require_command = __commonJS({
|
|
|
1008
1177
|
this._lifeCycleHooks = {};
|
|
1009
1178
|
this._showHelpAfterError = false;
|
|
1010
1179
|
this._showSuggestionAfterError = true;
|
|
1180
|
+
this._savedState = null;
|
|
1011
1181
|
this._outputConfiguration = {
|
|
1012
1182
|
writeOut: (str) => process.stdout.write(str),
|
|
1013
1183
|
writeErr: (str) => process.stderr.write(str),
|
|
1184
|
+
outputError: (str, write) => write(str),
|
|
1014
1185
|
getOutHelpWidth: () => process.stdout.isTTY ? process.stdout.columns : void 0,
|
|
1015
1186
|
getErrHelpWidth: () => process.stderr.isTTY ? process.stderr.columns : void 0,
|
|
1016
|
-
|
|
1187
|
+
getOutHasColors: () => useColor() ?? (process.stdout.isTTY && process.stdout.hasColors?.()),
|
|
1188
|
+
getErrHasColors: () => useColor() ?? (process.stderr.isTTY && process.stderr.hasColors?.()),
|
|
1189
|
+
stripColor: (str) => stripColor(str)
|
|
1017
1190
|
};
|
|
1018
1191
|
this._hidden = false;
|
|
1019
1192
|
this._helpOption = void 0;
|
|
@@ -1141,14 +1314,18 @@ var require_command = __commonJS({
|
|
|
1141
1314
|
*
|
|
1142
1315
|
* The configuration properties are all functions:
|
|
1143
1316
|
*
|
|
1144
|
-
* //
|
|
1317
|
+
* // change how output being written, defaults to stdout and stderr
|
|
1145
1318
|
* writeOut(str)
|
|
1146
1319
|
* writeErr(str)
|
|
1147
|
-
* //
|
|
1320
|
+
* // change how output being written for errors, defaults to writeErr
|
|
1321
|
+
* outputError(str, write) // used for displaying errors and not used for displaying help
|
|
1322
|
+
* // specify width for wrapping help
|
|
1148
1323
|
* getOutHelpWidth()
|
|
1149
1324
|
* getErrHelpWidth()
|
|
1150
|
-
* //
|
|
1151
|
-
*
|
|
1325
|
+
* // color support, currently only used with Help
|
|
1326
|
+
* getOutHasColors()
|
|
1327
|
+
* getErrHasColors()
|
|
1328
|
+
* stripColor() // used to remove ANSI escape codes if output does not have colors
|
|
1152
1329
|
*
|
|
1153
1330
|
* @param {object} [configuration] - configuration options
|
|
1154
1331
|
* @return {(Command | object)} `this` command for chaining, or stored configuration
|
|
@@ -1855,6 +2032,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1855
2032
|
* @return {Command} `this` command for chaining
|
|
1856
2033
|
*/
|
|
1857
2034
|
parse(argv, parseOptions) {
|
|
2035
|
+
this._prepareForParse();
|
|
1858
2036
|
const userArgs = this._prepareUserArgs(argv, parseOptions);
|
|
1859
2037
|
this._parseCommand([], userArgs);
|
|
1860
2038
|
return this;
|
|
@@ -1880,10 +2058,68 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1880
2058
|
* @return {Promise}
|
|
1881
2059
|
*/
|
|
1882
2060
|
async parseAsync(argv, parseOptions) {
|
|
2061
|
+
this._prepareForParse();
|
|
1883
2062
|
const userArgs = this._prepareUserArgs(argv, parseOptions);
|
|
1884
2063
|
await this._parseCommand([], userArgs);
|
|
1885
2064
|
return this;
|
|
1886
2065
|
}
|
|
2066
|
+
_prepareForParse() {
|
|
2067
|
+
if (this._savedState === null) {
|
|
2068
|
+
this.saveStateBeforeParse();
|
|
2069
|
+
} else {
|
|
2070
|
+
this.restoreStateBeforeParse();
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2073
|
+
/**
|
|
2074
|
+
* Called the first time parse is called to save state and allow a restore before subsequent calls to parse.
|
|
2075
|
+
* Not usually called directly, but available for subclasses to save their custom state.
|
|
2076
|
+
*
|
|
2077
|
+
* This is called in a lazy way. Only commands used in parsing chain will have state saved.
|
|
2078
|
+
*/
|
|
2079
|
+
saveStateBeforeParse() {
|
|
2080
|
+
this._savedState = {
|
|
2081
|
+
// name is stable if supplied by author, but may be unspecified for root command and deduced during parsing
|
|
2082
|
+
_name: this._name,
|
|
2083
|
+
// option values before parse have default values (including false for negated options)
|
|
2084
|
+
// shallow clones
|
|
2085
|
+
_optionValues: { ...this._optionValues },
|
|
2086
|
+
_optionValueSources: { ...this._optionValueSources }
|
|
2087
|
+
};
|
|
2088
|
+
}
|
|
2089
|
+
/**
|
|
2090
|
+
* Restore state before parse for calls after the first.
|
|
2091
|
+
* Not usually called directly, but available for subclasses to save their custom state.
|
|
2092
|
+
*
|
|
2093
|
+
* This is called in a lazy way. Only commands used in parsing chain will have state restored.
|
|
2094
|
+
*/
|
|
2095
|
+
restoreStateBeforeParse() {
|
|
2096
|
+
if (this._storeOptionsAsProperties)
|
|
2097
|
+
throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
2098
|
+
- either make a new Command for each call to parse, or stop storing options as properties`);
|
|
2099
|
+
this._name = this._savedState._name;
|
|
2100
|
+
this._scriptPath = null;
|
|
2101
|
+
this.rawArgs = [];
|
|
2102
|
+
this._optionValues = { ...this._savedState._optionValues };
|
|
2103
|
+
this._optionValueSources = { ...this._savedState._optionValueSources };
|
|
2104
|
+
this.args = [];
|
|
2105
|
+
this.processedArgs = [];
|
|
2106
|
+
}
|
|
2107
|
+
/**
|
|
2108
|
+
* Throw if expected executable is missing. Add lots of help for author.
|
|
2109
|
+
*
|
|
2110
|
+
* @param {string} executableFile
|
|
2111
|
+
* @param {string} executableDir
|
|
2112
|
+
* @param {string} subcommandName
|
|
2113
|
+
*/
|
|
2114
|
+
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
2115
|
+
if (fs.existsSync(executableFile)) return;
|
|
2116
|
+
const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
|
|
2117
|
+
const executableMissing = `'${executableFile}' does not exist
|
|
2118
|
+
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
2119
|
+
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
2120
|
+
- ${executableDirMessage}`;
|
|
2121
|
+
throw new Error(executableMissing);
|
|
2122
|
+
}
|
|
1887
2123
|
/**
|
|
1888
2124
|
* Execute a sub-command executable.
|
|
1889
2125
|
*
|
|
@@ -1911,7 +2147,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1911
2147
|
let resolvedScriptPath;
|
|
1912
2148
|
try {
|
|
1913
2149
|
resolvedScriptPath = fs.realpathSync(this._scriptPath);
|
|
1914
|
-
} catch
|
|
2150
|
+
} catch {
|
|
1915
2151
|
resolvedScriptPath = this._scriptPath;
|
|
1916
2152
|
}
|
|
1917
2153
|
executableDir = path.resolve(
|
|
@@ -1946,6 +2182,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1946
2182
|
proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
|
|
1947
2183
|
}
|
|
1948
2184
|
} else {
|
|
2185
|
+
this._checkForMissingExecutable(
|
|
2186
|
+
executableFile,
|
|
2187
|
+
executableDir,
|
|
2188
|
+
subcommand._name
|
|
2189
|
+
);
|
|
1949
2190
|
args.unshift(executableFile);
|
|
1950
2191
|
args = incrementNodeInspectorPort(process.execArgv).concat(args);
|
|
1951
2192
|
proc = childProcess.spawn(process.execPath, args, { stdio: "inherit" });
|
|
@@ -1977,12 +2218,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1977
2218
|
});
|
|
1978
2219
|
proc.on("error", (err) => {
|
|
1979
2220
|
if (err.code === "ENOENT") {
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
throw new Error(executableMissing);
|
|
2221
|
+
this._checkForMissingExecutable(
|
|
2222
|
+
executableFile,
|
|
2223
|
+
executableDir,
|
|
2224
|
+
subcommand._name
|
|
2225
|
+
);
|
|
1986
2226
|
} else if (err.code === "EACCES") {
|
|
1987
2227
|
throw new Error(`'${executableFile}' not executable`);
|
|
1988
2228
|
}
|
|
@@ -2006,6 +2246,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2006
2246
|
_dispatchSubcommand(commandName, operands, unknown) {
|
|
2007
2247
|
const subCommand = this._findCommand(commandName);
|
|
2008
2248
|
if (!subCommand) this.help({ error: true });
|
|
2249
|
+
subCommand._prepareForParse();
|
|
2009
2250
|
let promiseChain;
|
|
2010
2251
|
promiseChain = this._chainOrCallSubCommandHook(
|
|
2011
2252
|
promiseChain,
|
|
@@ -2318,6 +2559,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2318
2559
|
* Parse options from `argv` removing known options,
|
|
2319
2560
|
* and return argv split into operands and unknown arguments.
|
|
2320
2561
|
*
|
|
2562
|
+
* Side effects: modifies command by storing options. Does not reset state if called again.
|
|
2563
|
+
*
|
|
2321
2564
|
* Examples:
|
|
2322
2565
|
*
|
|
2323
2566
|
* argv => operands, unknown
|
|
@@ -2802,26 +3045,47 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2802
3045
|
*/
|
|
2803
3046
|
helpInformation(contextOptions) {
|
|
2804
3047
|
const helper = this.createHelp();
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
3048
|
+
const context = this._getOutputContext(contextOptions);
|
|
3049
|
+
helper.prepareContext({
|
|
3050
|
+
error: context.error,
|
|
3051
|
+
helpWidth: context.helpWidth,
|
|
3052
|
+
outputHasColors: context.hasColors
|
|
3053
|
+
});
|
|
3054
|
+
const text = helper.formatHelp(this, helper);
|
|
3055
|
+
if (context.hasColors) return text;
|
|
3056
|
+
return this._outputConfiguration.stripColor(text);
|
|
2809
3057
|
}
|
|
2810
3058
|
/**
|
|
3059
|
+
* @typedef HelpContext
|
|
3060
|
+
* @type {object}
|
|
3061
|
+
* @property {boolean} error
|
|
3062
|
+
* @property {number} helpWidth
|
|
3063
|
+
* @property {boolean} hasColors
|
|
3064
|
+
* @property {function} write - includes stripColor if needed
|
|
3065
|
+
*
|
|
3066
|
+
* @returns {HelpContext}
|
|
2811
3067
|
* @private
|
|
2812
3068
|
*/
|
|
2813
|
-
|
|
3069
|
+
_getOutputContext(contextOptions) {
|
|
2814
3070
|
contextOptions = contextOptions || {};
|
|
2815
|
-
const
|
|
2816
|
-
let
|
|
2817
|
-
|
|
2818
|
-
|
|
3071
|
+
const error = !!contextOptions.error;
|
|
3072
|
+
let baseWrite;
|
|
3073
|
+
let hasColors;
|
|
3074
|
+
let helpWidth;
|
|
3075
|
+
if (error) {
|
|
3076
|
+
baseWrite = (str) => this._outputConfiguration.writeErr(str);
|
|
3077
|
+
hasColors = this._outputConfiguration.getErrHasColors();
|
|
3078
|
+
helpWidth = this._outputConfiguration.getErrHelpWidth();
|
|
2819
3079
|
} else {
|
|
2820
|
-
|
|
3080
|
+
baseWrite = (str) => this._outputConfiguration.writeOut(str);
|
|
3081
|
+
hasColors = this._outputConfiguration.getOutHasColors();
|
|
3082
|
+
helpWidth = this._outputConfiguration.getOutHelpWidth();
|
|
2821
3083
|
}
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
3084
|
+
const write = (str) => {
|
|
3085
|
+
if (!hasColors) str = this._outputConfiguration.stripColor(str);
|
|
3086
|
+
return baseWrite(str);
|
|
3087
|
+
};
|
|
3088
|
+
return { error, write, hasColors, helpWidth };
|
|
2825
3089
|
}
|
|
2826
3090
|
/**
|
|
2827
3091
|
* Output help information for this command.
|
|
@@ -2836,23 +3100,28 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2836
3100
|
deprecatedCallback = contextOptions;
|
|
2837
3101
|
contextOptions = void 0;
|
|
2838
3102
|
}
|
|
2839
|
-
const
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
3103
|
+
const outputContext = this._getOutputContext(contextOptions);
|
|
3104
|
+
const eventContext = {
|
|
3105
|
+
error: outputContext.error,
|
|
3106
|
+
write: outputContext.write,
|
|
3107
|
+
command: this
|
|
3108
|
+
};
|
|
3109
|
+
this._getCommandAndAncestors().reverse().forEach((command) => command.emit("beforeAllHelp", eventContext));
|
|
3110
|
+
this.emit("beforeHelp", eventContext);
|
|
3111
|
+
let helpInformation = this.helpInformation({ error: outputContext.error });
|
|
2843
3112
|
if (deprecatedCallback) {
|
|
2844
3113
|
helpInformation = deprecatedCallback(helpInformation);
|
|
2845
3114
|
if (typeof helpInformation !== "string" && !Buffer.isBuffer(helpInformation)) {
|
|
2846
3115
|
throw new Error("outputHelp callback must return a string or a Buffer");
|
|
2847
3116
|
}
|
|
2848
3117
|
}
|
|
2849
|
-
|
|
3118
|
+
outputContext.write(helpInformation);
|
|
2850
3119
|
if (this._getHelpOption()?.long) {
|
|
2851
3120
|
this.emit(this._getHelpOption().long);
|
|
2852
3121
|
}
|
|
2853
|
-
this.emit("afterHelp",
|
|
3122
|
+
this.emit("afterHelp", eventContext);
|
|
2854
3123
|
this._getCommandAndAncestors().forEach(
|
|
2855
|
-
(command) => command.emit("afterAllHelp",
|
|
3124
|
+
(command) => command.emit("afterAllHelp", eventContext)
|
|
2856
3125
|
);
|
|
2857
3126
|
}
|
|
2858
3127
|
/**
|
|
@@ -2914,12 +3183,20 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2914
3183
|
*/
|
|
2915
3184
|
help(contextOptions) {
|
|
2916
3185
|
this.outputHelp(contextOptions);
|
|
2917
|
-
let exitCode = process.exitCode
|
|
3186
|
+
let exitCode = Number(process.exitCode ?? 0);
|
|
2918
3187
|
if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
|
|
2919
3188
|
exitCode = 1;
|
|
2920
3189
|
}
|
|
2921
3190
|
this._exit(exitCode, "commander.help", "(outputHelp)");
|
|
2922
3191
|
}
|
|
3192
|
+
/**
|
|
3193
|
+
* // Do a little typing to coordinate emit and listener for the help text events.
|
|
3194
|
+
* @typedef HelpTextEventContext
|
|
3195
|
+
* @type {object}
|
|
3196
|
+
* @property {boolean} error
|
|
3197
|
+
* @property {Command} command
|
|
3198
|
+
* @property {function} write
|
|
3199
|
+
*/
|
|
2923
3200
|
/**
|
|
2924
3201
|
* Add additional text to be displayed with the built-in help.
|
|
2925
3202
|
*
|
|
@@ -2995,7 +3272,15 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2995
3272
|
return arg;
|
|
2996
3273
|
});
|
|
2997
3274
|
}
|
|
3275
|
+
function useColor() {
|
|
3276
|
+
if (process.env.NO_COLOR || process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false")
|
|
3277
|
+
return false;
|
|
3278
|
+
if (process.env.FORCE_COLOR || process.env.CLICOLOR_FORCE !== void 0)
|
|
3279
|
+
return true;
|
|
3280
|
+
return void 0;
|
|
3281
|
+
}
|
|
2998
3282
|
exports.Command = Command2;
|
|
3283
|
+
exports.useColor = useColor;
|
|
2999
3284
|
}
|
|
3000
3285
|
});
|
|
3001
3286
|
|
|
@@ -3071,8 +3356,8 @@ var {
|
|
|
3071
3356
|
// src/commands/build.ts
|
|
3072
3357
|
init_esm_shims();
|
|
3073
3358
|
var buildCommand = (services) => createCommand("build").action(async (_, command) => {
|
|
3074
|
-
const { runCommand } = await import("./render-command-
|
|
3075
|
-
const { build } = await import("./build-
|
|
3359
|
+
const { runCommand } = await import("./render-command-3AYSQXHN.js");
|
|
3360
|
+
const { build } = await import("./build-XZI3USNB.js");
|
|
3076
3361
|
await runCommand(command, services, build);
|
|
3077
3362
|
});
|
|
3078
3363
|
|
|
@@ -3082,8 +3367,8 @@ var import_react = __toESM(require_react(), 1);
|
|
|
3082
3367
|
var devCommand = (services) => {
|
|
3083
3368
|
const t = createI18nT();
|
|
3084
3369
|
return createCommand("dev").option("-s, --https", t("dev_command_def.option.https")).action(async (options, command) => {
|
|
3085
|
-
const { DevCommand } = await import("./DevCommand-
|
|
3086
|
-
const { renderCommand } = await import("./render-command-
|
|
3370
|
+
const { DevCommand } = await import("./DevCommand-YFEZ4QV5.js");
|
|
3371
|
+
const { renderCommand } = await import("./render-command-3AYSQXHN.js");
|
|
3087
3372
|
const { https = false } = options;
|
|
3088
3373
|
await renderCommand(command, services, /* @__PURE__ */ import_react.default.createElement(DevCommand, { https }), {
|
|
3089
3374
|
watchForModelChanges: true
|
|
@@ -3134,10 +3419,10 @@ var previewCommand = (services) => {
|
|
|
3134
3419
|
validateBase
|
|
3135
3420
|
).option("--no-input", t("app_preview_command_def.option.no_input")).action(async (options, command) => {
|
|
3136
3421
|
const { site, baseUrl, input } = options;
|
|
3137
|
-
const { renderCommand, runCommand } = await import("./render-command-
|
|
3422
|
+
const { renderCommand, runCommand } = await import("./render-command-3AYSQXHN.js");
|
|
3138
3423
|
if (!input) {
|
|
3139
3424
|
return runCommand(command, services, async (model) => {
|
|
3140
|
-
const { nonInteractivePreview } = await import("./preview-
|
|
3425
|
+
const { nonInteractivePreview } = await import("./preview-VAHHFTRZ.js");
|
|
3141
3426
|
return nonInteractivePreview(
|
|
3142
3427
|
{ siteId: site, baseUrl },
|
|
3143
3428
|
model,
|
|
@@ -3145,7 +3430,7 @@ var previewCommand = (services) => {
|
|
|
3145
3430
|
);
|
|
3146
3431
|
});
|
|
3147
3432
|
}
|
|
3148
|
-
const { PreviewCommand } = await import("./PreviewCommand-
|
|
3433
|
+
const { PreviewCommand } = await import("./PreviewCommand-3OMHWDW6.js");
|
|
3149
3434
|
await renderCommand(
|
|
3150
3435
|
command,
|
|
3151
3436
|
services,
|
|
@@ -3177,8 +3462,8 @@ var createVersionCommand = (services) => {
|
|
|
3177
3462
|
validateBase
|
|
3178
3463
|
).action(async (options, command) => {
|
|
3179
3464
|
const { VersionType } = await import("./types.impl-CD4WWRUK.js");
|
|
3180
|
-
const { renderCommand } = await import("./render-command-
|
|
3181
|
-
const { CreateVersionCommand } = await import("./CreateVersionCommand-
|
|
3465
|
+
const { renderCommand } = await import("./render-command-3AYSQXHN.js");
|
|
3466
|
+
const { CreateVersionCommand } = await import("./CreateVersionCommand-Z6F5IKH5.js");
|
|
3182
3467
|
const {
|
|
3183
3468
|
approvePreview = false,
|
|
3184
3469
|
versionType: versionTypeString,
|
|
@@ -3210,8 +3495,8 @@ var createVersionCommand = (services) => {
|
|
|
3210
3495
|
init_esm_shims();
|
|
3211
3496
|
var import_react4 = __toESM(require_react(), 1);
|
|
3212
3497
|
var serveCommand = (services) => createCommand("serve").action(async (_, command) => {
|
|
3213
|
-
const { renderCommand } = await import("./render-command-
|
|
3214
|
-
const { ServeCommand } = await import("./ServeCommand-
|
|
3498
|
+
const { renderCommand } = await import("./render-command-3AYSQXHN.js");
|
|
3499
|
+
const { ServeCommand } = await import("./ServeCommand-G4FF4PT3.js");
|
|
3215
3500
|
await renderCommand(command, services, /* @__PURE__ */ import_react4.default.createElement(ServeCommand, null));
|
|
3216
3501
|
});
|
|
3217
3502
|
|
|
@@ -3221,8 +3506,8 @@ var import_react5 = __toESM(require_react(), 1);
|
|
|
3221
3506
|
var generateCommand = (services) => {
|
|
3222
3507
|
const t = createI18nT();
|
|
3223
3508
|
return createCommand("generate").description(t("generate_command.description")).action(async (options, command) => {
|
|
3224
|
-
const { GenerateCommand } = await import("./GenerateCommand-
|
|
3225
|
-
const { renderCommand } = await import("./render-command-
|
|
3509
|
+
const { GenerateCommand } = await import("./GenerateCommand-KCV4YDNN.js");
|
|
3510
|
+
const { renderCommand } = await import("./render-command-3AYSQXHN.js");
|
|
3226
3511
|
await renderCommand(command, services, /* @__PURE__ */ import_react5.default.createElement(GenerateCommand, null), {
|
|
3227
3512
|
skipProjectValidation: true
|
|
3228
3513
|
});
|
|
@@ -3240,15 +3525,40 @@ var logsCommand = (services) => {
|
|
|
3240
3525
|
validateVersion
|
|
3241
3526
|
).action(async (options, command) => {
|
|
3242
3527
|
const { version: version2 } = options;
|
|
3243
|
-
const { renderCommand } = await import("./render-command-
|
|
3244
|
-
const { LogsCommand } = await import("./LogsCommand-
|
|
3528
|
+
const { renderCommand } = await import("./render-command-3AYSQXHN.js");
|
|
3529
|
+
const { LogsCommand } = await import("./LogsCommand-VBMGVYNU.js");
|
|
3245
3530
|
await renderCommand(command, services, /* @__PURE__ */ import_react6.default.createElement(LogsCommand, { version: version2 }));
|
|
3246
3531
|
});
|
|
3247
3532
|
};
|
|
3248
3533
|
|
|
3534
|
+
// src/commands/release.tsx
|
|
3535
|
+
init_esm_shims();
|
|
3536
|
+
var import_react7 = __toESM(require_react(), 1);
|
|
3537
|
+
var releaseCommand = (services) => {
|
|
3538
|
+
const t = createI18nT();
|
|
3539
|
+
return createCommand("release").description(t("release_command_def.description")).option(
|
|
3540
|
+
"-s, --site <site-id>",
|
|
3541
|
+
t("release_command_def.option.site"),
|
|
3542
|
+
validateSite
|
|
3543
|
+
).option(
|
|
3544
|
+
"--base-url <url>",
|
|
3545
|
+
t("release_command_def.option.base_url"),
|
|
3546
|
+
validateBase
|
|
3547
|
+
).action(async (options, command) => {
|
|
3548
|
+
const { renderCommand } = await import("./render-command-3AYSQXHN.js");
|
|
3549
|
+
const { ReleaseCommand } = await import("./ReleaseCommand-5F3FPBXT.js");
|
|
3550
|
+
const { baseUrl, site } = options;
|
|
3551
|
+
await renderCommand(
|
|
3552
|
+
command,
|
|
3553
|
+
services,
|
|
3554
|
+
/* @__PURE__ */ import_react7.default.createElement(ReleaseCommand, { baseUrl, siteIdOverride: site })
|
|
3555
|
+
);
|
|
3556
|
+
});
|
|
3557
|
+
};
|
|
3558
|
+
|
|
3249
3559
|
// src/commands/root-command.ts
|
|
3250
3560
|
var getRootCommand = async (services) => {
|
|
3251
|
-
return createCommand("app").version(version, "-v, --version", "Output the version number").enablePositionalOptions(true).helpOption("-h, --help", "Display help for command").helpCommand(false).addCommand(devCommand(services)).addCommand(buildCommand(services)).addCommand(serveCommand(services)).addCommand(previewCommand(services)).addCommand(createVersionCommand(services)).addCommand(generateCommand(services)).addCommand(logsCommand(services));
|
|
3561
|
+
return createCommand("app").version(version, "-v, --version", "Output the version number").enablePositionalOptions(true).helpOption("-h, --help", "Display help for command").helpCommand(false).addCommand(devCommand(services)).addCommand(buildCommand(services)).addCommand(serveCommand(services)).addCommand(previewCommand(services)).addCommand(createVersionCommand(services)).addCommand(generateCommand(services)).addCommand(logsCommand(services)).addCommand(releaseCommand(services), { hidden: true });
|
|
3252
3562
|
};
|
|
3253
3563
|
export {
|
|
3254
3564
|
getRootCommand
|