@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 +18 -0
- package/dist/cjs/index.js +72 -96
- package/dist/esm/index.js +197 -189
- package/dist/esm-node/index.js +39 -64
- package/package.json +9 -5
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
35
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
const
|
|
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,
|
|
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:
|
|
64
|
+
solution: _generatorcommon.Solution.MWA
|
|
80
65
|
}));
|
|
81
66
|
};
|
|
82
67
|
const getModuleCases = (length) => {
|
|
83
|
-
const cases = (0,
|
|
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:
|
|
73
|
+
solution: _generatorcommon.Solution.Module
|
|
89
74
|
}));
|
|
90
75
|
};
|
|
91
76
|
const getMonorepoCases = () => {
|
|
92
|
-
const cases = (0,
|
|
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:
|
|
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,
|
|
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,
|
|
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
|
-
|
|
123
|
-
const config = {
|
|
124
|
-
|
|
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 = {
|
|
127
|
-
|
|
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({
|
|
120
|
+
cases.push({
|
|
121
|
+
...currentConfig,
|
|
122
|
+
...c
|
|
123
|
+
});
|
|
131
124
|
});
|
|
132
|
-
} else if (option ===
|
|
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 ===
|
|
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
|
-
|
|
154
|
-
const config = {
|
|
155
|
-
|
|
156
|
-
|
|
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,
|
|
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 ?
|
|
174
|
+
solution: isTest ? _generatorcommon.SubSolution.MWATest : _generatorcommon.SubSolution.MWA
|
|
177
175
|
}));
|
|
178
176
|
};
|
|
179
177
|
const getModuleSubProjectCases = (isInner, length) => {
|
|
180
|
-
const cases = (0,
|
|
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 ?
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
|
7
|
-
|
|
8
|
+
function _array_without_holes(arr) {
|
|
9
|
+
if (Array.isArray(arr))
|
|
10
|
+
return _array_like_to_array(arr);
|
|
8
11
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
|
23
|
-
|
|
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
|
|
26
|
-
|
|
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
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
56
|
+
keys.push.apply(keys, symbols);
|
|
57
|
+
}
|
|
58
|
+
return keys;
|
|
55
59
|
}
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
|
68
|
-
|
|
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
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
};
|
|
91
|
-
var ModuleValueMap = {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
};
|
|
95
|
-
var MonorepoValueMap = {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
};
|
|
100
|
-
var getMWACases = function(length) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
140
|
+
return [
|
|
141
|
+
{
|
|
142
|
+
name: "test"
|
|
143
|
+
}
|
|
144
|
+
];
|
|
136
145
|
};
|
|
137
|
-
var MWAServerValueMap = {
|
|
138
|
-
|
|
146
|
+
export var MWAServerValueMap = {
|
|
147
|
+
framework: FrameworkValues
|
|
139
148
|
};
|
|
140
149
|
var getMWAServerCases = function() {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
150
|
+
return make(MWAServerValueMap, {
|
|
151
|
+
length: Object.keys(MWAServerValueMap).length
|
|
152
|
+
});
|
|
144
153
|
};
|
|
145
|
-
var MWABFFValueMap = {
|
|
146
|
-
|
|
147
|
-
|
|
154
|
+
export var MWABFFValueMap = {
|
|
155
|
+
bffType: BFFTypeValues,
|
|
156
|
+
framework: FrameworkValues
|
|
148
157
|
};
|
|
149
158
|
var getMWABFFCases = function(length) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
};
|
|
154
|
-
var getMWANewCases = function(length) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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
|
-
|
|
200
|
+
});
|
|
201
|
+
return cases;
|
|
193
202
|
};
|
|
194
|
-
var MWASubProjectValueMap = {
|
|
195
|
-
|
|
203
|
+
export var MWASubProjectValueMap = {
|
|
204
|
+
language: LanguageValues
|
|
196
205
|
};
|
|
197
|
-
var ModuleSubProjectValueMap = {
|
|
198
|
-
|
|
206
|
+
export var ModuleSubProjectValueMap = {
|
|
207
|
+
language: LanguageValues
|
|
199
208
|
};
|
|
200
209
|
var getMWASubProjectCases = function(isTest, length) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
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
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
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
|
-
|
|
226
|
-
|
|
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 };
|
package/dist/esm-node/index.js
CHANGED
|
@@ -1,41 +1,24 @@
|
|
|
1
1
|
import make from "covertable";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 = {
|
|
71
|
+
const config = {
|
|
72
|
+
actionType: action
|
|
73
|
+
};
|
|
89
74
|
MWAActionTypesMap[action].forEach((option) => {
|
|
90
75
|
config[action] = option;
|
|
91
|
-
const currentConfig = {
|
|
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({
|
|
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 = {
|
|
110
|
+
const config = {
|
|
111
|
+
actionType: action
|
|
112
|
+
};
|
|
120
113
|
ModuleActionTypesMap[action].forEach((option) => {
|
|
121
|
-
const currentConfig = {
|
|
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":
|
|
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.
|
|
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.
|
|
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.
|
|
40
|
-
"@scripts/jest-config": "2.
|
|
43
|
+
"@scripts/build": "2.16.0",
|
|
44
|
+
"@scripts/jest-config": "2.16.0"
|
|
41
45
|
},
|
|
42
46
|
"sideEffects": false,
|
|
43
47
|
"publishConfig": {
|