@modern-js/generator-cases 3.1.8 → 3.1.10

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @modern-js/generator-cases
2
2
 
3
+ ## 3.1.10
4
+
5
+ ### Patch Changes
6
+
7
+ - 4e876ab: chore: package.json include the monorepo-relative directory
8
+
9
+ chore: 在 package.json 中声明 monorepo 的子路径
10
+
11
+ - Updated dependencies [84a8008]
12
+ - Updated dependencies [4e876ab]
13
+ - @modern-js/generator-common@3.1.10
14
+
15
+ ## 3.1.9
16
+
17
+ ### Patch Changes
18
+
19
+ - @modern-js/generator-common@3.1.9
20
+
3
21
  ## 3.1.8
4
22
 
5
23
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -1,61 +1,48 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
8
6
  for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var src_exports = {};
29
- __export(src_exports, {
30
- BFFTypeValues: () => BFFTypeValues,
7
+ Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
13
+ LanguageValues: () => LanguageValues,
14
+ PackageManagerValues: () => PackageManagerValues,
31
15
  BooleanConfigValues: () => BooleanConfigValues,
32
- BuildToolsValues: () => BuildToolsValues,
33
16
  FrameworkValues: () => FrameworkValues,
34
- LanguageValues: () => LanguageValues,
35
- MWABFFValueMap: () => MWABFFValueMap,
36
- MWAServerValueMap: () => MWAServerValueMap,
37
- MWASubProjectValueMap: () => MWASubProjectValueMap,
17
+ BFFTypeValues: () => BFFTypeValues,
18
+ BuildToolsValues: () => BuildToolsValues,
38
19
  MWAValueMap: () => MWAValueMap,
39
- ModuleSubProjectValueMap: () => ModuleSubProjectValueMap,
40
20
  ModuleValueMap: () => ModuleValueMap,
41
21
  MonorepoValueMap: () => MonorepoValueMap,
42
- PackageManagerValues: () => PackageManagerValues,
43
22
  getMWACases: () => getMWACases,
44
- getMWANewCases: () => getMWANewCases,
45
23
  getModuleCases: () => getModuleCases,
46
- getModuleNewCases: () => getModuleNewCases,
47
24
  getMonorepoCases: () => getMonorepoCases,
25
+ MWAServerValueMap: () => MWAServerValueMap,
26
+ MWABFFValueMap: () => MWABFFValueMap,
27
+ getMWANewCases: () => getMWANewCases,
28
+ getModuleNewCases: () => getModuleNewCases,
29
+ MWASubProjectValueMap: () => MWASubProjectValueMap,
30
+ ModuleSubProjectValueMap: () => ModuleSubProjectValueMap,
48
31
  getMonorepoNewCases: () => getMonorepoNewCases
49
32
  });
