@modern-js/mwa-generator 3.7.2 → 3.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +24 -72
  2. package/package.json +10 -10
package/dist/index.js CHANGED
@@ -62,14 +62,6 @@
62
62
  if (typeof require !== "undefined") return require.apply(this, arguments);
63
63
  throw Error('Dynamic require of "' + x + '" is not supported');
64
64
  });
65
- var __objRest = (source, exclude)=>{
66
- var target = {};
67
- for(var prop in source)if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop];
68
- if (source != null && __getOwnPropSymbols) for (var prop of __getOwnPropSymbols(source)){
69
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) target[prop] = source[prop];
70
- }
71
- return target;
72
- };
73
65
  var __commonJS = (cb, mod)=>function __require2() {
74
66
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = {
75
67
  exports: {}
@@ -119,6 +111,13 @@
119
111
  module1.exports = (typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : self || Function("return this")())["codesmithApiApp"];
120
112
  }
121
113
  });
114
+ // globals:@modern-js/codesmith-utils/lodash
115
+ var require_lodash = __commonJS({
116
+ "globals:@modern-js/codesmith-utils/lodash" (exports, module1) {
117
+ "use strict";
118
+ module1.exports = (typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : self || Function("return this")())["codesmithLodashUtils"];
119
+ }
120
+ });
122
121
  // globals:@modern-js/plugin-i18n
