@modern-js/repo-generator 3.0.10 → 3.1.0

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 +191 -18
  2. package/package.json +14 -13
package/dist/index.js CHANGED
@@ -135164,7 +135164,7 @@ var require_format2 = __commonJS({
135164
135164
  if (typeof stats === "object") {
135165
135165
  const fileName = stats.moduleName ? `File: ${stats.moduleName}
135166
135166
  ` : "";
135167
- const mainMessage = stats.message;
135167
+ const mainMessage = typeof stats.formatted === "string" ? stats.formatted : stats.message;
135168
135168
  const details = stats.details ? `
135169
135169
  Details: ${stats.details}
135170
135170
  ` : "";
@@ -138525,6 +138525,143 @@ var require_getTargetDir = __commonJS({
138525
138525
  }
138526
138526
  });
138527
138527
 
138528
+ // ../../../toolkit/utils/dist/babel.js
138529
+ var require_babel = __commonJS({
138530
+ "../../../toolkit/utils/dist/babel.js"(exports, module2) {
138531
+ var __defProp2 = Object.defineProperty;
138532
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
138533
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
138534
+ var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
138535
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
138536
+ var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
138537
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
138538
+ var __spreadValues2 = (a, b) => {
138539
+ for (var prop in b || (b = {}))
138540
+ if (__hasOwnProp2.call(b, prop))
138541
+ __defNormalProp2(a, prop, b[prop]);
138542
+ if (__getOwnPropSymbols2)
138543
+ for (var prop of __getOwnPropSymbols2(b)) {
138544
+ if (__propIsEnum2.call(b, prop))
138545
+ __defNormalProp2(a, prop, b[prop]);
138546
+ }
138547
+ return a;
138548
+ };
138549
+ var __export2 = (target, all) => {
138550
+ for (var name in all)
138551
+ __defProp2(target, name, { get: all[name], enumerable: true });
138552
+ };
138553
+ var __copyProps2 = (to, from, except, desc) => {
138554
+ if (from && typeof from === "object" || typeof from === "function") {
138555
+ for (let key of __getOwnPropNames2(from))
138556
+ if (!__hasOwnProp2.call(to, key) && key !== except)
138557
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
138558
+ }
138559
+ return to;
138560
+ };
138561
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
138562
+ var babel_exports = {};
138563
+ __export2(babel_exports, {
138564
+ applyUserBabelConfig: () => applyUserBabelConfig,
138565
+ getBabelUtils: () => getBabelUtils
138566
+ });
138567
+ module2.exports = __toCommonJS2(babel_exports);
138568
+ var import_path10 = require("path");
138569
+ var import_applyOptionsChain = require_applyOptionsChain2();
138570
+ var import_ensureArray = require_ensureArray2();
138571
+ var import_path22 = require_path2();
138572
+ var formatPath = (originPath) => {
138573
+ if ((0, import_path10.isAbsolute)(originPath)) {
138574
+ return originPath.split(import_path10.sep).join("/");
138575
+ }
138576
+ return originPath;
138577
+ };
138578
+ var getPluginItemName = (item) => {
138579
+ if (typeof item === "string") {
138580
+ return formatPath(item);
138581
+ }
138582
+ if (Array.isArray(item) && typeof item[0] === "string") {
138583
+ return formatPath(item[0]);
138584
+ }
138585
+ return null;
138586
+ };
138587
+ var addPlugins = (plugins, config) => {
138588
+ if (config.plugins) {
138589
+ config.plugins.push(...plugins);
138590
+ } else {
138591
+ config.plugins = plugins;
138592
+ }
138593
+ };
138594
+ var addPresets = (presets, config) => {
138595
+ if (config.presets) {
138596
+ config.presets.push(...presets);
138597
+ } else {
138598
+ config.presets = presets;
138599
+ }
138600
+ };
138601
+ var removePlugins = (plugins, config) => {
138602
+ if (!config.plugins) {
138603
+ return;
138604
+ }
138605
+ const removeList = (0, import_ensureArray.ensureArray)(plugins);
138606
+ config.plugins = config.plugins.filter((item) => {
138607
+ const name = getPluginItemName(item);
138608
+ if (name) {
138609
+ return !removeList.find((removeItem) => name.includes(removeItem));
138610
+ }
138611
+ return true;
138612
+ });
138613
+ };
138614
+ var removePresets = (presets, config) => {
138615
+ if (!config.presets) {
138616
+ return;
138617
+ }
138618
+ const removeList = (0, import_ensureArray.ensureArray)(presets);
138619
+ config.presets = config.presets.filter((item) => {
138620
+ const name = getPluginItemName(item);
138621
+ if (name) {
138622
+ return !removeList.find((removeItem) => name.includes(removeItem));
138623
+ }
138624
+ return true;
138625
+ });
138626
+ };
138627
+ var modifyPresetOptions = (presetName, options, presets = []) => {
138628
+ presets.forEach((preset, index) => {
138629
+ if (Array.isArray(preset)) {
138630
+ if (typeof preset[0] === "string" && (0, import_path22.normalizeToPosixPath)(preset[0]).includes(presetName)) {
138631
+ preset[1] = __spreadValues2(__spreadValues2({}, preset[1] || {}), options);
138632
+ }
138633
+ } else if (typeof preset === "string" && (0, import_path22.normalizeToPosixPath)(preset).includes(presetName)) {
138634
+ presets[index] = [preset, options];
138635
+ }
138636
+ });
138637
+ };
138638
+ var getBabelUtils = (config) => {
138639
+ const noop = () => {
138640
+ };
138641
+ return {
138642
+ addPlugins: (plugins) => addPlugins(plugins, config),
138643
+ addPresets: (presets) => addPresets(presets, config),
138644
+ removePlugins: (plugins) => removePlugins(plugins, config),
138645
+ removePresets: (presets) => removePresets(presets, config),
138646
+ // `addIncludes` and `addExcludes` are noop functions by default,
138647
+ // It can be overridden by `extraBabelUtils`.
138648
+ addIncludes: noop,
138649
+ addExcludes: noop,
138650
+ // Compat `presetEnvOptions` and `presetReactOptions` in Eden.
138651
+ modifyPresetEnvOptions: (options) => modifyPresetOptions("@babel/preset-env", options, config.presets || []),
138652
+ modifyPresetReactOptions: (options) => modifyPresetOptions("@babel/preset-react", options, config.presets || [])
138653
+ };
138654
+ };
138655
+ var applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabelUtils) => {
138656
+ if (userBabelConfig) {
138657
+ const babelUtils = __spreadValues2(__spreadValues2({}, getBabelUtils(defaultOptions)), extraBabelUtils);
138658
+ return (0, import_applyOptionsChain.applyOptionsChain)(defaultOptions, userBabelConfig || {}, babelUtils);
138659
+ }
138660
+ return defaultOptions;
138661
+ };
138662
+ }
138663
+ });
138664
+
138528
138665
  // ../../../toolkit/utils/dist/index.js
138529
138666
  var require_dist2 = __commonJS({
138530
138667
  "../../../toolkit/utils/dist/index.js"(exports, module2) {
@@ -138588,6 +138725,7 @@ var require_dist2 = __commonJS({
138588
138725
  __reExport(src_exports2, require_getCoreJsVersion(), module2.exports);
138589
138726
  __reExport(src_exports2, require_react(), module2.exports);
138590
138727
  __reExport(src_exports2, require_getTargetDir(), module2.exports);
138728
+ __reExport(src_exports2, require_babel(), module2.exports);
138591
138729
  }
138592
138730
  });
138593
138731
 
@@ -139666,8 +139804,9 @@ var I18n = class {
139666
139804
  var ZH_LOCALE = {
139667
139805
  solution: {
139668
139806
  self: "请选择你想创建的工程类型",
139669
- mwa: "应用",
139670
- module: "模块",
139807
+ mwa: "Web 应用",
139808
+ module: "Npm 模块",
139809
+ doc: "文档站",
139671
139810
  monorepo: "Monorepo",
139672
139811
  custom: "自定义",
139673
139812
  default: "默认"
@@ -139677,10 +139816,10 @@ var ZH_LOCALE = {
139677
139816
  },
139678
139817
  sub_solution: {
139679
139818
  self: "请选择你想创建的工程类型",
139680
- mwa: "应用",
139681
- mwa_test: "应用(测试)",
139682
- module: "模块",
139683
- inner_module: "模块(内部)"
139819
+ mwa: "Web 应用",
139820
+ mwa_test: "Web 应用(测试)",
139821
+ module: "Npm 模块",
139822
+ inner_module: "Npm 模块(内部)"
139684
139823
  },
139685
139824
  action: {
139686
139825
  self: "请选择你想要的操作",
@@ -139762,9 +139901,10 @@ var ZH_LOCALE = {
139762
139901
  var EN_LOCALE = {
139763
139902
  solution: {
139764
139903
  self: "Please select the solution you want to create",
139765
- mwa: "Web App Solution",
139766
- module: "Module Solution",
139767
- monorepo: "Monorepo Solution",
139904
+ mwa: "Web App",
139905
+ module: "Npm Module",
139906
+ doc: "Doc Site",
139907
+ monorepo: "Monorepo",
139768
139908
  custom: "Custom Solution",
139769
139909
  default: "Default"
139770
139910
  },
@@ -139773,11 +139913,11 @@ var EN_LOCALE = {
139773
139913
  },
139774
139914
  sub_solution: {
139775
139915
  self: "Please select the solution you want to create",
139776
- mwa: "Web App Solution",
139777
- mwa_test: "Web App Solution (Test)",
139778
- module: "Module Solution",
139779
- inner_module: "Module Solution (Inner)",
139780
- monorepo: "Monorepo Solution"
139916
+ mwa: "Web App",
139917
+ mwa_test: "Web App (Test)",
139918
+ module: "Npm Module",
139919
+ inner_module: "Npm Module (Inner)",
139920
+ monorepo: "Monorepo"
139781
139921
  },
139782
139922
  action: {
139783
139923
  self: "Action",
@@ -139817,7 +139957,7 @@ var EN_LOCALE = {
139817
139957
  self: "Development Language"
139818
139958
  },
139819
139959
  packageManager: {
139820
- self: "Package Management Tool"
139960
+ self: "Package Manager"
139821
139961
  },
139822
139962
  packageName: {
139823
139963
  self: "Package Name",
@@ -139849,7 +139989,7 @@ var EN_LOCALE = {
139849
139989
  }
139850
139990
  },
139851
139991
  buildTools: {
139852
- self: "Build Tools",
139992
+ self: "Bundler",
139853
139993
  webpack: "webpack",
139854
139994
  rspack: "Rspack (experimental)"
139855
139995
  }
@@ -139870,6 +140010,7 @@ var BooleanConfig = /* @__PURE__ */ ((BooleanConfig2) => {
139870
140010
  var Solution = /* @__PURE__ */ ((Solution22) => {
139871
140011
  Solution22["MWA"] = "mwa";
139872
140012
  Solution22["Module"] = "module";
140013
+ Solution22["Doc"] = "doc";
139873
140014
  Solution22["Monorepo"] = "monorepo";
139874
140015
  return Solution22;
139875
140016
  })(Solution || {});
@@ -139889,6 +140030,10 @@ var SolutionText = {
139889
140030
  "module"
139890
140031
  /* Module */
139891
140032
  ]: () => i18n.t(localeKeys.solution.module),
140033
+ [
140034
+ "doc"
140035
+ /* Doc */
140036
+ ]: () => i18n.t(localeKeys.solution.doc),
139892
140037
  [
139893
140038
  "monorepo"
139894
140039
  /* Monorepo */
@@ -139921,6 +140066,10 @@ var SolutionToolsMap = {
139921
140066
  "module"
139922
140067
  /* Module */
139923
140068
  ]: "@modern-js/module-tools",
140069
+ [
140070
+ "doc"
140071
+ /* Doc */
140072
+ ]: "@modern-js/doc-tools",
139924
140073
  [
139925
140074
  "monorepo"
139926
140075
  /* Monorepo */
@@ -140001,6 +140150,10 @@ var SolutionGenerator = {
140001
140150
  "module"
140002
140151
  /* Module */
140003
140152
  ]: "@modern-js/module-generator",
140153
+ [
140154
+ "doc"
140155
+ /* Doc */
140156
+ ]: "@modern-js/doc-generator",
140004
140157
  [
140005
140158
  "monorepo"
140006
140159
  /* Monorepo */
@@ -140106,7 +140259,7 @@ var getPackageNameSchema = (extra = {}) => {
140106
140259
  dependencies: [],
140107
140260
  fulfill: {
140108
140261
  state: {
140109
- visible: Boolean(extra == null ? void 0 : extra.isMonorepoSubProject) || !(extra == null ? void 0 : extra.isMwa)
140262
+ visible: Boolean(extra == null ? void 0 : extra.isMonorepoSubProject) || !(extra == null ? void 0 : extra.isMwa) && !(extra == null ? void 0 : extra.isDoc)
140110
140263
  }
140111
140264
  }
140112
140265
  }
@@ -140164,6 +140317,24 @@ var BaseDefaultConfig = {
140164
140317
  packageManager: PackageManager.Pnpm
140165
140318
  };
140166
140319
 
140320
+ // ../../generator-common/dist/esm-node/doc/project.js
140321
+ var getDocSchemaProperties = (extra) => {
140322
+ return {
140323
+ packageName: getPackageNameSchema(extra),
140324
+ packagePath: getPackagePathSchema(extra),
140325
+ packageManager: getPackageManagerSchema(extra)
140326
+ };
140327
+ };
140328
+ var getDocSchema = (extra = {}) => {
140329
+ return {
140330
+ type: "object",
140331
+ properties: getDocSchemaProperties(extra)
140332
+ };
140333
+ };
140334
+ var DocDefaultConfig = {
140335
+ packageManager: PackageManager.Pnpm
140336
+ };
140337
+
140167
140338
  // ../../generator-common/dist/esm-node/module/project.js
140168
140339
  var getModuleSchemaProperties = (extra) => {
140169
140340
  return {
@@ -140663,11 +140834,13 @@ var MonorepoNewActionConfig = {
140663
140834
  var SolutionDefaultConfig = {
140664
140835
  [Solution.MWA]: MWADefaultConfig,
140665
140836
  [Solution.Module]: ModuleDefaultConfig,
140837
+ [Solution.Doc]: DocDefaultConfig,
140666
140838
  [Solution.Monorepo]: MonorepoDefaultConfig
140667
140839
  };
140668
140840
  var SolutionSchemas = {
140669
140841
  [Solution.MWA]: getMWASchema,
140670
140842
  [Solution.Module]: getModuleSchema,
140843
+ [Solution.Doc]: getDocSchema,
140671
140844
  [Solution.Monorepo]: getMonorepoSchema,
140672
140845
  custom: getBaseSchema
140673
140846
  };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "3.0.10",
14
+ "version": "3.1.0",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "main": "./dist/index.js",
17
17
  "files": [
@@ -22,20 +22,21 @@
22
22
  "@babel/runtime": "^7.18.0",
23
23
  "@modern-js/codesmith": "2.0.5",
24
24
  "@modern-js/codesmith-api-app": "2.0.5",
25
- "@types/jest": "^27",
25
+ "@types/jest": "^29",
26
26
  "@types/node": "^14",
27
- "jest": "^27",
27
+ "jest": "^29",
28
28
  "typescript": "^4",
29
- "@modern-js/generator-common": "3.0.10",
30
- "@modern-js/generator-utils": "3.0.10",
31
- "@modern-js/module-generator": "3.0.10",
32
- "@modern-js/monorepo-generator": "3.0.10",
33
- "@modern-js/mwa-generator": "3.0.10",
34
- "@modern-js/utils": "2.8.0",
35
- "@modern-js/generator-plugin": "3.0.10",
36
- "@modern-js/base-generator": "3.0.10",
37
- "@scripts/build": "2.8.0",
38
- "@scripts/jest-config": "2.8.0"
29
+ "@modern-js/base-generator": "3.1.0",
30
+ "@modern-js/generator-common": "3.1.0",
31
+ "@modern-js/module-generator": "3.1.0",
32
+ "@modern-js/mwa-generator": "3.1.0",
33
+ "@modern-js/monorepo-generator": "3.1.0",
34
+ "@modern-js/utils": "2.10.0",
35
+ "@modern-js/doc-generator": "3.1.0",
36
+ "@modern-js/generator-utils": "3.1.0",
37
+ "@modern-js/generator-plugin": "3.1.0",
38
+ "@scripts/jest-config": "2.10.0",
39
+ "@scripts/build": "2.10.0"
39
40
  },
40
41
  "sideEffects": false,
41
42
  "publishConfig": {