@modern-js/repo-generator 0.0.0-canary-20220929120009 → 0.0.0-canary-20221011062930
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +58 -27
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -130765,10 +130765,13 @@ var require_getPort2 = __commonJSMin((exports) => {
|
|
|
130765
130765
|
var net_1 = __importDefault(__require("net"));
|
|
130766
130766
|
var compiled_1 = require_compiled2();
|
|
130767
130767
|
var logger_1 = require_logger4();
|
|
130768
|
-
var getPort = async (port, tryLimits = 20) => {
|
|
130768
|
+
var getPort = async (port, { tryLimits = 20, strictPort = false } = {}) => {
|
|
130769
130769
|
if (typeof port === "string") {
|
|
130770
130770
|
port = parseInt(port, 10);
|
|
130771
130771
|
}
|
|
130772
|
+
if (strictPort) {
|
|
130773
|
+
tryLimits = 1;
|
|
130774
|
+
}
|
|
130772
130775
|
const original = port;
|
|
130773
130776
|
let found = false;
|
|
130774
130777
|
let attempts = 0;
|
|
@@ -130795,7 +130798,11 @@ var require_getPort2 = __commonJSMin((exports) => {
|
|
|
130795
130798
|
}
|
|
130796
130799
|
}
|
|
130797
130800
|
if (port !== original) {
|
|
130798
|
-
|
|
130801
|
+
if (strictPort) {
|
|
130802
|
+
throw new Error(`Port "${original}" is occupied, please choose another one.`);
|
|
130803
|
+
} else {
|
|
130804
|
+
logger_1.logger.info(compiled_1.chalk.red(`Something is already running on port ${original}. ${compiled_1.chalk.yellow(`Use port ${port} instead.`)}`));
|
|
130805
|
+
}
|
|
130799
130806
|
}
|
|
130800
130807
|
return port;
|
|
130801
130808
|
};
|
|
@@ -134512,6 +134519,7 @@ var PluginInputContext = /* @__PURE__ */ function() {
|
|
|
134512
134519
|
function PluginInputContext2(inputs) {
|
|
134513
134520
|
_classCallCheck(this, PluginInputContext2);
|
|
134514
134521
|
_defineProperty(this, "inputValue", {});
|
|
134522
|
+
_defineProperty(this, "defaultConfig", {});
|
|
134515
134523
|
_defineProperty(this, "inputs", []);
|
|
134516
134524
|
_defineProperty(this, "extendInputMap", {});
|
|
134517
134525
|
_defineProperty(this, "extendOptionMap", {});
|
|
@@ -134526,7 +134534,8 @@ var PluginInputContext = /* @__PURE__ */ function() {
|
|
|
134526
134534
|
setInput: this.setInput.bind(this),
|
|
134527
134535
|
addOptionBefore: this.addOptionBefore.bind(this),
|
|
134528
134536
|
addOptionAfter: this.addOptionAfter.bind(this),
|
|
134529
|
-
setInputValue: this.setInputValue.bind(this)
|
|
134537
|
+
setInputValue: this.setInputValue.bind(this),
|
|
134538
|
+
setDefaultConfig: this.setDefualtConfig.bind(this)
|
|
134530
134539
|
};
|
|
134531
134540
|
}
|
|
134532
134541
|
}, {
|
|
@@ -134836,6 +134845,11 @@ var PluginInputContext = /* @__PURE__ */ function() {
|
|
|
134836
134845
|
value: function setInputValue(value) {
|
|
134837
134846
|
this.inputValue = value;
|
|
134838
134847
|
}
|
|
134848
|
+
}, {
|
|
134849
|
+
key: "setDefualtConfig",
|
|
134850
|
+
value: function setDefualtConfig(value) {
|
|
134851
|
+
this.defaultConfig = value;
|
|
134852
|
+
}
|
|
134839
134853
|
}]);
|
|
134840
134854
|
return PluginInputContext2;
|
|
134841
134855
|
}();
|
|
@@ -135424,11 +135438,28 @@ var GeneratorPlugin = /* @__PURE__ */ function() {
|
|
|
135424
135438
|
}
|
|
135425
135439
|
return result;
|
|
135426
135440
|
}
|
|
135441
|
+
}, {
|
|
135442
|
+
key: "getDefaultConfig",
|
|
135443
|
+
value: function getDefaultConfig() {
|
|
135444
|
+
var result = {};
|
|
135445
|
+
var _iterator3 = _createForOfIteratorHelper(this.plugins), _step3;
|
|
135446
|
+
try {
|
|
135447
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) {
|
|
135448
|
+
var info = _step3.value;
|
|
135449
|
+
result = (0, import_lodash7.merge)(result, info.context.inputContext.defaultConfig);
|
|
135450
|
+
}
|
|
135451
|
+
} catch (err) {
|
|
135452
|
+
_iterator3.e(err);
|
|
135453
|
+
} finally {
|
|
135454
|
+
_iterator3.f();
|
|
135455
|
+
}
|
|
135456
|
+
return result;
|
|
135457
|
+
}
|
|
135427
135458
|
}, {
|
|
135428
135459
|
key: "installPlugins",
|
|
135429
135460
|
value: function() {
|
|
135430
135461
|
var _installPlugins2 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee3(solution, inputData) {
|
|
135431
|
-
var plugins, plugin,
|
|
135462
|
+
var plugins, plugin, _iterator4, _step4, info;
|
|
135432
135463
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
135433
135464
|
while (1) {
|
|
135434
135465
|
switch (_context3.prev = _context3.next) {
|
|
@@ -135450,17 +135481,17 @@ var GeneratorPlugin = /* @__PURE__ */ function() {
|
|
|
135450
135481
|
return installPlugins(plugins, inputData.registry);
|
|
135451
135482
|
case 6:
|
|
135452
135483
|
this.plugins = _context3.sent;
|
|
135453
|
-
|
|
135484
|
+
_iterator4 = _createForOfIteratorHelper(this.plugins);
|
|
135454
135485
|
try {
|
|
135455
|
-
for (
|
|
135456
|
-
info =
|
|
135486
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done; ) {
|
|
135487
|
+
info = _step4.value;
|
|
135457
135488
|
info.context = new PluginContext(SolutionSchemas[solution], inputData.locale);
|
|
135458
135489
|
info.module(info.context.context);
|
|
135459
135490
|
}
|
|
135460
135491
|
} catch (err) {
|
|
135461
|
-
|
|
135492
|
+
_iterator4.e(err);
|
|
135462
135493
|
} finally {
|
|
135463
|
-
|
|
135494
|
+
_iterator4.f();
|
|
135464
135495
|
}
|
|
135465
135496
|
case 9:
|
|
135466
135497
|
case "end":
|
|
@@ -135478,20 +135509,20 @@ var GeneratorPlugin = /* @__PURE__ */ function() {
|
|
|
135478
135509
|
key: "getGitMessage",
|
|
135479
135510
|
value: function getGitMessage() {
|
|
135480
135511
|
var result = "";
|
|
135481
|
-
var
|
|
135512
|
+
var _iterator5 = _createForOfIteratorHelper(this.plugins), _step5;
|
|
135482
135513
|
try {
|
|
135483
|
-
for (
|
|
135514
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done; ) {
|
|
135484
135515
|
var _info$context;
|
|
135485
|
-
var info =
|
|
135516
|
+
var info = _step5.value;
|
|
135486
135517
|
if ((_info$context = info.context) !== null && _info$context !== void 0 && _info$context.gitAPI.gitMessage) {
|
|
135487
135518
|
var _info$context2;
|
|
135488
135519
|
result = ((_info$context2 = info.context) === null || _info$context2 === void 0 ? void 0 : _info$context2.gitAPI.gitMessage) || "";
|
|
135489
135520
|
}
|
|
135490
135521
|
}
|
|
135491
135522
|
} catch (err) {
|
|
135492
|
-
|
|
135523
|
+
_iterator5.e(err);
|
|
135493
135524
|
} finally {
|
|
135494
|
-
|
|
135525
|
+
_iterator5.f();
|
|
135495
135526
|
}
|
|
135496
135527
|
return result;
|
|
135497
135528
|
}
|
|
@@ -135499,7 +135530,7 @@ var GeneratorPlugin = /* @__PURE__ */ function() {
|
|
|
135499
135530
|
key: "handleForged",
|
|
135500
135531
|
value: function() {
|
|
135501
135532
|
var _handleForged = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee4(solution, basePath, inputData, projectPath, generatorCore) {
|
|
135502
|
-
var generatorPlugin, restData,
|
|
135533
|
+
var generatorPlugin, restData, _iterator6, _step6, _info$context3, _info$context4, info, onForgedFunc, _iterator7, _step7, _info$context5, _info, afterForged;
|
|
135503
135534
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
135504
135535
|
while (1) {
|
|
135505
135536
|
switch (_context4.prev = _context4.next) {
|
|
@@ -135515,15 +135546,15 @@ var GeneratorPlugin = /* @__PURE__ */ function() {
|
|
|
135515
135546
|
}
|
|
135516
135547
|
return _context4.abrupt("return");
|
|
135517
135548
|
case 5:
|
|
135518
|
-
|
|
135549
|
+
_iterator6 = _createForOfIteratorHelper(this.plugins);
|
|
135519
135550
|
_context4.prev = 6;
|
|
135520
|
-
|
|
135551
|
+
_iterator6.s();
|
|
135521
135552
|
case 8:
|
|
135522
|
-
if ((
|
|
135553
|
+
if ((_step6 = _iterator6.n()).done) {
|
|
135523
135554
|
_context4.next = 17;
|
|
135524
135555
|
break;
|
|
135525
135556
|
}
|
|
135526
|
-
info =
|
|
135557
|
+
info = _step6.value;
|
|
135527
135558
|
(_info$context3 = info.context) === null || _info$context3 === void 0 ? void 0 : _info$context3.handlePrepareContext(generatorCore, solution, import_path2.default.join(basePath, projectPath), import_path2.default.join(info.templatePath, "templates"), restData);
|
|
135528
135559
|
onForgedFunc = (_info$context4 = info.context) === null || _info$context4 === void 0 ? void 0 : _info$context4.lifeCycleFuncMap[LifeCycle.OnForged];
|
|
135529
135560
|
if (!(onForgedFunc && (0, import_lodash7.isFunction)(onForgedFunc))) {
|
|
@@ -135541,21 +135572,21 @@ var GeneratorPlugin = /* @__PURE__ */ function() {
|
|
|
135541
135572
|
case 19:
|
|
135542
135573
|
_context4.prev = 19;
|
|
135543
135574
|
_context4.t0 = _context4["catch"](6);
|
|
135544
|
-
|
|
135575
|
+
_iterator6.e(_context4.t0);
|
|
135545
135576
|
case 22:
|
|
135546
135577
|
_context4.prev = 22;
|
|
135547
|
-
|
|
135578
|
+
_iterator6.f();
|
|
135548
135579
|
return _context4.finish(22);
|
|
135549
135580
|
case 25:
|
|
135550
|
-
|
|
135581
|
+
_iterator7 = _createForOfIteratorHelper(this.plugins);
|
|
135551
135582
|
_context4.prev = 26;
|
|
135552
|
-
|
|
135583
|
+
_iterator7.s();
|
|
135553
135584
|
case 28:
|
|
135554
|
-
if ((
|
|
135585
|
+
if ((_step7 = _iterator7.n()).done) {
|
|
135555
135586
|
_context4.next = 36;
|
|
135556
135587
|
break;
|
|
135557
135588
|
}
|
|
135558
|
-
_info =
|
|
135589
|
+
_info = _step7.value;
|
|
135559
135590
|
afterForged = (_info$context5 = _info.context) === null || _info$context5 === void 0 ? void 0 : _info$context5.lifeCycleFuncMap[LifeCycle.AfterForged];
|
|
135560
135591
|
if (!(afterForged && (0, import_lodash7.isFunction)(afterForged))) {
|
|
135561
135592
|
_context4.next = 34;
|
|
@@ -135572,10 +135603,10 @@ var GeneratorPlugin = /* @__PURE__ */ function() {
|
|
|
135572
135603
|
case 38:
|
|
135573
135604
|
_context4.prev = 38;
|
|
135574
135605
|
_context4.t1 = _context4["catch"](26);
|
|
135575
|
-
|
|
135606
|
+
_iterator7.e(_context4.t1);
|
|
135576
135607
|
case 41:
|
|
135577
135608
|
_context4.prev = 41;
|
|
135578
|
-
|
|
135609
|
+
_iterator7.f();
|
|
135579
135610
|
return _context4.finish(41);
|
|
135580
135611
|
case 44:
|
|
135581
135612
|
if (this.event) {
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "0.0.0-canary-
|
|
14
|
+
"version": "0.0.0-canary-20221011062930",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"main": "./dist/index.js",
|
|
17
17
|
"files": [
|
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@babel/runtime": "^7.18.0",
|
|
26
|
-
"@modern-js/base-generator": "0.0.0-canary-
|
|
26
|
+
"@modern-js/base-generator": "0.0.0-canary-20221011062930",
|
|
27
27
|
"@modern-js/codesmith": "^1.5.0",
|
|
28
28
|
"@modern-js/codesmith-api-app": "^1.5.0",
|
|
29
|
-
"@modern-js/generator-common": "0.0.0-canary-
|
|
30
|
-
"@modern-js/generator-plugin": "0.0.0-canary-
|
|
31
|
-
"@modern-js/generator-utils": "0.0.0-canary-
|
|
32
|
-
"@modern-js/module-generator": "0.0.0-canary-
|
|
33
|
-
"@modern-js/monorepo-generator": "0.0.0-canary-
|
|
34
|
-
"@modern-js/mwa-generator": "0.0.0-canary-
|
|
35
|
-
"@modern-js/utils": "0.0.0-canary-
|
|
36
|
-
"@scripts/build": "0.0.0-canary-
|
|
37
|
-
"@scripts/jest-config": "0.0.0-canary-
|
|
29
|
+
"@modern-js/generator-common": "0.0.0-canary-20221011062930",
|
|
30
|
+
"@modern-js/generator-plugin": "0.0.0-canary-20221011062930",
|
|
31
|
+
"@modern-js/generator-utils": "0.0.0-canary-20221011062930",
|
|
32
|
+
"@modern-js/module-generator": "0.0.0-canary-20221011062930",
|
|
33
|
+
"@modern-js/monorepo-generator": "0.0.0-canary-20221011062930",
|
|
34
|
+
"@modern-js/mwa-generator": "0.0.0-canary-20221011062930",
|
|
35
|
+
"@modern-js/utils": "0.0.0-canary-20221011062930",
|
|
36
|
+
"@scripts/build": "0.0.0-canary-20221011062930",
|
|
37
|
+
"@scripts/jest-config": "0.0.0-canary-20221011062930",
|
|
38
38
|
"@types/jest": "^27",
|
|
39
39
|
"@types/node": "^14",
|
|
40
40
|
"jest": "^27",
|