123
122
  var require_plugin_i18n = __commonJS({
124
123
  "globals:@modern-js/plugin-i18n" (exports, module1) {
@@ -2418,25 +2417,11 @@
2418
2417
  });
2419
2418
  // src/index.ts
2420
2419
  var import_codesmith_api_app = __toESM(require_codesmith_api_app());
2420
+ var import_lodash = __toESM(require_lodash());
2421
2421
  // ../../generator-common/dist/esm-node/locale/index.js
2422
2422
  var import_plugin_i18n = __toESM(require_plugin_i18n());
2423
2423
  // ../../generator-common/dist/esm-node/locale/en.js
2424
2424
  var EN_LOCALE = {
2425
- solution: {
2426
- self: "Please select the type of project you want to create:",
2427
- mwa: "Web App",
2428
- module: "Npm Module",
2429
- custom: "Custom Solution",
2430
- default: "Default"
2431
- },
2432
- scenes: {
2433
- self: "Please select the project scenario:"
2434
- },
2435
- sub_solution: {
2436
- self: "Please select the type of project you want to create:",
2437
- mwa: "Web App",
2438
- module: "Npm Module"
2439
- },
2440
2425
  action: {
2441
2426
  self: "Please select the operation you want:",
2442
2427
  function: {
@@ -2508,21 +2493,6 @@
2508
2493
  };
2509
2494
  // ../../generator-common/dist/esm-node/locale/zh.js
2510
2495
  var ZH_LOCALE = {
2511
- solution: {
2512
- self: "请选择你想创建的工程类型",
2513
- mwa: "Web 应用",
2514
- module: "Npm 模块",
2515
- custom: "自定义",
2516
- default: "默认"
2517
- },
2518
- scenes: {
2519
- self: "请选择项目场景"
2520
- },
2521
- sub_solution: {
2522
- self: "请选择你想创建的工程类型",
2523
- mwa: "Web 应用",
2524
- module: "Npm 模块"
2525
- },
2526
2496
  action: {
2527
2497
  self: "请选择你想要的操作",
2528
2498
  function: {
@@ -5536,6 +5506,12 @@ You can run the following command in the directory of the new project:
5536
5506
  en: EN_LOCALE3
5537
5507
  });
5538
5508
  // src/index.ts
5509
+ var mergeDefaultConfig = (context)=>{
5510
+ const { defaultSolution } = context.config;
5511
+ if (defaultSolution) {
5512
+ (0, import_lodash.merge)(context.config, MWADefaultConfig);
5513
+ }
5514
+ };
5539
5515
  var handleTemplateFile = (context, generator, appApi)=>__async(void 0, null, function*() {
5540
5516
  var _a, _b;
5541
5517
  (_a = generator.logger) == null ? void 0 : _a.timing(`🕐 Get Modern.js app-tools version`);
@@ -5556,35 +5532,15 @@ You can run the following command in the directory of the new project:
5556
5532
  isMwa: true,
5557
5533
  isEmptySrc: true
5558
5534
  });
5559
- const _c = context.config, { hasPlugin, generatorPlugin } = _c, extra = __objRest(_c, [
5560
- "hasPlugin",
5561
- "generatorPlugin"
5562
- ]);
5563
5535
  let ans = {};
5564
- if (hasPlugin) {
5565
- yield generatorPlugin.installPlugins(Solution.MWA, extra);
5566
- const schema2 = generatorPlugin.getInputSchema();
5567
- const inputValue = generatorPlugin.getInputValue();
5568
- const defaultConfig = generatorPlugin.getDefaultConfig();
5569
- context.config.gitCommitMessage = generatorPlugin.getGitMessage() || context.config.gitCommitMessage;
5570
- ans = yield appApi.getInputBySchema(schema2, "formily", __spreadValues(__spreadValues({}, context.config), defaultConfig), {
5571
- packageName: (input)=>validatePackageName(input, packages, {
5572
- isMonorepoSubProject
5573
- }),
5574
- packagePath: (input)=>validatePackagePath(input, _path.default.join(process.cwd(), projectDir), {
5575
- isMwa: true
5576
- })
5577
- }, __spreadValues({}, inputValue));
5578
- } else {
5579
- ans = yield appApi.getInputBySchemaFunc(getMWASchema, __spreadValues({}, context.config), {
5580
- packageName: (input)=>validatePackageName(input, packages, {
5581
- isMonorepoSubProject
5582
- }),
5583
- packagePath: (input)=>validatePackagePath(input, _path.default.join(process.cwd(), projectDir), {
5584
- isMwa: true
5585
- })
5586
- });
5587
- }
5536
+ ans = yield appApi.getInputBySchemaFunc(getMWASchema, __spreadValues({}, context.config), {
5537
+ packageName: (input)=>validatePackageName(input, packages, {
5538
+ isMonorepoSubProject
5539
+ }),
5540
+ packagePath: (input)=>validatePackagePath(input, _path.default.join(process.cwd(), projectDir), {
5541
+ isMwa: true
5542
+ })
5543
+ });
5588
5544
  generator.logger.debug(`💡 [Input Answer]: ${JSON.stringify(ans)}`);
5589
5545
  const { packageName, packagePath, language, packageManager } = ans;
5590
5546
  const { packagesInfo } = context.config;
@@ -5593,9 +5549,7 @@ You can run the following command in the directory of the new project:
5593
5549
  const dirname = _path.default.basename(generator.outputPath);
5594
5550
  yield appApi.runSubGenerator(getGeneratorPath(BaseGenerator, context.config.distTag, [
5595
5551
  __dirname
5596
- ]), void 0, __spreadProps(__spreadValues({}, context.config), {
5597
- hasPlugin: false
5598
- }));
5552
+ ]), void 0, __spreadValues({}, context.config));
5599
5553
  yield appApi.forgeTemplate("templates/base-template/**/*", void 0, (resourceKey)=>resourceKey.replace("templates/base-template/", projectPath).replace(".handlebars", ""), {
5600
5554
  name: packageName || dirname,
5601
5555
  isMonorepoSubProject,
@@ -5654,14 +5608,12 @@ You can run the following command in the directory of the new project:
5654
5608
  generator.logger.debug("💡 [Current Config]:", JSON.stringify(context.config));
5655
5609
  let projectPath = "";
5656
5610
  try {
5611
+ mergeDefaultConfig(context);
5657
5612
  ({ projectPath } = yield handleTemplateFile(context, generator, appApi));
5658
5613
  } catch (e) {
5659
5614
  generator.logger.error(`🔴 [Handle MWA Template Error]:`, e);
5660
5615
  process.exit(1);
5661
5616
  }
5662
- if (context.handleForged) {
5663
- yield context.handleForged(Solution.MWA, context, context.config.hasPlugin, projectPath);
5664
- }
5665
5617
  try {
5666
5618
  yield appApi.runGitAndInstall(context.config.gitCommitMessage);
5667
5619
  } catch (e) {
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.7.2",
18
+ "version": "3.7.3",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "main": "./dist/index.js",
21
21
  "files": [
@@ -30,15 +30,15 @@
30
30
  "@types/node": "^14",
31
31
  "jest": "^29",
32
32
  "typescript": "^5",
33
- "@modern-js/base-generator": "3.7.2",
34
- "@modern-js/dependence-generator": "3.7.2",
35
- "@modern-js/entry-generator": "3.7.2",
36
- "@modern-js/generator-common": "3.7.2",
37
- "@modern-js/generator-utils": "3.7.2",
38
- "@modern-js/packages-generator": "3.7.2",
39
- "@modern-js/plugin-i18n": "2.60.6",
40
- "@scripts/jest-config": "2.60.6",
41
- "@scripts/build": "2.60.6"
33
+ "@modern-js/dependence-generator": "3.7.3",
34
+ "@modern-js/entry-generator": "3.7.3",
35
+ "@modern-js/generator-common": "3.7.3",
36
+ "@modern-js/generator-utils": "3.7.3",
37
+ "@modern-js/base-generator": "3.7.3",
38
+ "@modern-js/packages-generator": "3.7.3",
39
+ "@modern-js/plugin-i18n": "2.61.0",
40
+ "@scripts/build": "2.61.0",
41
+ "@scripts/jest-config": "2.61.0"
42
42
  },
43
43
  "sideEffects": false,
44
44
  "publishConfig": {