50
- module.exports = __toCommonJS(src_exports);
51
- var import_covertable = __toESM(require("covertable"));
52
- var import_generator_common = require("@modern-js/generator-common");
53
- const LanguageValues = Object.values(import_generator_common.Language);
54
- const PackageManagerValues = Object.values(import_generator_common.PackageManager);
55
- const BooleanConfigValues = Object.values(import_generator_common.BooleanConfig);
56
- const FrameworkValues = Object.values(import_generator_common.Framework);
57
- const BFFTypeValues = Object.values(import_generator_common.BFFType);
58
- const BuildToolsValues = Object.values(import_generator_common.BuildTools);
33
+ const _covertable = /* @__PURE__ */ _interop_require_default(require("covertable"));
34
+ const _generatorcommon = require("@modern-js/generator-common");
35
+ function _interop_require_default(obj) {
36
+ return obj && obj.__esModule ? obj : {
37
+ default: obj
38
+ };
39
+ }
40
+ const LanguageValues = Object.values(_generatorcommon.Language);
41
+ const PackageManagerValues = Object.values(_generatorcommon.PackageManager);
42
+ const BooleanConfigValues = Object.values(_generatorcommon.BooleanConfig);
43
+ const FrameworkValues = Object.values(_generatorcommon.Framework);
44
+ const BFFTypeValues = Object.values(_generatorcommon.BFFType);
45
+ const BuildToolsValues = Object.values(_generatorcommon.BuildTools);
59
46
  const MWAValueMap = {
60
47
  language: LanguageValues,
61
48
  packageManager: PackageManagerValues,
@@ -66,35 +53,33 @@ const ModuleValueMap = {
66
53
  packageManager: PackageManagerValues
67
54
  };
68
55
  const MonorepoValueMap = {
69
- packageManager: PackageManagerValues.filter(
70
- (packageManager) => packageManager !== "npm"
71
- )
56
+ packageManager: PackageManagerValues.filter((packageManager) => packageManager !== "npm")
72
57
  };
73
58
  const getMWACases = (length) => {
74
- const cases = (0, import_covertable.default)(MWAValueMap, {
59
+ const cases = (0, _covertable.default)(MWAValueMap, {
75
60
  length: length || Object.keys(MWAValueMap).length
76
61
  });
77
62
  return cases.map((item) => ({
78
63
  ...item,
79
- solution: import_generator_common.Solution.MWA
64
+ solution: _generatorcommon.Solution.MWA
80
65
  }));
81
66
  };
82
67
  const getModuleCases = (length) => {
83
- const cases = (0, import_covertable.default)(ModuleValueMap, {
68
+ const cases = (0, _covertable.default)(ModuleValueMap, {
84
69
  length: length || Object.keys(ModuleValueMap).length
85
70
  });
86
71
  return cases.map((item) => ({
87
72
  ...item,
88
- solution: import_generator_common.Solution.Module
73
+ solution: _generatorcommon.Solution.Module
89
74
  }));
90
75
  };
91
76
  const getMonorepoCases = () => {
92
- const cases = (0, import_covertable.default)(MonorepoValueMap, {
77
+ const cases = (0, _covertable.default)(MonorepoValueMap, {
93
78
  length: Object.keys(MonorepoValueMap).length
94
79
  });
95
80
  return cases.map((item) => ({
96
81
  ...item,
97
- solution: import_generator_common.Solution.Monorepo
82
+ solution: _generatorcommon.Solution.Monorepo
98
83
  }));
99
84
  };
100
85
  const getMWAEntryCases = (_length) => {
@@ -107,35 +92,43 @@ const getMWAEntryCases = (_length) => {
107
92
  const MWAServerValueMap = {
108
93
  framework: FrameworkValues
109
94
  };
110
- const getMWAServerCases = () => (0, import_covertable.default)(MWAServerValueMap, {
95
+ const getMWAServerCases = () => (0, _covertable.default)(MWAServerValueMap, {
111
96
  length: Object.keys(MWAServerValueMap).length
112
97
  });
113
98
  const MWABFFValueMap = {
114
99
  bffType: BFFTypeValues,
115
100
  framework: FrameworkValues
116
101
  };
117
- const getMWABFFCases = (length) => (0, import_covertable.default)(MWABFFValueMap, {
102
+ const getMWABFFCases = (length) => (0, _covertable.default)(MWABFFValueMap, {
118
103
  length: length || Object.keys(MWABFFValueMap).length
119
104
  });
120
105
  const getMWANewCases = (length) => {
121
106
  const cases = [];
122
- import_generator_common.MWAActionTypes.forEach((action) => {
123
- const config = { actionType: action };
124
- import_generator_common.MWAActionTypesMap[action].forEach((option) => {
107
+ _generatorcommon.MWAActionTypes.forEach((action) => {
108
+ const config = {
109
+ actionType: action
110
+ };
111
+ _generatorcommon.MWAActionTypesMap[action].forEach((option) => {
125
112
  config[action] = option;
126
- const currentConfig = { ...config, [action]: option };
127
- if (option === import_generator_common.ActionElement.Entry) {
113
+ const currentConfig = {
114
+ ...config,
115
+ [action]: option
116
+ };
117
+ if (option === _generatorcommon.ActionElement.Entry) {
128
118
  const entryCases = getMWAEntryCases(length);
129
119
  entryCases.forEach((c) => {
130
- cases.push({ ...currentConfig, ...c });
120
+ cases.push({
121
+ ...currentConfig,
122
+ ...c
123
+ });
131
124
  });
132
- } else if (option === import_generator_common.ActionElement.Server) {
125
+ } else if (option === _generatorcommon.ActionElement.Server) {
133
126
  const serverCases = getMWAServerCases();
134
127
  cases.push({
135
128
  ...currentConfig,
136
129
  ...serverCases[Math.round(Math.random() * serverCases.length)]
137
130
  });
138
- } else if (option === import_generator_common.ActionFunction.BFF) {
131
+ } else if (option === _generatorcommon.ActionFunction.BFF) {
139
132
  const bffCases = getMWABFFCases(length);
140
133
  cases.push({
141
134
  ...currentConfig,
@@ -150,10 +143,15 @@ const getMWANewCases = (length) => {
150
143
  };
151
144
  const getModuleNewCases = () => {
152
145
  const cases = [];
153
- import_generator_common.ModuleActionTypes.forEach((action) => {
154
- const config = { actionType: action };
155
- import_generator_common.ModuleActionTypesMap[action].forEach((option) => {
156
- const currentConfig = { ...config, [action]: option };
146
+ _generatorcommon.ModuleActionTypes.forEach((action) => {
147
+ const config = {
148
+ actionType: action
149
+ };
150
+ _generatorcommon.ModuleActionTypesMap[action].forEach((option) => {
151
+ const currentConfig = {
152
+ ...config,
153
+ [action]: option
154
+ };
157
155
  cases.push(currentConfig);
158
156
  });
159
157
  });
@@ -166,25 +164,25 @@ const ModuleSubProjectValueMap = {
166
164
  language: LanguageValues
167
165
  };
168
166
  const getMWASubProjectCases = (isTest, length) => {
169
- const cases = (0, import_covertable.default)(MWASubProjectValueMap, {
167
+ const cases = (0, _covertable.default)(MWASubProjectValueMap, {
170
168
  length: length || Object.keys(MWASubProjectValueMap).length
171
169
  });
172
170
  return cases.map((item) => ({
173
171
  ...item,
174
172
  packageName: Object.values(item).join("-"),
175
173
  packagePath: Object.values(item).join("-"),
176
- solution: isTest ? import_generator_common.SubSolution.MWATest : import_generator_common.SubSolution.MWA
174
+ solution: isTest ? _generatorcommon.SubSolution.MWATest : _generatorcommon.SubSolution.MWA
177
175
  }));
178
176
  };
179
177
  const getModuleSubProjectCases = (isInner, length) => {
180
- const cases = (0, import_covertable.default)(ModuleSubProjectValueMap, {
178
+ const cases = (0, _covertable.default)(ModuleSubProjectValueMap, {
181
179
  length: length || Object.keys(ModuleSubProjectValueMap).length
182
180
  });
183
181
  return cases.map((item) => ({
184
182
  ...item,
185
183
  packageName: Object.values(item).join("-"),
186
184
  packagePath: Object.values(item).join("-"),
187
- solution: isInner ? import_generator_common.SubSolution.InnerModule : import_generator_common.SubSolution.Module
185
+ solution: isInner ? _generatorcommon.SubSolution.InnerModule : _generatorcommon.SubSolution.Module
188
186
  }));
189
187
  };
190
188
  const getMonorepoNewCases = (length) => {
@@ -196,25 +194,3 @@ const getMonorepoNewCases = (length) => {
196
194
  ];
197
195
  return cases;
198
196
  };
199
- // Annotate the CommonJS export names for ESM import in node:
200
- 0 && (module.exports = {
201
- BFFTypeValues,
202
- BooleanConfigValues,
203
- BuildToolsValues,
204
- FrameworkValues,
205
- LanguageValues,
206
- MWABFFValueMap,
207
- MWAServerValueMap,
208
- MWASubProjectValueMap,
209
- MWAValueMap,
210
- ModuleSubProjectValueMap,
211
- ModuleValueMap,
212
- MonorepoValueMap,
213
- PackageManagerValues,
214
- getMWACases,
215
- getMWANewCases,
216
- getModuleCases,
217
- getModuleNewCases,
218
- getMonorepoCases,
219
- getMonorepoNewCases
220
- });
package/dist/esm/index.js CHANGED
@@ -1,228 +1,236 @@
1
- function _arrayLikeToArray(arr, len) {
2
- if (len == null || len > arr.length) len = arr.length;
3
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
- return arr2;
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length)
3
+ len = arr.length;
4
+ for (var i = 0, arr2 = new Array(len); i < len; i++)
5
+ arr2[i] = arr[i];
6
+ return arr2;
5
7
  }
6
- function _arrayWithoutHoles(arr) {
7
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
8
+ function _array_without_holes(arr) {
9
+ if (Array.isArray(arr))
10
+ return _array_like_to_array(arr);
8
11
  }
9
- function _defineProperty(obj, key, value) {
10
- if (key in obj) {
11
- Object.defineProperty(obj, key, {
12
- value: value,
13
- enumerable: true,
14
- configurable: true,
15
- writable: true
16
- });
17
- } else {
18
- obj[key] = value;
19
- }
20
- return obj;
12
+ function _define_property(obj, key, value) {
13
+ if (key in obj) {
14
+ Object.defineProperty(obj, key, {
15
+ value,
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true
19
+ });
20
+ } else {
21
+ obj[key] = value;
22
+ }
23
+ return obj;
21
24
  }
22
- function _iterableToArray(iter) {
23
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
25
+ function _iterable_to_array(iter) {
26
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
27
+ return Array.from(iter);
24
28
  }
25
- function _nonIterableSpread() {
26
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
29
+ function _non_iterable_spread() {
30
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
27
31
  }
28
- function _objectSpread(target) {
29
- for(var i = 1; i < arguments.length; i++){
30
- var source = arguments[i] != null ? arguments[i] : {};
31
- var ownKeys = Object.keys(source);
32
- if (typeof Object.getOwnPropertySymbols === "function") {
33
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
34
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
35
- }));
36
- }
37
- ownKeys.forEach(function(key) {
38
- _defineProperty(target, key, source[key]);
39
- });
32
+ function _object_spread(target) {
33
+ for (var i = 1; i < arguments.length; i++) {
34
+ var source = arguments[i] != null ? arguments[i] : {};
35
+ var ownKeys2 = Object.keys(source);
36
+ if (typeof Object.getOwnPropertySymbols === "function") {
37
+ ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
38
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
39
+ }));
40
40
  }
41
- return target;
41
+ ownKeys2.forEach(function(key) {
42
+ _define_property(target, key, source[key]);
43
+ });
44
+ }
45
+ return target;
42
46
  }
43
47
  function ownKeys(object, enumerableOnly) {
44
- var keys = Object.keys(object);
45
- if (Object.getOwnPropertySymbols) {
46
- var symbols = Object.getOwnPropertySymbols(object);
47
- if (enumerableOnly) {
48
- symbols = symbols.filter(function(sym) {
49
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
50
- });
51
- }
52
- keys.push.apply(keys, symbols);
48
+ var keys = Object.keys(object);
49
+ if (Object.getOwnPropertySymbols) {
50
+ var symbols = Object.getOwnPropertySymbols(object);
51
+ if (enumerableOnly) {
52
+ symbols = symbols.filter(function(sym) {
53
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
54
+ });
53
55
  }
54
- return keys;
56
+ keys.push.apply(keys, symbols);
57
+ }
58
+ return keys;
55
59
  }
56
- function _objectSpreadProps(target, source) {
57
- source = source != null ? source : {};
58
- if (Object.getOwnPropertyDescriptors) {
59
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
60
- } else {
61
- ownKeys(Object(source)).forEach(function(key) {
62
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
63
- });
64
- }
65
- return target;
60
+ function _object_spread_props(target, source) {
61
+ source = source != null ? source : {};
62
+ if (Object.getOwnPropertyDescriptors) {
63
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
64
+ } else {
65
+ ownKeys(Object(source)).forEach(function(key) {
66
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
67
+ });
68
+ }
69
+ return target;
66
70
  }
67
- function _toConsumableArray(arr) {
68
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
71
+ function _to_consumable_array(arr) {
72
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
69
73
  }
70
- function _unsupportedIterableToArray(o, minLen) {
71
- if (!o) return;
72
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
73
- var n = Object.prototype.toString.call(o).slice(8, -1);
74
- if (n === "Object" && o.constructor) n = o.constructor.name;
75
- if (n === "Map" || n === "Set") return Array.from(n);
76
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
74
+ function _unsupported_iterable_to_array(o, minLen) {
75
+ if (!o)
76
+ return;
77
+ if (typeof o === "string")
78
+ return _array_like_to_array(o, minLen);
79
+ var n = Object.prototype.toString.call(o).slice(8, -1);
80
+ if (n === "Object" && o.constructor)
81
+ n = o.constructor.name;
82
+ if (n === "Map" || n === "Set")
83
+ return Array.from(n);
84
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
85
+ return _array_like_to_array(o, minLen);
77
86
  }
78
87
  import make from "covertable";
79
88
  import { Solution, PackageManager, Language, BooleanConfig, MWAActionTypes, MWAActionTypesMap, Framework, BFFType, ActionElement, ActionFunction, ModuleActionTypes, ModuleActionTypesMap, SubSolution, BuildTools } from "@modern-js/generator-common";
80
- var LanguageValues = Object.values(Language);
81
- var PackageManagerValues = Object.values(PackageManager);
82
- var BooleanConfigValues = Object.values(BooleanConfig);
83
- var FrameworkValues = Object.values(Framework);
84
- var BFFTypeValues = Object.values(BFFType);
85
- var BuildToolsValues = Object.values(BuildTools);
86
- var MWAValueMap = {
87
- language: LanguageValues,
88
- packageManager: PackageManagerValues,
89
- buildTools: BuildToolsValues
90
- };
91
- var ModuleValueMap = {
92
- language: LanguageValues,
93
- packageManager: PackageManagerValues
94
- };
95
- var MonorepoValueMap = {
96
- packageManager: PackageManagerValues.filter(function(packageManager) {
97
- return packageManager !== "npm";
98
- })
99
- };
100
- var getMWACases = function(length) {
101
- var cases = make(MWAValueMap, {
102
- length: length || Object.keys(MWAValueMap).length
103
- });
104
- return cases.map(function(item) {
105
- return _objectSpreadProps(_objectSpread({}, item), {
106
- solution: Solution.MWA
107
- });
89
+ export var LanguageValues = Object.values(Language);
90
+ export var PackageManagerValues = Object.values(PackageManager);
91
+ export var BooleanConfigValues = Object.values(BooleanConfig);
92
+ export var FrameworkValues = Object.values(Framework);
93
+ export var BFFTypeValues = Object.values(BFFType);
94
+ export var BuildToolsValues = Object.values(BuildTools);
95
+ export var MWAValueMap = {
96
+ language: LanguageValues,
97
+ packageManager: PackageManagerValues,
98
+ buildTools: BuildToolsValues
99
+ };
100
+ export var ModuleValueMap = {
101
+ language: LanguageValues,
102
+ packageManager: PackageManagerValues
103
+ };
104
+ export var MonorepoValueMap = {
105
+ packageManager: PackageManagerValues.filter(function(packageManager) {
106
+ return packageManager !== "npm";
107
+ })
108
+ };
109
+ export var getMWACases = function(length) {
110
+ var cases = make(MWAValueMap, {
111
+ length: length || Object.keys(MWAValueMap).length
112
+ });
113
+ return cases.map(function(item) {
114
+ return _object_spread_props(_object_spread({}, item), {
115
+ solution: Solution.MWA
108
116
  });
109
- };
110
- var getModuleCases = function(length) {
111
- var cases = make(ModuleValueMap, {
112
- length: length || Object.keys(ModuleValueMap).length
117
+ });
118
+ };
119
+ export var getModuleCases = function(length) {
120
+ var cases = make(ModuleValueMap, {
121
+ length: length || Object.keys(ModuleValueMap).length
122
+ });
123
+ return cases.map(function(item) {
124
+ return _object_spread_props(_object_spread({}, item), {
125
+ solution: Solution.Module
113
126
  });
114
- return cases.map(function(item) {
115
- return _objectSpreadProps(_objectSpread({}, item), {
116
- solution: Solution.Module
117
- });
118
- });
119
- };
120
- var getMonorepoCases = function() {
121
- var cases = make(MonorepoValueMap, {
122
- length: Object.keys(MonorepoValueMap).length
123
- });
124
- return cases.map(function(item) {
125
- return _objectSpreadProps(_objectSpread({}, item), {
126
- solution: Solution.Monorepo
127
- });
127
+ });
128
+ };
129
+ export var getMonorepoCases = function() {
130
+ var cases = make(MonorepoValueMap, {
131
+ length: Object.keys(MonorepoValueMap).length
132
+ });
133
+ return cases.map(function(item) {
134
+ return _object_spread_props(_object_spread({}, item), {
135
+ solution: Solution.Monorepo
128
136
  });
137
+ });
129
138
  };
130
139
  var getMWAEntryCases = function(_length) {
131
- return [
132
- {
133
- name: "test"
134
- }
135
- ];
140
+ return [
141
+ {
142
+ name: "test"
143
+ }
144
+ ];
136
145
  };
137
- var MWAServerValueMap = {
138
- framework: FrameworkValues
146
+ export var MWAServerValueMap = {
147
+ framework: FrameworkValues
139
148
  };
140
149
  var getMWAServerCases = function() {
141
- return make(MWAServerValueMap, {
142
- length: Object.keys(MWAServerValueMap).length
143
- });
150
+ return make(MWAServerValueMap, {
151
+ length: Object.keys(MWAServerValueMap).length
152
+ });
144
153
  };
145
- var MWABFFValueMap = {
146
- bffType: BFFTypeValues,
147
- framework: FrameworkValues
154
+ export var MWABFFValueMap = {
155
+ bffType: BFFTypeValues,
156
+ framework: FrameworkValues
148
157
  };
149
158
  var getMWABFFCases = function(length) {
150
- return make(MWABFFValueMap, {
151
- length: length || Object.keys(MWABFFValueMap).length
152
- });
153
- };
154
- var getMWANewCases = function(length) {
155
- var cases = [];
156
- MWAActionTypes.forEach(function(action) {
157
- var config = {
158
- actionType: action
159
- };
160
- MWAActionTypesMap[action].forEach(function(option) {
161
- config[action] = option;
162
- var currentConfig = _objectSpreadProps(_objectSpread({}, config), _defineProperty({}, action, option));
163
- if (option === ActionElement.Entry) {
164
- var entryCases = getMWAEntryCases(length);
165
- entryCases.forEach(function(c) {
166
- cases.push(_objectSpread({}, currentConfig, c));
167
- });
168
- } else if (option === ActionElement.Server) {
169
- var serverCases = getMWAServerCases();
170
- cases.push(_objectSpread({}, currentConfig, serverCases[Math.round(Math.random() * serverCases.length)]));
171
- } else if (option === ActionFunction.BFF) {
172
- var bffCases = getMWABFFCases(length);
173
- cases.push(_objectSpread({}, currentConfig, bffCases[Math.round(Math.random() * bffCases.length)]));
174
- } else {
175
- cases.push(currentConfig);
176
- }
159
+ return make(MWABFFValueMap, {
160
+ length: length || Object.keys(MWABFFValueMap).length
161
+ });
162
+ };
163
+ export var getMWANewCases = function(length) {
164
+ var cases = [];
165
+ MWAActionTypes.forEach(function(action) {
166
+ var config = {
167
+ actionType: action
168
+ };
169
+ MWAActionTypesMap[action].forEach(function(option) {
170
+ config[action] = option;
171
+ var currentConfig = _object_spread_props(_object_spread({}, config), _define_property({}, action, option));
172
+ if (option === ActionElement.Entry) {
173
+ var entryCases = getMWAEntryCases(length);
174
+ entryCases.forEach(function(c) {
175
+ cases.push(_object_spread({}, currentConfig, c));
177
176
  });
177
+ } else if (option === ActionElement.Server) {
178
+ var serverCases = getMWAServerCases();
179
+ cases.push(_object_spread({}, currentConfig, serverCases[Math.round(Math.random() * serverCases.length)]));
180
+ } else if (option === ActionFunction.BFF) {
181
+ var bffCases = getMWABFFCases(length);
182
+ cases.push(_object_spread({}, currentConfig, bffCases[Math.round(Math.random() * bffCases.length)]));
183
+ } else {
184
+ cases.push(currentConfig);
185
+ }
178
186
  });
179
- return cases;
180
- };
181
- var getModuleNewCases = function() {
182
- var cases = [];
183
- ModuleActionTypes.forEach(function(action) {
184
- var config = {
185
- actionType: action
186
- };
187
- ModuleActionTypesMap[action].forEach(function(option) {
188
- var currentConfig = _objectSpreadProps(_objectSpread({}, config), _defineProperty({}, action, option));
189
- cases.push(currentConfig);
190
- });
187
+ });
188
+ return cases;
189
+ };
190
+ export var getModuleNewCases = function() {
191
+ var cases = [];
192
+ ModuleActionTypes.forEach(function(action) {
193
+ var config = {
194
+ actionType: action
195
+ };
196
+ ModuleActionTypesMap[action].forEach(function(option) {
197
+ var currentConfig = _object_spread_props(_object_spread({}, config), _define_property({}, action, option));
198
+ cases.push(currentConfig);
191
199
  });
192
- return cases;
200
+ });
201
+ return cases;
193
202
  };
194
- var MWASubProjectValueMap = {
195
- language: LanguageValues
203
+ export var MWASubProjectValueMap = {
204
+ language: LanguageValues
196
205
  };
197
- var ModuleSubProjectValueMap = {
198
- language: LanguageValues
206
+ export var ModuleSubProjectValueMap = {
207
+ language: LanguageValues
199
208
  };
200
209
  var getMWASubProjectCases = function(isTest, length) {
201
- var cases = make(MWASubProjectValueMap, {
202
- length: length || Object.keys(MWASubProjectValueMap).length
203
- });
204
- return cases.map(function(item) {
205
- return _objectSpreadProps(_objectSpread({}, item), {
206
- packageName: Object.values(item).join("-"),
207
- packagePath: Object.values(item).join("-"),
208
- solution: isTest ? SubSolution.MWATest : SubSolution.MWA
209
- });
210
+ var cases = make(MWASubProjectValueMap, {
211
+ length: length || Object.keys(MWASubProjectValueMap).length
212
+ });
213
+ return cases.map(function(item) {
214
+ return _object_spread_props(_object_spread({}, item), {
215
+ packageName: Object.values(item).join("-"),
216
+ packagePath: Object.values(item).join("-"),
217
+ solution: isTest ? SubSolution.MWATest : SubSolution.MWA
210
218
  });
219
+ });
211
220
  };
212
221
  var getModuleSubProjectCases = function(isInner, length) {
213
- var cases = make(ModuleSubProjectValueMap, {
214
- length: length || Object.keys(ModuleSubProjectValueMap).length
215
- });
216
- return cases.map(function(item) {
217
- return _objectSpreadProps(_objectSpread({}, item), {
218
- packageName: Object.values(item).join("-"),
219
- packagePath: Object.values(item).join("-"),
220
- solution: isInner ? SubSolution.InnerModule : SubSolution.Module
221
- });
222
+ var cases = make(ModuleSubProjectValueMap, {
223
+ length: length || Object.keys(ModuleSubProjectValueMap).length
224
+ });
225
+ return cases.map(function(item) {
226
+ return _object_spread_props(_object_spread({}, item), {
227
+ packageName: Object.values(item).join("-"),
228
+ packagePath: Object.values(item).join("-"),
229
+ solution: isInner ? SubSolution.InnerModule : SubSolution.Module
222
230
  });
231
+ });
223
232
  };
224
- var getMonorepoNewCases = function(length) {
225
- var cases = _toConsumableArray(getMWASubProjectCases(false, length)).concat(_toConsumableArray(getMWASubProjectCases(true, length)), _toConsumableArray(getModuleSubProjectCases(false, length)), _toConsumableArray(getModuleSubProjectCases(true, length)));
226
- return cases;
233
+ export var getMonorepoNewCases = function(length) {
234
+ var cases = _to_consumable_array(getMWASubProjectCases(false, length)).concat(_to_consumable_array(getMWASubProjectCases(true, length)), _to_consumable_array(getModuleSubProjectCases(false, length)), _to_consumable_array(getModuleSubProjectCases(true, length)));
235
+ return cases;
227
236
  };
228
- export { BFFTypeValues, BooleanConfigValues, BuildToolsValues, FrameworkValues, LanguageValues, MWABFFValueMap, MWAServerValueMap, MWASubProjectValueMap, MWAValueMap, ModuleSubProjectValueMap, ModuleValueMap, MonorepoValueMap, PackageManagerValues, getMWACases, getMWANewCases, getModuleCases, getModuleNewCases, getMonorepoCases, getMonorepoNewCases };
@@ -1,41 +1,24 @@
1
1
  import make from "covertable";
2
- import {
3
- Solution,
4
- PackageManager,
5
- Language,
6
- BooleanConfig,
7
- MWAActionTypes,
8
- MWAActionTypesMap,
9
- Framework,
10
- BFFType,
11
- ActionElement,
12
- ActionFunction,
13
- ModuleActionTypes,
14
- ModuleActionTypesMap,
15
- SubSolution,
16
- BuildTools
17
- } from "@modern-js/generator-common";
18
- const LanguageValues = Object.values(Language);
19
- const PackageManagerValues = Object.values(PackageManager);
20
- const BooleanConfigValues = Object.values(BooleanConfig);
21
- const FrameworkValues = Object.values(Framework);
22
- const BFFTypeValues = Object.values(BFFType);
23
- const BuildToolsValues = Object.values(BuildTools);
24
- const MWAValueMap = {
2
+ import { Solution, PackageManager, Language, BooleanConfig, MWAActionTypes, MWAActionTypesMap, Framework, BFFType, ActionElement, ActionFunction, ModuleActionTypes, ModuleActionTypesMap, SubSolution, BuildTools } from "@modern-js/generator-common";
3
+ export const LanguageValues = Object.values(Language);
4
+ export const PackageManagerValues = Object.values(PackageManager);
5
+ export const BooleanConfigValues = Object.values(BooleanConfig);
6
+ export const FrameworkValues = Object.values(Framework);
7
+ export const BFFTypeValues = Object.values(BFFType);
8
+ export const BuildToolsValues = Object.values(BuildTools);
9
+ export const MWAValueMap = {
25
10
  language: LanguageValues,
26
11
  packageManager: PackageManagerValues,
27
12
  buildTools: BuildToolsValues
28
13
  };
29
- const ModuleValueMap = {
14
+ export const ModuleValueMap = {
30
15
  language: LanguageValues,
31
16
  packageManager: PackageManagerValues
32
17
  };
33
- const MonorepoValueMap = {
34
- packageManager: PackageManagerValues.filter(
35
- (packageManager) => packageManager !== "npm"
36
- )
18
+ export const MonorepoValueMap = {
19
+ packageManager: PackageManagerValues.filter((packageManager) => packageManager !== "npm")
37
20
  };
38
- const getMWACases = (length) => {
21
+ export const getMWACases = (length) => {
39
22
  const cases = make(MWAValueMap, {
40
23
  length: length || Object.keys(MWAValueMap).length
41
24
  });
@@ -44,7 +27,7 @@ const getMWACases = (length) => {
44
27
  solution: Solution.MWA
45
28
  }));
46
29
  };
47
- const getModuleCases = (length) => {
30
+ export const getModuleCases = (length) => {
48
31
  const cases = make(ModuleValueMap, {
49
32
  length: length || Object.keys(ModuleValueMap).length
50
33
  });
@@ -53,7 +36,7 @@ const getModuleCases = (length) => {
53
36
  solution: Solution.Module
54
37
  }));
55
38
  };
56
- const getMonorepoCases = () => {
39
+ export const getMonorepoCases = () => {
57
40
  const cases = make(MonorepoValueMap, {
58
41
  length: Object.keys(MonorepoValueMap).length
59
42
  });
@@ -69,30 +52,38 @@ const getMWAEntryCases = (_length) => {
69
52
  }
70
53
  ];
71
54
  };
72
- const MWAServerValueMap = {
55
+ export const MWAServerValueMap = {
73
56
  framework: FrameworkValues
74
57
  };
75
58
  const getMWAServerCases = () => make(MWAServerValueMap, {
76
59
  length: Object.keys(MWAServerValueMap).length
77
60
  });
78
- const MWABFFValueMap = {
61
+ export const MWABFFValueMap = {
79
62
  bffType: BFFTypeValues,
80
63
  framework: FrameworkValues
81
64
  };
82
65
  const getMWABFFCases = (length) => make(MWABFFValueMap, {
83
66
  length: length || Object.keys(MWABFFValueMap).length
84
67
  });
85
- const getMWANewCases = (length) => {
68
+ export const getMWANewCases = (length) => {
86
69
  const cases = [];
87
70
  MWAActionTypes.forEach((action) => {
88
- const config = { actionType: action };
71
+ const config = {
72
+ actionType: action
73
+ };
89
74
  MWAActionTypesMap[action].forEach((option) => {
90
75
  config[action] = option;
91
- const currentConfig = { ...config, [action]: option };
76
+ const currentConfig = {
77
+ ...config,
78
+ [action]: option
79
+ };
92
80
  if (option === ActionElement.Entry) {
93
81
  const entryCases = getMWAEntryCases(length);
94
82
  entryCases.forEach((c) => {
95
- cases.push({ ...currentConfig, ...c });
83
+ cases.push({
84
+ ...currentConfig,
85
+ ...c
86
+ });
96
87
  });
97
88
  } else if (option === ActionElement.Server) {
98
89
  const serverCases = getMWAServerCases();
@@ -113,21 +104,26 @@ const getMWANewCases = (length) => {
113
104
  });
114
105
  return cases;
115
106
  };
116
- const getModuleNewCases = () => {
107
+ export const getModuleNewCases = () => {
117
108
  const cases = [];
118
109
  ModuleActionTypes.forEach((action) => {
119
- const config = { actionType: action };
110
+ const config = {
111
+ actionType: action
112
+ };
120
113
  ModuleActionTypesMap[action].forEach((option) => {
121
- const currentConfig = { ...config, [action]: option };
114
+ const currentConfig = {
115
+ ...config,
116
+ [action]: option
117
+ };
122
118
  cases.push(currentConfig);
123
119
  });
124
120
  });
125
121
  return cases;
126
122
  };
127
- const MWASubProjectValueMap = {
123
+ export const MWASubProjectValueMap = {
128
124
  language: LanguageValues
129
125
  };
130
- const ModuleSubProjectValueMap = {
126
+ export const ModuleSubProjectValueMap = {
131
127
  language: LanguageValues
132
128
  };
133
129
  const getMWASubProjectCases = (isTest, length) => {
@@ -152,7 +148,7 @@ const getModuleSubProjectCases = (isInner, length) => {
152
148
  solution: isInner ? SubSolution.InnerModule : SubSolution.Module
153
149
  }));
154
150
  };
155
- const getMonorepoNewCases = (length) => {
151
+ export const getMonorepoNewCases = (length) => {
156
152
  const cases = [
157
153
  ...getMWASubProjectCases(false, length),
158
154
  ...getMWASubProjectCases(true, length),
@@ -161,24 +157,3 @@ const getMonorepoNewCases = (length) => {
161
157
  ];
162
158
  return cases;
163
159
  };
164
- export {
165
- BFFTypeValues,
166
- BooleanConfigValues,
167
- BuildToolsValues,
168
- FrameworkValues,
169
- LanguageValues,
170
- MWABFFValueMap,
171
- MWAServerValueMap,
172
- MWASubProjectValueMap,
173
- MWAValueMap,
174
- ModuleSubProjectValueMap,
175
- ModuleValueMap,
176
- MonorepoValueMap,
177
- PackageManagerValues,
178
- getMWACases,
179
- getMWANewCases,
180
- getModuleCases,
181
- getModuleNewCases,
182
- getMonorepoCases,
183
- getMonorepoNewCases
184
- };
package/package.json CHANGED
@@ -3,7 +3,11 @@
3
3
  "description": "A Progressive React Framework for modern web development.",
4
4
  "homepage": "https://modernjs.dev",
5
5
  "bugs": "https://github.com/web-infra-dev/modern.js/issues",
6
- "repository": "web-infra-dev/modern.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/web-infra-dev/modern.js",
9
+ "directory": "packages/generator/generator-cases"
10
+ },
7
11
  "license": "MIT",
8
12
  "keywords": [
9
13
  "react",
@@ -11,7 +15,7 @@
11
15
  "modern",
12
16
  "modern.js"
13
17
  ],
14
- "version": "3.1.8",
18
+ "version": "3.1.10",
15
19
  "jsnext:source": "./src/index.ts",
16
20
  "types": "./dist/types/index.d.ts",
17
21
  "main": "./dist/cjs/index.js",
@@ -29,15 +33,15 @@
29
33
  "dependencies": {
30
34
  "@babel/runtime": "^7.18.0",
31
35
  "covertable": "^2.2.2",
32
- "@modern-js/generator-common": "3.1.8"
36
+ "@modern-js/generator-common": "3.1.10"
33
37
  },
34
38
  "devDependencies": {
35
39
  "@types/jest": "^29",
36
40
  "@types/node": "^14",
37
41
  "typescript": "^4",
38
42
  "jest": "^29",
39
- "@scripts/build": "2.14.0",
40
- "@scripts/jest-config": "2.14.0"
43
+ "@scripts/build": "2.16.0",
44
+ "@scripts/jest-config": "2.16.0"
41
45
  },
42
46
  "sideEffects": false,
43
47
  "publishConfig": {