@modern-js/base-generator 3.0.4 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -18
- package/dist/index.js +138 -106
- package/package.json +6 -6
- package/src/index.ts +82 -0
- package/templates/base-templates/.gitignore.handlebars +4 -0
package/README.md
CHANGED
|
@@ -1,30 +1,26 @@
|
|
|
1
|
-
|
|
2
1
|
<p align="center">
|
|
3
2
|
<a href="https://modernjs.dev" target="blank"><img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png" width="300" alt="Modern.js Logo" /></a>
|
|
4
3
|
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">Modern.js</h1>
|
|
6
|
+
|
|
5
7
|
<p align="center">
|
|
6
|
-
|
|
7
|
-
<br/>
|
|
8
|
-
<a href="https://modernjs.dev" target="blank">
|
|
9
|
-
modernjs.dev
|
|
10
|
-
</a>
|
|
11
|
-
</p>
|
|
12
|
-
<p align="center">
|
|
13
|
-
The meta-framework suite designed from scratch for frontend-focused modern web development
|
|
8
|
+
A Progressive React Framework for modern web development.
|
|
14
9
|
</p>
|
|
15
10
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.
|
|
11
|
+
## Getting Started
|
|
19
12
|
|
|
20
|
-
|
|
13
|
+
Please follow [Quick Start](https://modernjs.dev/en/guides/get-started/quick-start) to get started with Modern.js.
|
|
21
14
|
|
|
22
|
-
##
|
|
15
|
+
## Documentation
|
|
23
16
|
|
|
24
|
-
- [
|
|
25
|
-
- [
|
|
26
|
-
- [API References](https://modernjs.dev/docs/apis)
|
|
17
|
+
- [English Documentation](https://modernjs.dev/en/)
|
|
18
|
+
- [中文文档](https://modernjs.dev)
|
|
27
19
|
|
|
28
20
|
## Contributing
|
|
29
21
|
|
|
30
|
-
|
|
22
|
+
Please read the [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md).
|
|
23
|
+
|
|
24
|
+
## License
|
|
25
|
+
|
|
26
|
+
Modern.js is [MIT licensed](https://github.com/modern-js-dev/modern.js/blob/main/LICENSE).
|
package/dist/index.js
CHANGED
|
@@ -35762,7 +35762,7 @@ var require_nodeEnv = __commonJS({
|
|
|
35762
35762
|
});
|
|
35763
35763
|
}
|
|
35764
35764
|
exports.canUseNpm = canUseNpm;
|
|
35765
|
-
function
|
|
35765
|
+
function canUseYarn2() {
|
|
35766
35766
|
return __async(this, null, function* () {
|
|
35767
35767
|
try {
|
|
35768
35768
|
yield (0, compiled_1.execa)("yarn", ["--version"], { env: process.env });
|
|
@@ -35772,7 +35772,7 @@ var require_nodeEnv = __commonJS({
|
|
|
35772
35772
|
}
|
|
35773
35773
|
});
|
|
35774
35774
|
}
|
|
35775
|
-
exports.canUseYarn =
|
|
35775
|
+
exports.canUseYarn = canUseYarn2;
|
|
35776
35776
|
function canUsePnpm() {
|
|
35777
35777
|
return __async(this, null, function* () {
|
|
35778
35778
|
try {
|
|
@@ -44410,7 +44410,7 @@ var require_env = __commonJS({
|
|
|
44410
44410
|
exports.canUseNpm = canUseNpm;
|
|
44411
44411
|
exports.canUseNvm = canUseNvm;
|
|
44412
44412
|
exports.canUsePnpm = canUsePnpm;
|
|
44413
|
-
exports.canUseYarn =
|
|
44413
|
+
exports.canUseYarn = canUseYarn2;
|
|
44414
44414
|
var _utils = require_dist();
|
|
44415
44415
|
function canUseNvm() {
|
|
44416
44416
|
return __async(this, null, function* () {
|
|
@@ -44437,7 +44437,7 @@ var require_env = __commonJS({
|
|
|
44437
44437
|
}
|
|
44438
44438
|
});
|
|
44439
44439
|
}
|
|
44440
|
-
function
|
|
44440
|
+
function canUseYarn2() {
|
|
44441
44441
|
return __async(this, null, function* () {
|
|
44442
44442
|
try {
|
|
44443
44443
|
yield (0, _utils.execa)("yarn", ["--version"], {
|
|
@@ -45473,14 +45473,14 @@ var require_packageManager = __commonJS({
|
|
|
45473
45473
|
value: true
|
|
45474
45474
|
});
|
|
45475
45475
|
exports.canUsePnpm = canUsePnpm;
|
|
45476
|
-
exports.canUseYarn =
|
|
45476
|
+
exports.canUseYarn = canUseYarn2;
|
|
45477
45477
|
exports.runInstall = runInstall;
|
|
45478
45478
|
var _path = _interopRequireDefault(require("path"));
|
|
45479
45479
|
var _utils = require_dist();
|
|
45480
45480
|
function _interopRequireDefault(obj) {
|
|
45481
45481
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
45482
45482
|
}
|
|
45483
|
-
function
|
|
45483
|
+
function canUseYarn2() {
|
|
45484
45484
|
return __async(this, null, function* () {
|
|
45485
45485
|
try {
|
|
45486
45486
|
yield (0, _utils.execa)("yarn", ["--version"], {
|
|
@@ -45527,7 +45527,7 @@ var require_packageManager = __commonJS({
|
|
|
45527
45527
|
params.push(`--registry=${registryUrl}`);
|
|
45528
45528
|
}
|
|
45529
45529
|
yield (0, _utils.execa)("pnpm", params, options);
|
|
45530
|
-
} else if (yield
|
|
45530
|
+
} else if (yield canUseYarn2()) {
|
|
45531
45531
|
const params = ["install", "--production", "--silent", "--ignore-scripts"];
|
|
45532
45532
|
if (registryUrl) {
|
|
45533
45533
|
params.push(`--registry=${registryUrl}`);
|
|
@@ -70792,12 +70792,12 @@ var require_figures = __commonJS({
|
|
|
70792
70792
|
var require_separator = __commonJS({
|
|
70793
70793
|
"../../../../node_modules/.pnpm/inquirer@8.2.2/node_modules/inquirer/lib/objects/separator.js"(exports, module2) {
|
|
70794
70794
|
"use strict";
|
|
70795
|
-
var
|
|
70795
|
+
var chalk2 = require_chalk();
|
|
70796
70796
|
var figures = require_figures();
|
|
70797
70797
|
var Separator = class {
|
|
70798
70798
|
constructor(line) {
|
|
70799
70799
|
this.type = "separator";
|
|
70800
|
-
this.line =
|
|
70800
|
+
this.line = chalk2.dim(line || new Array(15).join(figures.line));
|
|
70801
70801
|
}
|
|
70802
70802
|
toString() {
|
|
70803
70803
|
return this.line;
|
|
@@ -90215,7 +90215,7 @@ var require_ora2 = __commonJS({
|
|
|
90215
90215
|
"../../../../node_modules/.pnpm/ora@5.4.1/node_modules/ora/index.js"(exports, module2) {
|
|
90216
90216
|
"use strict";
|
|
90217
90217
|
var readline = require("readline");
|
|
90218
|
-
var
|
|
90218
|
+
var chalk2 = require_chalk();
|
|
90219
90219
|
var cliCursor = require_cli_cursor();
|
|
90220
90220
|
var cliSpinners = require_cli_spinners();
|
|
90221
90221
|
var logSymbols = require_browser2();
|
|
@@ -90411,7 +90411,7 @@ var require_ora2 = __commonJS({
|
|
|
90411
90411
|
const { frames } = this.spinner;
|
|
90412
90412
|
let frame = frames[this.frameIndex];
|
|
90413
90413
|
if (this.color) {
|
|
90414
|
-
frame =
|
|
90414
|
+
frame = chalk2[this.color](frame);
|
|
90415
90415
|
}
|
|
90416
90416
|
this.frameIndex = ++this.frameIndex % frames.length;
|
|
90417
90417
|
const fullPrefixText = typeof this.prefixText === "string" && this.prefixText !== "" ? this.prefixText + " " : "";
|
|
@@ -90660,7 +90660,7 @@ var require_base3 = __commonJS({
|
|
|
90660
90660
|
defaults: require_defaults2(),
|
|
90661
90661
|
clone: require_clone()
|
|
90662
90662
|
};
|
|
90663
|
-
var
|
|
90663
|
+
var chalk2 = require_chalk();
|
|
90664
90664
|
var runAsync = require_run_async();
|
|
90665
90665
|
var { filter, flatMap, share, take, takeUntil } = require_operators();
|
|
90666
90666
|
var Choices = require_choices();
|
|
@@ -90678,7 +90678,7 @@ var require_base3 = __commonJS({
|
|
|
90678
90678
|
filteringText: "",
|
|
90679
90679
|
when: () => true,
|
|
90680
90680
|
suffix: "",
|
|
90681
|
-
prefix:
|
|
90681
|
+
prefix: chalk2.green("?")
|
|
90682
90682
|
});
|
|
90683
90683
|
if (!this.opt.name) {
|
|
90684
90684
|
this.throwParamError("name");
|
|
@@ -90751,12 +90751,12 @@ var require_base3 = __commonJS({
|
|
|
90751
90751
|
return value;
|
|
90752
90752
|
}
|
|
90753
90753
|
getQuestion() {
|
|
90754
|
-
let message = (this.opt.prefix ? this.opt.prefix + " " : "") +
|
|
90754
|
+
let message = (this.opt.prefix ? this.opt.prefix + " " : "") + chalk2.bold(this.opt.message) + this.opt.suffix + chalk2.reset(" ");
|
|
90755
90755
|
if (this.opt.default != null && this.status !== "touched" && this.status !== "answered") {
|
|
90756
90756
|
if (this.opt.type === "password") {
|
|
90757
|
-
message +=
|
|
90757
|
+
message += chalk2.italic.dim("[hidden] ");
|
|
90758
90758
|
} else {
|
|
90759
|
-
message +=
|
|
90759
|
+
message += chalk2.dim("(" + this.opt.default + ") ");
|
|
90760
90760
|
}
|
|
90761
90761
|
}
|
|
90762
90762
|
return message;
|
|
@@ -90818,7 +90818,7 @@ var require_events = __commonJS({
|
|
|
90818
90818
|
var require_paginator = __commonJS({
|
|
90819
90819
|
"../../../../node_modules/.pnpm/inquirer@8.2.2/node_modules/inquirer/lib/utils/paginator.js"(exports, module2) {
|
|
90820
90820
|
"use strict";
|
|
90821
|
-
var
|
|
90821
|
+
var chalk2 = require_chalk();
|
|
90822
90822
|
var Paginator = class {
|
|
90823
90823
|
constructor(screen, options = {}) {
|
|
90824
90824
|
const { isInfinite = true } = options;
|
|
@@ -90839,7 +90839,7 @@ var require_paginator = __commonJS({
|
|
|
90839
90839
|
}
|
|
90840
90840
|
const visibleLines = this.isInfinite ? this.getInfiniteLines(lines, active, pageSize) : this.getFiniteLines(lines, active, pageSize);
|
|
90841
90841
|
this.lastIndex = active;
|
|
90842
|
-
return visibleLines.join("\n") + "\n" +
|
|
90842
|
+
return visibleLines.join("\n") + "\n" + chalk2.dim("(Move up and down to reveal more choices)");
|
|
90843
90843
|
}
|
|
90844
90844
|
getInfiniteLines(lines, active, pageSize) {
|
|
90845
90845
|
if (this.pointer === void 0) {
|
|
@@ -90895,7 +90895,7 @@ var require_incrementListIndex = __commonJS({
|
|
|
90895
90895
|
var require_list2 = __commonJS({
|
|
90896
90896
|
"../../../../node_modules/.pnpm/inquirer@8.2.2/node_modules/inquirer/lib/prompts/list.js"(exports, module2) {
|
|
90897
90897
|
"use strict";
|
|
90898
|
-
var
|
|
90898
|
+
var chalk2 = require_chalk();
|
|
90899
90899
|
var figures = require_figures();
|
|
90900
90900
|
var cliCursor = require_cli_cursor();
|
|
90901
90901
|
var runAsync = require_run_async();
|
|
@@ -90944,10 +90944,10 @@ var require_list2 = __commonJS({
|
|
|
90944
90944
|
render() {
|
|
90945
90945
|
let message = this.getQuestion();
|
|
90946
90946
|
if (this.firstRender) {
|
|
90947
|
-
message +=
|
|
90947
|
+
message += chalk2.dim("(Use arrow keys)");
|
|
90948
90948
|
}
|
|
90949
90949
|
if (this.status === "answered") {
|
|
90950
|
-
message +=
|
|
90950
|
+
message += chalk2.cyan(this.opt.choices.getChoice(this.selected).short);
|
|
90951
90951
|
} else {
|
|
90952
90952
|
const choicesStr = listRender(this.opt.choices, this.selected);
|
|
90953
90953
|
const indexPosition = this.opt.choices.indexOf(
|
|
@@ -91016,7 +91016,7 @@ var require_list2 = __commonJS({
|
|
|
91016
91016
|
const isSelected = i - separatorOffset === pointer;
|
|
91017
91017
|
let line = (isSelected ? figures.pointer + " " : " ") + choice.name;
|
|
91018
91018
|
if (isSelected) {
|
|
91019
|
-
line =
|
|
91019
|
+
line = chalk2.cyan(line);
|
|
91020
91020
|
}
|
|
91021
91021
|
output2 += line + " \n";
|
|
91022
91022
|
});
|
|
@@ -91030,7 +91030,7 @@ var require_list2 = __commonJS({
|
|
|
91030
91030
|
var require_input = __commonJS({
|
|
91031
91031
|
"../../../../node_modules/.pnpm/inquirer@8.2.2/node_modules/inquirer/lib/prompts/input.js"(exports, module2) {
|
|
91032
91032
|
"use strict";
|
|
91033
|
-
var
|
|
91033
|
+
var chalk2 = require_chalk();
|
|
91034
91034
|
var { map: map2, takeUntil } = require_operators();
|
|
91035
91035
|
var Base = require_base3();
|
|
91036
91036
|
var observe2 = require_events();
|
|
@@ -91060,10 +91060,10 @@ var require_input = __commonJS({
|
|
|
91060
91060
|
if (transformer) {
|
|
91061
91061
|
message += transformer(appendContent, this.answers, { isFinal });
|
|
91062
91062
|
} else {
|
|
91063
|
-
message += isFinal ?
|
|
91063
|
+
message += isFinal ? chalk2.cyan(appendContent) : appendContent;
|
|
91064
91064
|
}
|
|
91065
91065
|
if (error) {
|
|
91066
|
-
bottomContent =
|
|
91066
|
+
bottomContent = chalk2.red(">> ") + error;
|
|
91067
91067
|
}
|
|
91068
91068
|
this.screen.render(message, bottomContent);
|
|
91069
91069
|
}
|
|
@@ -91119,7 +91119,7 @@ var require_number = __commonJS({
|
|
|
91119
91119
|
var require_confirm = __commonJS({
|
|
91120
91120
|
"../../../../node_modules/.pnpm/inquirer@8.2.2/node_modules/inquirer/lib/prompts/confirm.js"(exports, module2) {
|
|
91121
91121
|
"use strict";
|
|
91122
|
-
var
|
|
91122
|
+
var chalk2 = require_chalk();
|
|
91123
91123
|
var { take, takeUntil } = require_operators();
|
|
91124
91124
|
var Base = require_base3();
|
|
91125
91125
|
var observe2 = require_events();
|
|
@@ -91152,7 +91152,7 @@ var require_confirm = __commonJS({
|
|
|
91152
91152
|
render(answer) {
|
|
91153
91153
|
let message = this.getQuestion();
|
|
91154
91154
|
if (typeof answer === "boolean") {
|
|
91155
|
-
message +=
|
|
91155
|
+
message += chalk2.cyan(answer ? "Yes" : "No");
|
|
91156
91156
|
} else {
|
|
91157
91157
|
message += this.rl.line;
|
|
91158
91158
|
}
|
|
@@ -91178,7 +91178,7 @@ var require_confirm = __commonJS({
|
|
|
91178
91178
|
var require_rawlist = __commonJS({
|
|
91179
91179
|
"../../../../node_modules/.pnpm/inquirer@8.2.2/node_modules/inquirer/lib/prompts/rawlist.js"(exports, module2) {
|
|
91180
91180
|
"use strict";
|
|
91181
|
-
var
|
|
91181
|
+
var chalk2 = require_chalk();
|
|
91182
91182
|
var { map: map2, takeUntil } = require_operators();
|
|
91183
91183
|
var Base = require_base3();
|
|
91184
91184
|
var Separator = require_separator();
|
|
@@ -91232,7 +91232,7 @@ var require_rawlist = __commonJS({
|
|
|
91232
91232
|
let message = this.getQuestion();
|
|
91233
91233
|
let bottomContent = "";
|
|
91234
91234
|
if (this.status === "answered") {
|
|
91235
|
-
message +=
|
|
91235
|
+
message += chalk2.cyan(this.opt.choices.getChoice(this.selected).short);
|
|
91236
91236
|
} else {
|
|
91237
91237
|
const choicesStr = renderChoices(this.opt.choices, this.selected);
|
|
91238
91238
|
message += "\n" + this.paginator.paginate(choicesStr, this.selected, this.opt.pageSize);
|
|
@@ -91240,7 +91240,7 @@ var require_rawlist = __commonJS({
|
|
|
91240
91240
|
}
|
|
91241
91241
|
message += this.rl.line;
|
|
91242
91242
|
if (error) {
|
|
91243
|
-
bottomContent = "\n" +
|
|
91243
|
+
bottomContent = "\n" + chalk2.red(">> ") + error;
|
|
91244
91244
|
}
|
|
91245
91245
|
this.screen.render(message, bottomContent);
|
|
91246
91246
|
}
|
|
@@ -91307,7 +91307,7 @@ var require_rawlist = __commonJS({
|
|
|
91307
91307
|
const index = i - separatorOffset;
|
|
91308
91308
|
let display = index + 1 + ") " + choice.name;
|
|
91309
91309
|
if (index === pointer) {
|
|
91310
|
-
display =
|
|
91310
|
+
display = chalk2.cyan(display);
|
|
91311
91311
|
}
|
|
91312
91312
|
output2 += display;
|
|
91313
91313
|
});
|
|
@@ -91321,7 +91321,7 @@ var require_rawlist = __commonJS({
|
|
|
91321
91321
|
var require_expand2 = __commonJS({
|
|
91322
91322
|
"../../../../node_modules/.pnpm/inquirer@8.2.2/node_modules/inquirer/lib/prompts/expand.js"(exports, module2) {
|
|
91323
91323
|
"use strict";
|
|
91324
|
-
var
|
|
91324
|
+
var chalk2 = require_chalk();
|
|
91325
91325
|
var { map: map2, takeUntil } = require_operators();
|
|
91326
91326
|
var Base = require_base3();
|
|
91327
91327
|
var Separator = require_separator();
|
|
@@ -91364,7 +91364,7 @@ var require_expand2 = __commonJS({
|
|
|
91364
91364
|
let message = this.getQuestion();
|
|
91365
91365
|
let bottomContent = "";
|
|
91366
91366
|
if (this.status === "answered") {
|
|
91367
|
-
message +=
|
|
91367
|
+
message += chalk2.cyan(this.answer);
|
|
91368
91368
|
} else if (this.status === "expanded") {
|
|
91369
91369
|
const choicesStr = renderChoices(this.opt.choices, this.selectedKey);
|
|
91370
91370
|
message += this.paginator.paginate(choicesStr, this.selectedKey, this.opt.pageSize);
|
|
@@ -91372,10 +91372,10 @@ var require_expand2 = __commonJS({
|
|
|
91372
91372
|
}
|
|
91373
91373
|
message += this.rl.line;
|
|
91374
91374
|
if (error) {
|
|
91375
|
-
bottomContent =
|
|
91375
|
+
bottomContent = chalk2.red(">> ") + error;
|
|
91376
91376
|
}
|
|
91377
91377
|
if (hint) {
|
|
91378
|
-
bottomContent =
|
|
91378
|
+
bottomContent = chalk2.cyan(">> ") + hint;
|
|
91379
91379
|
}
|
|
91380
91380
|
this.screen.render(message, bottomContent);
|
|
91381
91381
|
}
|
|
@@ -91399,7 +91399,7 @@ var require_expand2 = __commonJS({
|
|
|
91399
91399
|
}
|
|
91400
91400
|
let choiceStr = choice.key + ") " + choice.name;
|
|
91401
91401
|
if (this.selectedKey === choice.key) {
|
|
91402
|
-
choiceStr =
|
|
91402
|
+
choiceStr = chalk2.cyan(choiceStr);
|
|
91403
91403
|
}
|
|
91404
91404
|
output2 += choiceStr;
|
|
91405
91405
|
});
|
|
@@ -91485,7 +91485,7 @@ var require_expand2 = __commonJS({
|
|
|
91485
91485
|
}
|
|
91486
91486
|
let choiceStr = choice.key + ") " + choice.name;
|
|
91487
91487
|
if (pointer === choice.key) {
|
|
91488
|
-
choiceStr =
|
|
91488
|
+
choiceStr = chalk2.cyan(choiceStr);
|
|
91489
91489
|
}
|
|
91490
91490
|
output2 += choiceStr;
|
|
91491
91491
|
});
|
|
@@ -91499,7 +91499,7 @@ var require_expand2 = __commonJS({
|
|
|
91499
91499
|
var require_checkbox = __commonJS({
|
|
91500
91500
|
"../../../../node_modules/.pnpm/inquirer@8.2.2/node_modules/inquirer/lib/prompts/checkbox.js"(exports, module2) {
|
|
91501
91501
|
"use strict";
|
|
91502
|
-
var
|
|
91502
|
+
var chalk2 = require_chalk();
|
|
91503
91503
|
var cliCursor = require_cli_cursor();
|
|
91504
91504
|
var figures = require_figures();
|
|
91505
91505
|
var { map: map2, takeUntil } = require_operators();
|
|
@@ -91548,10 +91548,10 @@ var require_checkbox = __commonJS({
|
|
|
91548
91548
|
let message = this.getQuestion();
|
|
91549
91549
|
let bottomContent = "";
|
|
91550
91550
|
if (!this.dontShowHints) {
|
|
91551
|
-
message += "(Press " +
|
|
91551
|
+
message += "(Press " + chalk2.cyan.bold("<space>") + " to select, " + chalk2.cyan.bold("<a>") + " to toggle all, " + chalk2.cyan.bold("<i>") + " to invert selection, and " + chalk2.cyan.bold("<enter>") + " to proceed)";
|
|
91552
91552
|
}
|
|
91553
91553
|
if (this.status === "answered") {
|
|
91554
|
-
message +=
|
|
91554
|
+
message += chalk2.cyan(this.selection.join(", "));
|
|
91555
91555
|
} else {
|
|
91556
91556
|
const choicesStr = renderChoices(this.opt.choices, this.pointer);
|
|
91557
91557
|
const indexPosition = this.opt.choices.indexOf(
|
|
@@ -91574,7 +91574,7 @@ var require_checkbox = __commonJS({
|
|
|
91574
91574
|
message += "\n" + this.paginator.paginate(choicesStr, realIndexPosition, this.opt.pageSize);
|
|
91575
91575
|
}
|
|
91576
91576
|
if (error) {
|
|
91577
|
-
bottomContent =
|
|
91577
|
+
bottomContent = chalk2.red(">> ") + error;
|
|
91578
91578
|
}
|
|
91579
91579
|
this.screen.render(message, bottomContent);
|
|
91580
91580
|
}
|
|
@@ -91657,7 +91657,7 @@ var require_checkbox = __commonJS({
|
|
|
91657
91657
|
} else {
|
|
91658
91658
|
const line = getCheckbox(choice.checked) + " " + choice.name;
|
|
91659
91659
|
if (i - separatorOffset === pointer) {
|
|
91660
|
-
output2 +=
|
|
91660
|
+
output2 += chalk2.cyan(figures.pointer + line);
|
|
91661
91661
|
} else {
|
|
91662
91662
|
output2 += " " + line;
|
|
91663
91663
|
}
|
|
@@ -91667,7 +91667,7 @@ var require_checkbox = __commonJS({
|
|
|
91667
91667
|
return output2.replace(/\n$/, "");
|
|
91668
91668
|
}
|
|
91669
91669
|
function getCheckbox(checked) {
|
|
91670
|
-
return checked ?
|
|
91670
|
+
return checked ? chalk2.green(figures.radioOn) : figures.radioOff;
|
|
91671
91671
|
}
|
|
91672
91672
|
module2.exports = CheckboxPrompt;
|
|
91673
91673
|
}
|
|
@@ -91677,7 +91677,7 @@ var require_checkbox = __commonJS({
|
|
|
91677
91677
|
var require_password = __commonJS({
|
|
91678
91678
|
"../../../../node_modules/.pnpm/inquirer@8.2.2/node_modules/inquirer/lib/prompts/password.js"(exports, module2) {
|
|
91679
91679
|
"use strict";
|
|
91680
|
-
var
|
|
91680
|
+
var chalk2 = require_chalk();
|
|
91681
91681
|
var { map: map2, takeUntil } = require_operators();
|
|
91682
91682
|
var Base = require_base3();
|
|
91683
91683
|
var observe2 = require_events();
|
|
@@ -91710,15 +91710,15 @@ var require_password = __commonJS({
|
|
|
91710
91710
|
message += this.getMaskedValue(this.rl.line || "");
|
|
91711
91711
|
}
|
|
91712
91712
|
if (error) {
|
|
91713
|
-
bottomContent = "\n" +
|
|
91713
|
+
bottomContent = "\n" + chalk2.red(">> ") + error;
|
|
91714
91714
|
}
|
|
91715
91715
|
this.screen.render(message, bottomContent);
|
|
91716
91716
|
}
|
|
91717
91717
|
getMaskedValue(value) {
|
|
91718
91718
|
if (this.status === "answered") {
|
|
91719
|
-
return this.opt.mask ?
|
|
91719
|
+
return this.opt.mask ? chalk2.cyan(mask(value, this.opt.mask)) : chalk2.italic.dim("[hidden]");
|
|
91720
91720
|
}
|
|
91721
|
-
return this.opt.mask ? mask(value, this.opt.mask) :
|
|
91721
|
+
return this.opt.mask ? mask(value, this.opt.mask) : chalk2.italic.dim("[input is hidden] ");
|
|
91722
91722
|
}
|
|
91723
91723
|
getSpinningValue(value) {
|
|
91724
91724
|
return this.getMaskedValue(value);
|
|
@@ -101226,7 +101226,7 @@ var require_main = __commonJS({
|
|
|
101226
101226
|
var require_editor = __commonJS({
|
|
101227
101227
|
"../../../../node_modules/.pnpm/inquirer@8.2.2/node_modules/inquirer/lib/prompts/editor.js"(exports, module2) {
|
|
101228
101228
|
"use strict";
|
|
101229
|
-
var
|
|
101229
|
+
var chalk2 = require_chalk();
|
|
101230
101230
|
var { editAsync } = require_main();
|
|
101231
101231
|
var Base = require_base3();
|
|
101232
101232
|
var observe2 = require_events();
|
|
@@ -101249,12 +101249,12 @@ var require_editor = __commonJS({
|
|
|
101249
101249
|
let bottomContent = "";
|
|
101250
101250
|
let message = this.getQuestion();
|
|
101251
101251
|
if (this.status === "answered") {
|
|
101252
|
-
message +=
|
|
101252
|
+
message += chalk2.dim("Received");
|
|
101253
101253
|
} else {
|
|
101254
|
-
message +=
|
|
101254
|
+
message += chalk2.dim("Press <enter> to launch your preferred editor.");
|
|
101255
101255
|
}
|
|
101256
101256
|
if (error) {
|
|
101257
|
-
bottomContent =
|
|
101257
|
+
bottomContent = chalk2.red(">> ") + error;
|
|
101258
101258
|
}
|
|
101259
101259
|
this.screen.render(message, bottomContent);
|
|
101260
101260
|
}
|
|
@@ -101798,12 +101798,12 @@ var require_node7 = __commonJS({
|
|
|
101798
101798
|
var require_separator2 = __commonJS({
|
|
101799
101799
|
"../../../../node_modules/.pnpm/inquirer@8.1.3/node_modules/inquirer/lib/objects/separator.js"(exports, module2) {
|
|
101800
101800
|
"use strict";
|
|
101801
|
-
var
|
|
101801
|
+
var chalk2 = require_chalk();
|
|
101802
101802
|
var figures = require_figures();
|
|
101803
101803
|
var Separator = class {
|
|
101804
101804
|
constructor(line) {
|
|
101805
101805
|
this.type = "separator";
|
|
101806
|
-
this.line =
|
|
101806
|
+
this.line = chalk2.dim(line || new Array(15).join(figures.line));
|
|
101807
101807
|
}
|
|
101808
101808
|
toString() {
|
|
101809
101809
|
return this.line;
|
|
@@ -102792,7 +102792,7 @@ var require_base4 = __commonJS({
|
|
|
102792
102792
|
defaults: require_defaults2(),
|
|
102793
102793
|
clone: require_clone()
|
|
102794
102794
|
};
|
|
102795
|
-
var
|
|
102795
|
+
var chalk2 = require_chalk();
|
|
102796
102796
|
var runAsync = require_run_async();
|
|
102797
102797
|
var { filter, flatMap, share, take, takeUntil } = require_operators();
|
|
102798
102798
|
var Choices = require_choices2();
|
|
@@ -102810,7 +102810,7 @@ var require_base4 = __commonJS({
|
|
|
102810
102810
|
filteringText: "",
|
|
102811
102811
|
when: () => true,
|
|
102812
102812
|
suffix: "",
|
|
102813
|
-
prefix:
|
|
102813
|
+
prefix: chalk2.green("?")
|
|
102814
102814
|
});
|
|
102815
102815
|
if (!this.opt.name) {
|
|
102816
102816
|
this.throwParamError("name");
|
|
@@ -102883,12 +102883,12 @@ var require_base4 = __commonJS({
|
|
|
102883
102883
|
return value;
|
|
102884
102884
|
}
|
|
102885
102885
|
getQuestion() {
|
|
102886
|
-
let message = (this.opt.prefix ? this.opt.prefix + " " : "") +
|
|
102886
|
+
let message = (this.opt.prefix ? this.opt.prefix + " " : "") + chalk2.bold(this.opt.message) + this.opt.suffix + chalk2.reset(" ");
|
|
102887
102887
|
if (this.opt.default != null && this.status !== "touched" && this.status !== "answered") {
|
|
102888
102888
|
if (this.opt.type === "password") {
|
|
102889
|
-
message +=
|
|
102889
|
+
message += chalk2.italic.dim("[hidden] ");
|
|
102890
102890
|
} else {
|
|
102891
|
-
message +=
|
|
102891
|
+
message += chalk2.dim("(" + this.opt.default + ") ");
|
|
102892
102892
|
}
|
|
102893
102893
|
}
|
|
102894
102894
|
return message;
|
|
@@ -102983,7 +102983,7 @@ var require_paginator2 = __commonJS({
|
|
|
102983
102983
|
sum: require_sum(),
|
|
102984
102984
|
flatten: require_flatten()
|
|
102985
102985
|
};
|
|
102986
|
-
var
|
|
102986
|
+
var chalk2 = require_chalk();
|
|
102987
102987
|
var Paginator = class {
|
|
102988
102988
|
constructor(screen, options = {}) {
|
|
102989
102989
|
const { isInfinite = true } = options;
|
|
@@ -103004,7 +103004,7 @@ var require_paginator2 = __commonJS({
|
|
|
103004
103004
|
}
|
|
103005
103005
|
const visibleLines = this.isInfinite ? this.getInfiniteLines(lines, active, pageSize) : this.getFiniteLines(lines, active, pageSize);
|
|
103006
103006
|
this.lastIndex = active;
|
|
103007
|
-
return visibleLines.join("\n") + "\n" +
|
|
103007
|
+
return visibleLines.join("\n") + "\n" + chalk2.dim("(Move up and down to reveal more choices)");
|
|
103008
103008
|
}
|
|
103009
103009
|
getInfiniteLines(lines, active, pageSize) {
|
|
103010
103010
|
if (this.pointer === void 0) {
|
|
@@ -103065,7 +103065,7 @@ var require_list3 = __commonJS({
|
|
|
103065
103065
|
findIndex: require_findIndex2(),
|
|
103066
103066
|
isString: require_isString()
|
|
103067
103067
|
};
|
|
103068
|
-
var
|
|
103068
|
+
var chalk2 = require_chalk();
|
|
103069
103069
|
var figures = require_figures();
|
|
103070
103070
|
var cliCursor = require_cli_cursor();
|
|
103071
103071
|
var runAsync = require_run_async();
|
|
@@ -103117,10 +103117,10 @@ var require_list3 = __commonJS({
|
|
|
103117
103117
|
render() {
|
|
103118
103118
|
let message = this.getQuestion();
|
|
103119
103119
|
if (this.firstRender) {
|
|
103120
|
-
message +=
|
|
103120
|
+
message += chalk2.dim("(Use arrow keys)");
|
|
103121
103121
|
}
|
|
103122
103122
|
if (this.status === "answered") {
|
|
103123
|
-
message +=
|
|
103123
|
+
message += chalk2.cyan(this.opt.choices.getChoice(this.selected).short);
|
|
103124
103124
|
} else {
|
|
103125
103125
|
const choicesStr = listRender(this.opt.choices, this.selected);
|
|
103126
103126
|
const indexPosition = this.opt.choices.indexOf(
|
|
@@ -103189,7 +103189,7 @@ var require_list3 = __commonJS({
|
|
|
103189
103189
|
const isSelected = i - separatorOffset === pointer;
|
|
103190
103190
|
let line = (isSelected ? figures.pointer + " " : " ") + choice.name;
|
|
103191
103191
|
if (isSelected) {
|
|
103192
|
-
line =
|
|
103192
|
+
line = chalk2.cyan(line);
|
|
103193
103193
|
}
|
|
103194
103194
|
output2 += line + " \n";
|
|
103195
103195
|
});
|
|
@@ -103203,7 +103203,7 @@ var require_list3 = __commonJS({
|
|
|
103203
103203
|
var require_input2 = __commonJS({
|
|
103204
103204
|
"../../../../node_modules/.pnpm/inquirer@8.1.3/node_modules/inquirer/lib/prompts/input.js"(exports, module2) {
|
|
103205
103205
|
"use strict";
|
|
103206
|
-
var
|
|
103206
|
+
var chalk2 = require_chalk();
|
|
103207
103207
|
var { map: map2, takeUntil } = require_operators();
|
|
103208
103208
|
var Base = require_base4();
|
|
103209
103209
|
var observe2 = require_events2();
|
|
@@ -103233,10 +103233,10 @@ var require_input2 = __commonJS({
|
|
|
103233
103233
|
if (transformer) {
|
|
103234
103234
|
message += transformer(appendContent, this.answers, { isFinal });
|
|
103235
103235
|
} else {
|
|
103236
|
-
message += isFinal ?
|
|
103236
|
+
message += isFinal ? chalk2.cyan(appendContent) : appendContent;
|
|
103237
103237
|
}
|
|
103238
103238
|
if (error) {
|
|
103239
|
-
bottomContent =
|
|
103239
|
+
bottomContent = chalk2.red(">> ") + error;
|
|
103240
103240
|
}
|
|
103241
103241
|
this.screen.render(message, bottomContent);
|
|
103242
103242
|
}
|
|
@@ -103309,7 +103309,7 @@ var require_confirm2 = __commonJS({
|
|
|
103309
103309
|
extend: require_extend(),
|
|
103310
103310
|
isBoolean: require_isBoolean()
|
|
103311
103311
|
};
|
|
103312
|
-
var
|
|
103312
|
+
var chalk2 = require_chalk();
|
|
103313
103313
|
var { take, takeUntil } = require_operators();
|
|
103314
103314
|
var Base = require_base4();
|
|
103315
103315
|
var observe2 = require_events2();
|
|
@@ -103342,7 +103342,7 @@ var require_confirm2 = __commonJS({
|
|
|
103342
103342
|
render(answer) {
|
|
103343
103343
|
let message = this.getQuestion();
|
|
103344
103344
|
if (typeof answer === "boolean") {
|
|
103345
|
-
message +=
|
|
103345
|
+
message += chalk2.cyan(answer ? "Yes" : "No");
|
|
103346
103346
|
} else {
|
|
103347
103347
|
message += this.rl.line;
|
|
103348
103348
|
}
|
|
@@ -103373,7 +103373,7 @@ var require_rawlist2 = __commonJS({
|
|
|
103373
103373
|
isNumber: require_isNumber(),
|
|
103374
103374
|
findIndex: require_findIndex2()
|
|
103375
103375
|
};
|
|
103376
|
-
var
|
|
103376
|
+
var chalk2 = require_chalk();
|
|
103377
103377
|
var { map: map2, takeUntil } = require_operators();
|
|
103378
103378
|
var Base = require_base4();
|
|
103379
103379
|
var Separator = require_separator2();
|
|
@@ -103428,7 +103428,7 @@ var require_rawlist2 = __commonJS({
|
|
|
103428
103428
|
let message = this.getQuestion();
|
|
103429
103429
|
let bottomContent = "";
|
|
103430
103430
|
if (this.status === "answered") {
|
|
103431
|
-
message +=
|
|
103431
|
+
message += chalk2.cyan(this.opt.choices.getChoice(this.selected).short);
|
|
103432
103432
|
} else {
|
|
103433
103433
|
const choicesStr = renderChoices(this.opt.choices, this.selected);
|
|
103434
103434
|
message += "\n" + this.paginator.paginate(choicesStr, this.selected, this.opt.pageSize);
|
|
@@ -103436,7 +103436,7 @@ var require_rawlist2 = __commonJS({
|
|
|
103436
103436
|
}
|
|
103437
103437
|
message += this.rl.line;
|
|
103438
103438
|
if (error) {
|
|
103439
|
-
bottomContent = "\n" +
|
|
103439
|
+
bottomContent = "\n" + chalk2.red(">> ") + error;
|
|
103440
103440
|
}
|
|
103441
103441
|
this.screen.render(message, bottomContent);
|
|
103442
103442
|
}
|
|
@@ -103494,7 +103494,7 @@ var require_rawlist2 = __commonJS({
|
|
|
103494
103494
|
const index = i - separatorOffset;
|
|
103495
103495
|
let display = index + 1 + ") " + choice.name;
|
|
103496
103496
|
if (index === pointer) {
|
|
103497
|
-
display =
|
|
103497
|
+
display = chalk2.cyan(display);
|
|
103498
103498
|
}
|
|
103499
103499
|
output2 += display;
|
|
103500
103500
|
});
|
|
@@ -103669,7 +103669,7 @@ var require_expand3 = __commonJS({
|
|
|
103669
103669
|
isNumber: require_isNumber(),
|
|
103670
103670
|
findIndex: require_findIndex2()
|
|
103671
103671
|
};
|
|
103672
|
-
var
|
|
103672
|
+
var chalk2 = require_chalk();
|
|
103673
103673
|
var { map: map2, takeUntil } = require_operators();
|
|
103674
103674
|
var Base = require_base4();
|
|
103675
103675
|
var Separator = require_separator2();
|
|
@@ -103712,7 +103712,7 @@ var require_expand3 = __commonJS({
|
|
|
103712
103712
|
let message = this.getQuestion();
|
|
103713
103713
|
let bottomContent = "";
|
|
103714
103714
|
if (this.status === "answered") {
|
|
103715
|
-
message +=
|
|
103715
|
+
message += chalk2.cyan(this.answer);
|
|
103716
103716
|
} else if (this.status === "expanded") {
|
|
103717
103717
|
const choicesStr = renderChoices(this.opt.choices, this.selectedKey);
|
|
103718
103718
|
message += this.paginator.paginate(choicesStr, this.selectedKey, this.opt.pageSize);
|
|
@@ -103720,10 +103720,10 @@ var require_expand3 = __commonJS({
|
|
|
103720
103720
|
}
|
|
103721
103721
|
message += this.rl.line;
|
|
103722
103722
|
if (error) {
|
|
103723
|
-
bottomContent =
|
|
103723
|
+
bottomContent = chalk2.red(">> ") + error;
|
|
103724
103724
|
}
|
|
103725
103725
|
if (hint) {
|
|
103726
|
-
bottomContent =
|
|
103726
|
+
bottomContent = chalk2.cyan(">> ") + hint;
|
|
103727
103727
|
}
|
|
103728
103728
|
this.screen.render(message, bottomContent);
|
|
103729
103729
|
}
|
|
@@ -103747,7 +103747,7 @@ var require_expand3 = __commonJS({
|
|
|
103747
103747
|
}
|
|
103748
103748
|
let choiceStr = choice.key + ") " + choice.name;
|
|
103749
103749
|
if (this.selectedKey === choice.key) {
|
|
103750
|
-
choiceStr =
|
|
103750
|
+
choiceStr = chalk2.cyan(choiceStr);
|
|
103751
103751
|
}
|
|
103752
103752
|
output2 += choiceStr;
|
|
103753
103753
|
});
|
|
@@ -103836,7 +103836,7 @@ var require_expand3 = __commonJS({
|
|
|
103836
103836
|
}
|
|
103837
103837
|
let choiceStr = choice.key + ") " + choice.name;
|
|
103838
103838
|
if (pointer === choice.key) {
|
|
103839
|
-
choiceStr =
|
|
103839
|
+
choiceStr = chalk2.cyan(choiceStr);
|
|
103840
103840
|
}
|
|
103841
103841
|
output2 += choiceStr;
|
|
103842
103842
|
});
|
|
@@ -103855,7 +103855,7 @@ var require_checkbox2 = __commonJS({
|
|
|
103855
103855
|
map: require_map2(),
|
|
103856
103856
|
isString: require_isString()
|
|
103857
103857
|
};
|
|
103858
|
-
var
|
|
103858
|
+
var chalk2 = require_chalk();
|
|
103859
103859
|
var cliCursor = require_cli_cursor();
|
|
103860
103860
|
var figures = require_figures();
|
|
103861
103861
|
var { map: map2, takeUntil } = require_operators();
|
|
@@ -103904,10 +103904,10 @@ var require_checkbox2 = __commonJS({
|
|
|
103904
103904
|
let message = this.getQuestion();
|
|
103905
103905
|
let bottomContent = "";
|
|
103906
103906
|
if (!this.spaceKeyPressed) {
|
|
103907
|
-
message += "(Press " +
|
|
103907
|
+
message += "(Press " + chalk2.cyan.bold("<space>") + " to select, " + chalk2.cyan.bold("<a>") + " to toggle all, " + chalk2.cyan.bold("<i>") + " to invert selection)";
|
|
103908
103908
|
}
|
|
103909
103909
|
if (this.status === "answered") {
|
|
103910
|
-
message +=
|
|
103910
|
+
message += chalk2.cyan(this.selection.join(", "));
|
|
103911
103911
|
} else {
|
|
103912
103912
|
const choicesStr = renderChoices(this.opt.choices, this.pointer);
|
|
103913
103913
|
const indexPosition = this.opt.choices.indexOf(
|
|
@@ -103930,7 +103930,7 @@ var require_checkbox2 = __commonJS({
|
|
|
103930
103930
|
message += "\n" + this.paginator.paginate(choicesStr, realIndexPosition, this.opt.pageSize);
|
|
103931
103931
|
}
|
|
103932
103932
|
if (error) {
|
|
103933
|
-
bottomContent =
|
|
103933
|
+
bottomContent = chalk2.red(">> ") + error;
|
|
103934
103934
|
}
|
|
103935
103935
|
this.screen.render(message, bottomContent);
|
|
103936
103936
|
}
|
|
@@ -104014,7 +104014,7 @@ var require_checkbox2 = __commonJS({
|
|
|
104014
104014
|
} else {
|
|
104015
104015
|
const line = getCheckbox(choice.checked) + " " + choice.name;
|
|
104016
104016
|
if (i - separatorOffset === pointer) {
|
|
104017
|
-
output2 +=
|
|
104017
|
+
output2 += chalk2.cyan(figures.pointer + line);
|
|
104018
104018
|
} else {
|
|
104019
104019
|
output2 += " " + line;
|
|
104020
104020
|
}
|
|
@@ -104024,7 +104024,7 @@ var require_checkbox2 = __commonJS({
|
|
|
104024
104024
|
return output2.replace(/\n$/, "");
|
|
104025
104025
|
}
|
|
104026
104026
|
function getCheckbox(checked) {
|
|
104027
|
-
return checked ?
|
|
104027
|
+
return checked ? chalk2.green(figures.radioOn) : figures.radioOff;
|
|
104028
104028
|
}
|
|
104029
104029
|
module2.exports = CheckboxPrompt;
|
|
104030
104030
|
}
|
|
@@ -104034,7 +104034,7 @@ var require_checkbox2 = __commonJS({
|
|
|
104034
104034
|
var require_password2 = __commonJS({
|
|
104035
104035
|
"../../../../node_modules/.pnpm/inquirer@8.1.3/node_modules/inquirer/lib/prompts/password.js"(exports, module2) {
|
|
104036
104036
|
"use strict";
|
|
104037
|
-
var
|
|
104037
|
+
var chalk2 = require_chalk();
|
|
104038
104038
|
var { map: map2, takeUntil } = require_operators();
|
|
104039
104039
|
var Base = require_base4();
|
|
104040
104040
|
var observe2 = require_events2();
|
|
@@ -104067,15 +104067,15 @@ var require_password2 = __commonJS({
|
|
|
104067
104067
|
message += this.getMaskedValue(this.rl.line || "");
|
|
104068
104068
|
}
|
|
104069
104069
|
if (error) {
|
|
104070
|
-
bottomContent = "\n" +
|
|
104070
|
+
bottomContent = "\n" + chalk2.red(">> ") + error;
|
|
104071
104071
|
}
|
|
104072
104072
|
this.screen.render(message, bottomContent);
|
|
104073
104073
|
}
|
|
104074
104074
|
getMaskedValue(value) {
|
|
104075
104075
|
if (this.status === "answered") {
|
|
104076
|
-
return this.opt.mask ?
|
|
104076
|
+
return this.opt.mask ? chalk2.cyan(mask(value, this.opt.mask)) : chalk2.italic.dim("[hidden]");
|
|
104077
104077
|
}
|
|
104078
|
-
return this.opt.mask ? mask(value, this.opt.mask) :
|
|
104078
|
+
return this.opt.mask ? mask(value, this.opt.mask) : chalk2.italic.dim("[input is hidden] ");
|
|
104079
104079
|
}
|
|
104080
104080
|
getSpinningValue(value) {
|
|
104081
104081
|
return this.getMaskedValue(value);
|
|
@@ -104111,7 +104111,7 @@ var require_password2 = __commonJS({
|
|
|
104111
104111
|
var require_editor2 = __commonJS({
|
|
104112
104112
|
"../../../../node_modules/.pnpm/inquirer@8.1.3/node_modules/inquirer/lib/prompts/editor.js"(exports, module2) {
|
|
104113
104113
|
"use strict";
|
|
104114
|
-
var
|
|
104114
|
+
var chalk2 = require_chalk();
|
|
104115
104115
|
var { editAsync } = require_main();
|
|
104116
104116
|
var Base = require_base4();
|
|
104117
104117
|
var observe2 = require_events2();
|
|
@@ -104134,12 +104134,12 @@ var require_editor2 = __commonJS({
|
|
|
104134
104134
|
let bottomContent = "";
|
|
104135
104135
|
let message = this.getQuestion();
|
|
104136
104136
|
if (this.status === "answered") {
|
|
104137
|
-
message +=
|
|
104137
|
+
message += chalk2.dim("Received");
|
|
104138
104138
|
} else {
|
|
104139
|
-
message +=
|
|
104139
|
+
message += chalk2.dim("Press <enter> to launch your preferred editor.");
|
|
104140
104140
|
}
|
|
104141
104141
|
if (error) {
|
|
104142
|
-
bottomContent =
|
|
104142
|
+
bottomContent = chalk2.red(">> ") + error;
|
|
104143
104143
|
}
|
|
104144
104144
|
this.screen.render(message, bottomContent);
|
|
104145
104145
|
}
|
|
@@ -133829,6 +133829,26 @@ var require_compiled2 = __commonJS({
|
|
|
133829
133829
|
}
|
|
133830
133830
|
});
|
|
133831
133831
|
|
|
133832
|
+
// ../../../toolkit/utils/dist/commands.js
|
|
133833
|
+
var require_commands = __commonJS({
|
|
133834
|
+
"../../../toolkit/utils/dist/commands.js"(exports) {
|
|
133835
|
+
"use strict";
|
|
133836
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
133837
|
+
exports.isDevCommand = exports.getCommand = void 0;
|
|
133838
|
+
var getCommand = () => {
|
|
133839
|
+
const args = process.argv.slice(2);
|
|
133840
|
+
const command = args[0];
|
|
133841
|
+
return command;
|
|
133842
|
+
};
|
|
133843
|
+
exports.getCommand = getCommand;
|
|
133844
|
+
var isDevCommand = () => {
|
|
133845
|
+
const command = (0, exports.getCommand)();
|
|
133846
|
+
return command === "dev" || command === "start";
|
|
133847
|
+
};
|
|
133848
|
+
exports.isDevCommand = isDevCommand;
|
|
133849
|
+
}
|
|
133850
|
+
});
|
|
133851
|
+
|
|
133832
133852
|
// ../../../toolkit/utils/dist/format.js
|
|
133833
133853
|
var require_format2 = __commonJS({
|
|
133834
133854
|
"../../../toolkit/utils/dist/format.js"(exports) {
|
|
@@ -134204,12 +134224,14 @@ var require_node_env2 = __commonJS({
|
|
|
134204
134224
|
"../../../toolkit/utils/dist/is/node-env.js"(exports) {
|
|
134205
134225
|
"use strict";
|
|
134206
134226
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
134207
|
-
exports.isProdProfile = exports.isTest = exports.isProd = exports.isDev = void 0;
|
|
134208
|
-
var
|
|
134227
|
+
exports.isProdProfile = exports.isTest = exports.isProd = exports.isDev = exports.getNodeEnv = void 0;
|
|
134228
|
+
var getNodeEnv = () => process.env.NODE_ENV || "development";
|
|
134229
|
+
exports.getNodeEnv = getNodeEnv;
|
|
134230
|
+
var isDev = () => (0, exports.getNodeEnv)() === "development";
|
|
134209
134231
|
exports.isDev = isDev;
|
|
134210
|
-
var isProd = () =>
|
|
134232
|
+
var isProd = () => (0, exports.getNodeEnv)() === "production";
|
|
134211
134233
|
exports.isProd = isProd;
|
|
134212
|
-
var isTest = () =>
|
|
134234
|
+
var isTest = () => (0, exports.getNodeEnv)() === "test";
|
|
134213
134235
|
exports.isTest = isTest;
|
|
134214
134236
|
var isProdProfile = () => (0, exports.isProd)() && process.argv.includes("--profile");
|
|
134215
134237
|
exports.isProdProfile = isProdProfile;
|
|
@@ -134352,10 +134374,10 @@ var require_is2 = __commonJS({
|
|
|
134352
134374
|
|
|
134353
134375
|
// ../../../toolkit/utils/dist/compatRequire.js
|
|
134354
134376
|
var require_compatRequire2 = __commonJS({
|
|
134355
|
-
"../../../toolkit/utils/dist/compatRequire.js"(exports) {
|
|
134377
|
+
"../../../toolkit/utils/dist/compatRequire.js"(exports, module2) {
|
|
134356
134378
|
"use strict";
|
|
134357
134379
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
134358
|
-
exports.cleanRequireCache = exports.requireExistModule = exports.dynamicImport = exports.compatRequire = void 0;
|
|
134380
|
+
exports.deleteRequireCache = exports.cleanRequireCache = exports.requireExistModule = exports.dynamicImport = exports.compatRequire = void 0;
|
|
134359
134381
|
var findExists_1 = require_findExists2();
|
|
134360
134382
|
var compatRequire = (filePath, interop = true) => {
|
|
134361
134383
|
const mod = require(filePath);
|
|
@@ -134382,6 +134404,15 @@ var require_compatRequire2 = __commonJS({
|
|
|
134382
134404
|
});
|
|
134383
134405
|
};
|
|
134384
134406
|
exports.cleanRequireCache = cleanRequireCache;
|
|
134407
|
+
function deleteRequireCache(path2) {
|
|
134408
|
+
if (require.cache[path2]) {
|
|
134409
|
+
delete require.cache[path2];
|
|
134410
|
+
}
|
|
134411
|
+
if (module2.children) {
|
|
134412
|
+
module2.children = module2.children.filter((item) => item.filename !== path2);
|
|
134413
|
+
}
|
|
134414
|
+
}
|
|
134415
|
+
exports.deleteRequireCache = deleteRequireCache;
|
|
134385
134416
|
}
|
|
134386
134417
|
});
|
|
134387
134418
|
|
|
@@ -134403,7 +134434,7 @@ var require_constants6 = __commonJS({
|
|
|
134403
134434
|
exports.SERVER_DIR = "server";
|
|
134404
134435
|
exports.SHARED_DIR = "shared";
|
|
134405
134436
|
exports.CONFIG_CACHE_DIR = "./node_modules/.cache/node-bundle-require";
|
|
134406
|
-
exports.CONFIG_FILE_EXTENSIONS = [".js", ".ts", ".
|
|
134437
|
+
exports.CONFIG_FILE_EXTENSIONS = [".js", ".ts", ".mjs"];
|
|
134407
134438
|
exports.OUTPUT_CONFIG_FILE = "modern.config.json";
|
|
134408
134439
|
exports.DEFAULT_SERVER_CONFIG = "modern.server-runtime.config";
|
|
134409
134440
|
exports.ROUTE_MINIFEST_FILE = "routes-manifest.json";
|
|
@@ -134894,7 +134925,7 @@ var require_nodeEnv2 = __commonJS({
|
|
|
134894
134925
|
});
|
|
134895
134926
|
}
|
|
134896
134927
|
exports.canUseNpm = canUseNpm;
|
|
134897
|
-
function
|
|
134928
|
+
function canUseYarn2() {
|
|
134898
134929
|
return __async(this, null, function* () {
|
|
134899
134930
|
try {
|
|
134900
134931
|
yield (0, compiled_1.execa)("yarn", ["--version"], { env: process.env });
|
|
@@ -134904,7 +134935,7 @@ var require_nodeEnv2 = __commonJS({
|
|
|
134904
134935
|
}
|
|
134905
134936
|
});
|
|
134906
134937
|
}
|
|
134907
|
-
exports.canUseYarn =
|
|
134938
|
+
exports.canUseYarn = canUseYarn2;
|
|
134908
134939
|
function canUsePnpm() {
|
|
134909
134940
|
return __async(this, null, function* () {
|
|
134910
134941
|
try {
|
|
@@ -135983,6 +136014,7 @@ var require_dist2 = __commonJS({
|
|
|
135983
136014
|
};
|
|
135984
136015
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
135985
136016
|
__exportStar(require_compiled2(), exports);
|
|
136017
|
+
__exportStar(require_commands(), exports);
|
|
135986
136018
|
__exportStar(require_format2(), exports);
|
|
135987
136019
|
__exportStar(require_FileSizeReporter2(), exports);
|
|
135988
136020
|
__exportStar(require_printBuildError2(), exports);
|
|
@@ -136200,7 +136232,7 @@ var ZH_LOCALE = {
|
|
|
136200
136232
|
var EN_LOCALE = {
|
|
136201
136233
|
solution: {
|
|
136202
136234
|
self: "Please select the solution you want to create",
|
|
136203
|
-
mwa: "
|
|
136235
|
+
mwa: "Web App Solution",
|
|
136204
136236
|
module: "Module Solution",
|
|
136205
136237
|
monorepo: "Monorepo Solution",
|
|
136206
136238
|
custom: "Custom Solution",
|
|
@@ -136211,10 +136243,10 @@ var EN_LOCALE = {
|
|
|
136211
136243
|
},
|
|
136212
136244
|
sub_solution: {
|
|
136213
136245
|
self: "Please select the solution you want to create",
|
|
136214
|
-
mwa: "
|
|
136215
|
-
mwa_test: "
|
|
136246
|
+
mwa: "Web App Solution",
|
|
136247
|
+
mwa_test: "Web App Solution (Test)",
|
|
136216
136248
|
module: "Module Solution",
|
|
136217
|
-
inner_module: "Module Solution(Inner)",
|
|
136249
|
+
inner_module: "Module Solution (Inner)",
|
|
136218
136250
|
monorepo: "Monorepo Solution"
|
|
136219
136251
|
},
|
|
136220
136252
|
action: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js/base-generator",
|
|
3
|
-
"description": "
|
|
3
|
+
"description": "A Progressive React Framework for modern web development.",
|
|
4
4
|
"homepage": "https://modernjs.dev",
|
|
5
5
|
"bugs": "https://github.com/modern-js-dev/modern.js/issues",
|
|
6
6
|
"repository": "modern-js-dev/modern.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "3.0.
|
|
14
|
+
"version": "3.0.6",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./src/index.ts",
|
|
17
17
|
"main": "./dist/index.js",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"@types/node": "^14",
|
|
28
28
|
"jest": "^27",
|
|
29
29
|
"typescript": "^4",
|
|
30
|
-
"@
|
|
31
|
-
"@scripts/build": "2.
|
|
32
|
-
"@modern-js/generator-
|
|
33
|
-
"@
|
|
30
|
+
"@modern-js/generator-common": "3.0.6",
|
|
31
|
+
"@scripts/build": "2.4.0",
|
|
32
|
+
"@modern-js/generator-utils": "3.0.6",
|
|
33
|
+
"@scripts/jest-config": "2.4.0"
|
|
34
34
|
},
|
|
35
35
|
"sideEffects": false,
|
|
36
36
|
"publishConfig": {
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { GeneratorContext, GeneratorCore } from '@modern-js/codesmith';
|
|
3
|
+
import { AppAPI } from '@modern-js/codesmith-api-app';
|
|
4
|
+
import { getBaseSchema, PackageManager } from '@modern-js/generator-common';
|
|
5
|
+
import { fs } from '@modern-js/generator-utils';
|
|
6
|
+
|
|
7
|
+
const handleTemplateFile = async (
|
|
8
|
+
context: GeneratorContext,
|
|
9
|
+
generator: GeneratorCore,
|
|
10
|
+
appApi: AppAPI,
|
|
11
|
+
) => {
|
|
12
|
+
const { hasPlugin, generatorPlugin, ...extra } = context.config;
|
|
13
|
+
|
|
14
|
+
let ans: Record<string, unknown> = {};
|
|
15
|
+
if (hasPlugin) {
|
|
16
|
+
await generatorPlugin.installPlugins('custom', extra);
|
|
17
|
+
const schema = generatorPlugin.getInputSchema();
|
|
18
|
+
const inputValue = generatorPlugin.getInputValue();
|
|
19
|
+
ans = await appApi.getInputBySchema(
|
|
20
|
+
schema,
|
|
21
|
+
'formily',
|
|
22
|
+
{
|
|
23
|
+
...context.config,
|
|
24
|
+
...inputValue,
|
|
25
|
+
},
|
|
26
|
+
{},
|
|
27
|
+
{},
|
|
28
|
+
);
|
|
29
|
+
} else {
|
|
30
|
+
ans = await appApi.getInputBySchemaFunc(getBaseSchema, context.config);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const { packageManager } = ans;
|
|
34
|
+
|
|
35
|
+
await appApi.forgeTemplate(
|
|
36
|
+
'templates/base-templates/**/*',
|
|
37
|
+
undefined,
|
|
38
|
+
resourceKey =>
|
|
39
|
+
resourceKey
|
|
40
|
+
.replace('templates/base-templates/', '')
|
|
41
|
+
.replace('.handlebars', ''),
|
|
42
|
+
);
|
|
43
|
+
await appApi.forgeTemplate('templates/idea/**/*', undefined, resourceKey =>
|
|
44
|
+
resourceKey.replace('templates/idea/', '.idea/'),
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
if (packageManager === PackageManager.Pnpm) {
|
|
48
|
+
await appApi.forgeTemplate(
|
|
49
|
+
'templates/pnpm-templates/**/*',
|
|
50
|
+
undefined,
|
|
51
|
+
resourceKey =>
|
|
52
|
+
resourceKey
|
|
53
|
+
.replace('templates/pnpm-templates/npmrc', '.npmrc')
|
|
54
|
+
.replace('.handlebars', ''),
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
fs.chmodSync(path.join(generator.outputPath, '.husky', 'pre-commit'), '755');
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export default async (context: GeneratorContext, generator: GeneratorCore) => {
|
|
62
|
+
const appApi = new AppAPI(context, generator);
|
|
63
|
+
const { locale } = context.config;
|
|
64
|
+
appApi.i18n.changeLanguage({ locale });
|
|
65
|
+
|
|
66
|
+
if (!(await appApi.checkEnvironment())) {
|
|
67
|
+
// eslint-disable-next-line no-process-exit
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
generator.logger.debug(`start run @modern-js/base-generator`);
|
|
72
|
+
generator.logger.debug(`context=${JSON.stringify(context)}`);
|
|
73
|
+
generator.logger.debug(`context.data=${JSON.stringify(context.data)}`);
|
|
74
|
+
|
|
75
|
+
await handleTemplateFile(context, generator, appApi);
|
|
76
|
+
|
|
77
|
+
if (context.handleForged) {
|
|
78
|
+
await context.handleForged('custom', context, context.config.hasPlugin);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
generator.logger.debug(`forge @modern-js/base-generator succeed `);
|
|
82
|
+
};
|