@modern-js/repo-generator 3.3.21 → 3.3.23

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 +28 -17
  2. package/package.json +11 -11
package/dist/index.js CHANGED
@@ -84031,17 +84031,14 @@ var MWAActionTypesMap = {
84031
84031
  [ActionType.Function]: MWAActionFunctions,
84032
84032
  [ActionType.Refactor]: MWAActionReactors
84033
84033
  };
84034
- var getMWANewActionSchema = (extra = {}) => {
84035
- const { funcMap = {}, refactorMap = {} } = extra;
84036
- const funcs = MWAActionFunctions.filter((func) => !funcMap[func]);
84037
- const refactors = MWAActionReactors.filter((reactor) => !refactorMap[reactor]);
84034
+ var getMWANewActionSchema = () => {
84038
84035
  return {
84039
84036
  type: "object",
84040
84037
  properties: {
84041
84038
  actionType: {
84042
84039
  type: "string",
84043
84040
  title: i18n2.t(localeKeys2.action.self),
84044
- enum: MWAActionTypes.filter((type) => type === ActionType.Function ? funcs.length > 0 : true).filter((type) => type === ActionType.Refactor ? refactors.length > 0 : true).map((type) => ({
84041
+ enum: MWAActionTypes.map((type) => ({
84045
84042
  value: type,
84046
84043
  label: ActionTypeText[type](),
84047
84044
  type: [
@@ -84072,7 +84069,7 @@ var getMWANewActionSchema = (extra = {}) => {
84072
84069
  [ActionType.Function]: {
84073
84070
  type: "string",
84074
84071
  title: ActionTypeQuestionText[ActionType.Function](),
84075
- enum: funcs.map((func) => ({
84072
+ enum: MWAActionFunctions.map((func) => ({
84076
84073
  value: func,
84077
84074
  label: ActionFunctionText[func]()
84078
84075
  })),
@@ -84092,7 +84089,7 @@ var getMWANewActionSchema = (extra = {}) => {
84092
84089
  [ActionType.Refactor]: {
84093
84090
  type: "string",
84094
84091
  title: ActionTypeQuestionText[ActionType.Refactor](),
84095
- enum: refactors.map((refactor) => ({
84092
+ enum: MWAActionReactors.map((refactor) => ({
84096
84093
  value: refactor,
84097
84094
  label: ActionRefactorText[refactor]()
84098
84095
  })),
@@ -84215,8 +84212,7 @@ var ModuleActionFunctions = [
84215
84212
  var ModuleActionTypesMap = {
84216
84213
  [ActionType.Function]: ModuleActionFunctions
84217
84214
  };
84218
- var getModuleNewActionSchema = (extra = {}) => {
84219
- const { funcMap = {} } = extra;
84215
+ var getModuleNewActionSchema = () => {
84220
84216
  return {
84221
84217
  type: "object",
84222
84218
  properties: {
@@ -84234,7 +84230,7 @@ var getModuleNewActionSchema = (extra = {}) => {
84234
84230
  [ActionType.Function]: {
84235
84231
  type: "string",
84236
84232
  title: ActionTypeQuestionText[ActionType.Function](),
84237
- enum: ModuleActionFunctions.filter((func) => !funcMap[func]).map((func) => ({
84233
+ enum: ModuleActionFunctions.map((func) => ({
84238
84234
  value: func,
84239
84235
  label: ActionFunctionText[func]()
84240
84236
  })),
@@ -85804,6 +85800,14 @@ async function usePluginNameExport(solution, options) {
85804
85800
 
85805
85801
  // ../../new-action/dist/esm/mwa.js
85806
85802
  var import_lodash10 = require("@modern-js/utils/lodash");
85803
+
85804
+ // ../../new-action/dist/esm/constants.js
85805
+ var enableAlreadyText = {
85806
+ zh: "当前功能已开启,请确认对应插件依赖是否已安装。若需重新开启该功能,请移除插件依赖后再次尝试。",
85807
+ en: "The current function has been enabled. Please confirm whether the corresponding plugin dependencies have been installed. If you need to re-enable this function, please remove the plugin dependencies and try again."
85808
+ };
85809
+
85810
+ // ../../new-action/dist/esm/mwa.js
85807
85811
  var MWANewAction = async (options) => {
85808
85812
  const { locale = "zh", distTag = "", debug = false, registry: registry2 = "", config = "{}", cwd = process.cwd(), needInstall = true } = options;
85809
85813
  let UserConfig = {};
@@ -85812,8 +85816,9 @@ var MWANewAction = async (options) => {
85812
85816
  } catch (e) {
85813
85817
  throw new Error("config is not a valid json");
85814
85818
  }
85819
+ const language = UserConfig.locale || locale;
85815
85820
  i18n2.changeLanguage({
85816
- locale: UserConfig.locale || locale
85821
+ locale: language
85817
85822
  });
85818
85823
  const smith = new CodeSmith({
85819
85824
  debug,
@@ -85839,12 +85844,14 @@ var MWANewAction = async (options) => {
85839
85844
  refactorMap[refactor] = enable;
85840
85845
  });
85841
85846
  const ans = await formilyAPI.getInputBySchemaFunc(getMWANewActionSchema, {
85842
- ...UserConfig,
85843
- funcMap,
85844
- refactorMap
85847
+ ...UserConfig
85845
85848
  });
85846
85849
  const actionType = ans.actionType;
85847
85850
  const action2 = ans[actionType];
85851
+ if (actionType === ActionType.Function && funcMap[action2] || actionType === ActionType.Refactor && refactorMap[action2]) {
85852
+ smith.logger.error(enableAlreadyText[language]);
85853
+ return;
85854
+ }
85848
85855
  const generator = getGeneratorPath2(MWANewActionGenerators[actionType][action2], distTag);
85849
85856
  if (!generator) {
85850
85857
  throw new Error(`no valid option`);
@@ -85906,8 +85913,9 @@ var ModuleNewAction = async (options) => {
85906
85913
  } catch (e) {
85907
85914
  throw new Error("config is not a valid json");
85908
85915
  }
85916
+ const language = UserConfig.locale || locale;
85909
85917
  i18n2.changeLanguage({
85910
- locale: UserConfig.locale || locale
85918
+ locale: language
85911
85919
  });
85912
85920
  const smith = new CodeSmith({
85913
85921
  debug,
@@ -85936,11 +85944,14 @@ var ModuleNewAction = async (options) => {
85936
85944
  process.exit(1);
85937
85945
  }
85938
85946
  const ans = await formilyAPI.getInputBySchemaFunc(getModuleNewActionSchema, {
85939
- ...UserConfig,
85940
- funcMap
85947
+ ...UserConfig
85941
85948
  });
85942
85949
  const actionType = ans.actionType;
85943
85950
  const action2 = ans[actionType];
85951
+ if (actionType === ActionType.Function && funcMap[action2]) {
85952
+ smith.logger.error(enableAlreadyText[language]);
85953
+ return;
85954
+ }
85944
85955
  const generator = getGeneratorPath2(ModuleNewActionGenerators[actionType][action2], distTag);
85945
85956
  if (!generator) {
85946
85957
  throw new Error(`no valid option`);
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.3.21",
18
+ "version": "3.3.23",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "main": "./dist/index.js",
21
21
  "files": [
@@ -23,7 +23,7 @@
23
23
  "/dist/index.js"
24
24
  ],
25
25
  "dependencies": {
26
- "@modern-js/utils": "2.49.3"
26
+ "@modern-js/utils": "2.50.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@modern-js/codesmith": "2.3.5",
@@ -32,15 +32,15 @@
32
32
  "@types/node": "^14",
33
33
  "jest": "^29",
34
34
  "typescript": "^5",
35
- "@modern-js/base-generator": "3.3.21",
36
- "@modern-js/generator-common": "3.3.21",
37
- "@modern-js/generator-plugin": "3.3.21",
38
- "@modern-js/generator-utils": "3.3.21",
39
- "@modern-js/monorepo-generator": "3.3.21",
40
- "@modern-js/module-generator": "3.3.21",
41
- "@modern-js/mwa-generator": "3.3.21",
42
- "@scripts/build": "2.49.3",
43
- "@scripts/jest-config": "2.49.3"
35
+ "@modern-js/generator-common": "3.3.23",
36
+ "@modern-js/generator-utils": "3.3.23",
37
+ "@modern-js/base-generator": "3.3.23",
38
+ "@modern-js/module-generator": "3.3.23",
39
+ "@modern-js/monorepo-generator": "3.3.23",
40
+ "@scripts/build": "2.50.0",
41
+ "@modern-js/mwa-generator": "3.3.23",
42
+ "@scripts/jest-config": "2.50.0",
43
+ "@modern-js/generator-plugin": "3.3.23"
44
44
  },
45
45
  "sideEffects": false,
46
46
  "publishConfig": {