@modern-js/generator-cases 1.0.0-rc.2 → 1.0.0-rc.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.
- package/CHANGELOG.md +249 -0
- package/README.md +21 -20
- package/dist/js/modern/index.js +139 -1
- package/dist/js/node/index.js +160 -2
- package/dist/js/treeshaking/index.js +157 -1
- package/dist/types/index.d.ts +12 -2
- package/package.json +26 -13
- package/src/index.ts +164 -0
- package/tests/__snapshots__/index.test.ts.snap +1310 -0
- package/tests/index.test.ts +20 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# @modern-js/generator-cases
|
|
2
|
+
|
|
3
|
+
## 1.0.0-rc.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 224f7fe: fix server route match
|
|
8
|
+
- 30ac27c: feat: add generator package description
|
|
9
|
+
- 0fd196e: feat: fix bugs
|
|
10
|
+
- 204c626: feat: initial
|
|
11
|
+
- 63be0a5: fix: #118 #104
|
|
12
|
+
- Updated dependencies [224f7fe]
|
|
13
|
+
- Updated dependencies [30ac27c]
|
|
14
|
+
- Updated dependencies [0fd196e]
|
|
15
|
+
- Updated dependencies [204c626]
|
|
16
|
+
- Updated dependencies [63be0a5]
|
|
17
|
+
- @modern-js/generator-common@1.0.0-rc.24
|
|
18
|
+
|
|
19
|
+
## 1.0.0-rc.22
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 224f7fe: fix server route match
|
|
24
|
+
- 30ac27c: feat: add generator package description
|
|
25
|
+
- 0fd196e: feat: fix bugs
|
|
26
|
+
- 204c626: feat: initial
|
|
27
|
+
- 63be0a5: fix: #118 #104
|
|
28
|
+
- Updated dependencies [224f7fe]
|
|
29
|
+
- Updated dependencies [30ac27c]
|
|
30
|
+
- Updated dependencies [0fd196e]
|
|
31
|
+
- Updated dependencies [204c626]
|
|
32
|
+
- Updated dependencies [63be0a5]
|
|
33
|
+
- @modern-js/generator-common@1.0.0-rc.23
|
|
34
|
+
|
|
35
|
+
## 1.0.0-rc.21
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- 224f7fe: fix server route match
|
|
40
|
+
- 30ac27c: feat: add generator package description
|
|
41
|
+
- 0fd196e: feat: fix bugs
|
|
42
|
+
- 204c626: feat: initial
|
|
43
|
+
- 63be0a5: fix: #118 #104
|
|
44
|
+
- Updated dependencies [224f7fe]
|
|
45
|
+
- Updated dependencies [30ac27c]
|
|
46
|
+
- Updated dependencies [0fd196e]
|
|
47
|
+
- Updated dependencies [204c626]
|
|
48
|
+
- Updated dependencies [63be0a5]
|
|
49
|
+
- @modern-js/generator-common@1.0.0-rc.22
|
|
50
|
+
|
|
51
|
+
## 1.0.0-rc.20
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- 224f7fe: fix server route match
|
|
56
|
+
- 30ac27c: feat: add generator package description
|
|
57
|
+
- feat: fix bugs
|
|
58
|
+
- 204c626: feat: initial
|
|
59
|
+
- 63be0a5: fix: #118 #104
|
|
60
|
+
- Updated dependencies [224f7fe]
|
|
61
|
+
- Updated dependencies [30ac27c]
|
|
62
|
+
- Updated dependencies [undefined]
|
|
63
|
+
- Updated dependencies [204c626]
|
|
64
|
+
- Updated dependencies [63be0a5]
|
|
65
|
+
- @modern-js/generator-common@1.0.0-rc.21
|
|
66
|
+
|
|
67
|
+
## 1.0.0-rc.19
|
|
68
|
+
|
|
69
|
+
### Patch Changes
|
|
70
|
+
|
|
71
|
+
- 224f7fe: fix server route match
|
|
72
|
+
- 30ac27c: feat: add generator package description
|
|
73
|
+
- 204c626: feat: initial
|
|
74
|
+
- 63be0a5: fix: #118 #104
|
|
75
|
+
- Updated dependencies [224f7fe]
|
|
76
|
+
- Updated dependencies [30ac27c]
|
|
77
|
+
- Updated dependencies [204c626]
|
|
78
|
+
- Updated dependencies [63be0a5]
|
|
79
|
+
- @modern-js/generator-common@1.0.0-rc.20
|
|
80
|
+
|
|
81
|
+
## 1.0.0-rc.18
|
|
82
|
+
|
|
83
|
+
### Patch Changes
|
|
84
|
+
|
|
85
|
+
- 224f7fe: fix server route match
|
|
86
|
+
- 30ac27c: feat: add generator package description
|
|
87
|
+
- 204c626: feat: initial
|
|
88
|
+
- 63be0a5: fix: #118 #104
|
|
89
|
+
- Updated dependencies [224f7fe]
|
|
90
|
+
- Updated dependencies [30ac27c]
|
|
91
|
+
- Updated dependencies [204c626]
|
|
92
|
+
- Updated dependencies [63be0a5]
|
|
93
|
+
- @modern-js/generator-common@1.0.0-rc.19
|
|
94
|
+
|
|
95
|
+
## 1.0.0-rc.17
|
|
96
|
+
|
|
97
|
+
### Patch Changes
|
|
98
|
+
|
|
99
|
+
- 224f7fe: fix server route match
|
|
100
|
+
- 30ac27c: feat: add generator package description
|
|
101
|
+
- 204c626: feat: initial
|
|
102
|
+
- fix: #118 #104
|
|
103
|
+
- Updated dependencies [224f7fe]
|
|
104
|
+
- Updated dependencies [30ac27c]
|
|
105
|
+
- Updated dependencies [204c626]
|
|
106
|
+
- Updated dependencies [undefined]
|
|
107
|
+
- @modern-js/generator-common@1.0.0-rc.18
|
|
108
|
+
|
|
109
|
+
## 1.0.0-rc.16
|
|
110
|
+
|
|
111
|
+
### Patch Changes
|
|
112
|
+
|
|
113
|
+
- 224f7fe: fix server route match
|
|
114
|
+
- 30ac27c: feat: add generator package description
|
|
115
|
+
- 204c626: feat: initial
|
|
116
|
+
- Updated dependencies [224f7fe]
|
|
117
|
+
- Updated dependencies [30ac27c]
|
|
118
|
+
- Updated dependencies [204c626]
|
|
119
|
+
- @modern-js/generator-common@1.0.0-rc.17
|
|
120
|
+
|
|
121
|
+
## 1.0.0-rc.15
|
|
122
|
+
|
|
123
|
+
### Patch Changes
|
|
124
|
+
|
|
125
|
+
- 224f7fe: fix server route match
|
|
126
|
+
- 30ac27c: feat: add generator package description
|
|
127
|
+
- 204c626: feat: initial
|
|
128
|
+
- Updated dependencies [224f7fe]
|
|
129
|
+
- Updated dependencies [30ac27c]
|
|
130
|
+
- Updated dependencies [204c626]
|
|
131
|
+
- @modern-js/generator-common@1.0.0-rc.16
|
|
132
|
+
|
|
133
|
+
## 1.0.0-rc.14
|
|
134
|
+
|
|
135
|
+
### Patch Changes
|
|
136
|
+
|
|
137
|
+
- 224f7fe: fix server route match
|
|
138
|
+
- 204c626: feat: initial
|
|
139
|
+
- Updated dependencies [224f7fe]
|
|
140
|
+
- Updated dependencies [204c626]
|
|
141
|
+
- @modern-js/generator-common@1.0.0-rc.15
|
|
142
|
+
|
|
143
|
+
## 1.0.0-rc.13
|
|
144
|
+
|
|
145
|
+
### Patch Changes
|
|
146
|
+
|
|
147
|
+
- 224f7fe: fix server route match
|
|
148
|
+
- 204c626: feat: initial
|
|
149
|
+
- Updated dependencies [224f7fe]
|
|
150
|
+
- Updated dependencies [204c626]
|
|
151
|
+
- @modern-js/generator-common@1.0.0-rc.14
|
|
152
|
+
|
|
153
|
+
## 1.0.0-rc.12
|
|
154
|
+
|
|
155
|
+
### Patch Changes
|
|
156
|
+
|
|
157
|
+
- 224f7fe: fix server route match
|
|
158
|
+
- 204c626: feat: initial
|
|
159
|
+
- Updated dependencies [224f7fe]
|
|
160
|
+
- Updated dependencies [204c626]
|
|
161
|
+
- @modern-js/generator-common@1.0.0-rc.13
|
|
162
|
+
|
|
163
|
+
## 1.0.0-rc.11
|
|
164
|
+
|
|
165
|
+
### Patch Changes
|
|
166
|
+
|
|
167
|
+
- 224f7fe: fix server route match
|
|
168
|
+
- 204c626: feat: initial
|
|
169
|
+
- Updated dependencies [224f7fe]
|
|
170
|
+
- Updated dependencies [204c626]
|
|
171
|
+
- @modern-js/generator-common@1.0.0-rc.12
|
|
172
|
+
|
|
173
|
+
## 1.0.0-rc.10
|
|
174
|
+
|
|
175
|
+
### Patch Changes
|
|
176
|
+
|
|
177
|
+
- 224f7fe: fix server route match
|
|
178
|
+
- 204c626: feat: initial
|
|
179
|
+
- Updated dependencies [224f7fe]
|
|
180
|
+
- Updated dependencies [204c626]
|
|
181
|
+
- @modern-js/generator-common@1.0.0-rc.11
|
|
182
|
+
|
|
183
|
+
## 1.0.0-rc.9
|
|
184
|
+
|
|
185
|
+
### Patch Changes
|
|
186
|
+
|
|
187
|
+
- 224f7fe: fix server route match
|
|
188
|
+
- 204c626: feat: initial
|
|
189
|
+
- Updated dependencies [224f7fe]
|
|
190
|
+
- Updated dependencies [204c626]
|
|
191
|
+
- @modern-js/generator-common@1.0.0-rc.10
|
|
192
|
+
|
|
193
|
+
## 1.0.0-rc.8
|
|
194
|
+
|
|
195
|
+
### Patch Changes
|
|
196
|
+
|
|
197
|
+
- 224f7fe: fix server route match
|
|
198
|
+
- 204c626: feat: initial
|
|
199
|
+
- Updated dependencies [224f7fe]
|
|
200
|
+
- Updated dependencies [204c626]
|
|
201
|
+
- @modern-js/generator-common@1.0.0-rc.9
|
|
202
|
+
|
|
203
|
+
## 1.0.0-rc.7
|
|
204
|
+
|
|
205
|
+
### Patch Changes
|
|
206
|
+
|
|
207
|
+
- 224f7fe: fix server route match
|
|
208
|
+
- 204c626: feat: initial
|
|
209
|
+
- Updated dependencies [224f7fe]
|
|
210
|
+
- Updated dependencies [204c626]
|
|
211
|
+
- @modern-js/generator-common@1.0.0-rc.8
|
|
212
|
+
|
|
213
|
+
## 1.0.0-rc.6
|
|
214
|
+
|
|
215
|
+
### Patch Changes
|
|
216
|
+
|
|
217
|
+
- 224f7fe: fix server route match
|
|
218
|
+
- 204c626: feat: initial
|
|
219
|
+
- Updated dependencies [224f7fe]
|
|
220
|
+
- Updated dependencies [204c626]
|
|
221
|
+
- @modern-js/generator-common@1.0.0-rc.7
|
|
222
|
+
|
|
223
|
+
## 1.0.0-rc.5
|
|
224
|
+
|
|
225
|
+
### Patch Changes
|
|
226
|
+
|
|
227
|
+
- 224f7fe: fix server route match
|
|
228
|
+
- 204c626: feat: initial
|
|
229
|
+
- Updated dependencies [224f7fe]
|
|
230
|
+
- Updated dependencies [204c626]
|
|
231
|
+
- @modern-js/generator-common@1.0.0-rc.6
|
|
232
|
+
|
|
233
|
+
## 1.0.0-rc.4
|
|
234
|
+
|
|
235
|
+
### Patch Changes
|
|
236
|
+
|
|
237
|
+
- fix server route match
|
|
238
|
+
- 204c626: feat: initial
|
|
239
|
+
- Updated dependencies [undefined]
|
|
240
|
+
- Updated dependencies [204c626]
|
|
241
|
+
- @modern-js/generator-common@1.0.0-rc.5
|
|
242
|
+
|
|
243
|
+
## 1.0.0-rc.3
|
|
244
|
+
|
|
245
|
+
### Patch Changes
|
|
246
|
+
|
|
247
|
+
- feat: initial
|
|
248
|
+
- Updated dependencies [undefined]
|
|
249
|
+
- @modern-js/generator-common@1.0.0-rc.4
|
package/README.md
CHANGED
|
@@ -2,31 +2,32 @@
|
|
|
2
2
|
<p align="center">
|
|
3
3
|
<a href="https://modernjs.dev" target="blank"><img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png" width="300" alt="Modern.js Logo" /></a>
|
|
4
4
|
</p>
|
|
5
|
+
<p align="center">
|
|
6
|
+
现代 Web 工程体系
|
|
7
|
+
<br/>
|
|
8
|
+
<a href="https://modernjs.dev" target="blank">
|
|
9
|
+
modernjs.dev
|
|
10
|
+
</a>
|
|
11
|
+
</p>
|
|
12
|
+
<p align="center">
|
|
13
|
+
The meta-framework suite designed from scratch for frontend-focused modern web development
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
# Introduction
|
|
5
17
|
|
|
6
|
-
|
|
18
|
+
> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.
|
|
7
19
|
|
|
8
|
-
|
|
20
|
+
- 介绍 Modern.js (即将上线)
|
|
9
21
|
- [迈入现代 Web 开发](https://zhuanlan.zhihu.com/p/386607009)
|
|
10
22
|
- [现代 Web 开发者问卷调查报告](https://zhuanlan.zhihu.com/p/403206195)
|
|
23
|
+
- [字节跳动是如何落地微前端的](https://mp.weixin.qq.com/s/L9wbfNG5fTXF5bx7dcgj4Q)
|
|
11
24
|
|
|
12
|
-
##
|
|
13
|
-
|
|
14
|
-
Modern.js 的 1.0.0.rc 版已经发到 npm,目前在做测试改进,README 文档之后统一提供(现阶段加入测试和开发,可以发 [issue](https://github.com/modern-js-dev/modern.js/issues) 留微信联系),完整的文档站计划在10月14日上线
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
## Getting Started
|
|
30
26
|
|
|
27
|
+
- [Quick Start](https://modernjs.dev/docs/start)
|
|
28
|
+
- [Guides](https://modernjs.dev/docs/guides)
|
|
29
|
+
- [API References](https://modernjs.dev/docs/apis)
|
|
31
30
|
|
|
31
|
+
## Contributing
|
|
32
32
|
|
|
33
|
+
- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)
|
package/dist/js/modern/index.js
CHANGED
|
@@ -5,12 +5,14 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
7
|
import make from 'covertable';
|
|
8
|
-
import { Solution, PackageManager, Language, RunWay, BooleanConfig, ClientRoute } from '@modern-js/generator-common';
|
|
8
|
+
import { Solution, PackageManager, Language, RunWay, BooleanConfig, ClientRoute, MWAActionTypes, MWAActionTypesMap, Framework, BFFType, ActionElement, ActionFunction, ModuleActionTypes, ModuleActionTypesMap, SubSolution } from '@modern-js/generator-common';
|
|
9
9
|
export const LanguageValues = Object.values(Language);
|
|
10
10
|
export const PackageManagerValues = Object.values(PackageManager);
|
|
11
11
|
export const RunWayValues = Object.values(RunWay);
|
|
12
12
|
export const BooleanConfigValues = Object.values(BooleanConfig);
|
|
13
13
|
export const ClientRouteValues = Object.values(ClientRoute);
|
|
14
|
+
export const FrameworkValues = Object.values(Framework);
|
|
15
|
+
export const BFFTypeValues = Object.values(BFFType);
|
|
14
16
|
export const MWAValueMap = {
|
|
15
17
|
language: LanguageValues,
|
|
16
18
|
packageManager: PackageManagerValues,
|
|
@@ -68,4 +70,140 @@ export const getMonorepoCases = () => {
|
|
|
68
70
|
return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
|
|
69
71
|
solution: Solution.Monorepo
|
|
70
72
|
}));
|
|
73
|
+
};
|
|
74
|
+
export const MWAEntryValueMap = {
|
|
75
|
+
needModifyMWAConfig: BooleanConfigValues,
|
|
76
|
+
clientRoute: ClientRouteValues,
|
|
77
|
+
disableStateManagement: BooleanConfigValues
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const getMWAEntryCases = () => {
|
|
81
|
+
const cases = make(MWAEntryValueMap, {
|
|
82
|
+
length: Object.keys(MWAEntryValueMap).length
|
|
83
|
+
});
|
|
84
|
+
return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
|
|
85
|
+
name: Object.values(item).join('-')
|
|
86
|
+
}));
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const MWAServerValueMap = {
|
|
90
|
+
framework: FrameworkValues
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const getMWAServerCases = () => make(MWAServerValueMap, {
|
|
94
|
+
length: Object.keys(MWAServerValueMap).length
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
export const MWABFFValueMap = {
|
|
98
|
+
bffType: BFFTypeValues,
|
|
99
|
+
framework: FrameworkValues
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const getMWABFFCases = () => make(MWABFFValueMap, {
|
|
103
|
+
length: Object.keys(MWABFFValueMap).length
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
export const getMWANewCases = () => {
|
|
107
|
+
const cases = [];
|
|
108
|
+
MWAActionTypes.forEach(action => {
|
|
109
|
+
const config = {
|
|
110
|
+
actionType: action
|
|
111
|
+
};
|
|
112
|
+
MWAActionTypesMap[action].forEach(option => {
|
|
113
|
+
config[action] = option;
|
|
114
|
+
|
|
115
|
+
const currentConfig = _objectSpread(_objectSpread({}, config), {}, {
|
|
116
|
+
[action]: option
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
if (option === ActionElement.Entry) {
|
|
120
|
+
const entryCases = getMWAEntryCases();
|
|
121
|
+
entryCases.forEach(c => {
|
|
122
|
+
cases.push(_objectSpread(_objectSpread({}, currentConfig), c));
|
|
123
|
+
});
|
|
124
|
+
} else if (option === ActionElement.Server) {
|
|
125
|
+
// server only can enable once
|
|
126
|
+
const serverCases = getMWAServerCases();
|
|
127
|
+
cases.push(_objectSpread(_objectSpread({}, currentConfig), serverCases[Math.round(Math.random() * serverCases.length)]));
|
|
128
|
+
} else if (option === ActionFunction.BFF) {
|
|
129
|
+
// bff only can enable once
|
|
130
|
+
const bffCases = getMWABFFCases();
|
|
131
|
+
cases.push(_objectSpread(_objectSpread({}, currentConfig), bffCases[Math.round(Math.random() * bffCases.length)]));
|
|
132
|
+
} else {
|
|
133
|
+
cases.push(currentConfig);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
return cases;
|
|
138
|
+
};
|
|
139
|
+
export const getModuleNewCases = () => {
|
|
140
|
+
const cases = [];
|
|
141
|
+
ModuleActionTypes.forEach(action => {
|
|
142
|
+
const config = {
|
|
143
|
+
actionType: action
|
|
144
|
+
};
|
|
145
|
+
ModuleActionTypesMap[action].forEach(option => {
|
|
146
|
+
const currentConfig = _objectSpread(_objectSpread({}, config), {}, {
|
|
147
|
+
[action]: option
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
cases.push(currentConfig);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
return cases;
|
|
154
|
+
};
|
|
155
|
+
export const MWASubProjectValueMap = {
|
|
156
|
+
language: LanguageValues,
|
|
157
|
+
needModifyMWAConfig: BooleanConfigValues,
|
|
158
|
+
clientRoute: ClientRouteValues,
|
|
159
|
+
disableStateManagement: BooleanConfigValues,
|
|
160
|
+
enableLess: BooleanConfigValues,
|
|
161
|
+
enableSass: BooleanConfigValues
|
|
162
|
+
};
|
|
163
|
+
export const ModuleSubProjectValueMap = {
|
|
164
|
+
language: LanguageValues,
|
|
165
|
+
needModifyModuleConfig: BooleanConfigValues,
|
|
166
|
+
enableLess: BooleanConfigValues,
|
|
167
|
+
enableSass: BooleanConfigValues
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const getMWASubProjectCases = isTest => {
|
|
171
|
+
const cases = make(MWASubProjectValueMap, {
|
|
172
|
+
length: Object.keys(MWASubProjectValueMap).length,
|
|
173
|
+
postFilter: row => {
|
|
174
|
+
if (row.needModifyMWAConfig === BooleanConfig.NO && (row.disableStateManagement !== BooleanConfig.NO || row.clientRoute !== ClientRoute.SelfControlRoute || row.enableLess !== BooleanConfig.NO || row.enableSass !== BooleanConfig.NO)) {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
|
|
182
|
+
packageName: Object.values(item).join('-'),
|
|
183
|
+
packagePath: Object.values(item).join('-'),
|
|
184
|
+
solution: isTest ? SubSolution.MWATest : SubSolution.MWA
|
|
185
|
+
}));
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const getModuleSubProjectCases = isInner => {
|
|
189
|
+
const cases = make(ModuleSubProjectValueMap, {
|
|
190
|
+
length: Object.keys(ModuleSubProjectValueMap).length,
|
|
191
|
+
postFilter: row => {
|
|
192
|
+
if (row.needModifyModuleConfig === BooleanConfig.NO && (row.enableLess !== BooleanConfig.NO || row.enableSass !== BooleanConfig.NO)) {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
|
|
200
|
+
packageName: Object.values(item).join('-'),
|
|
201
|
+
packagePath: Object.values(item).join('-'),
|
|
202
|
+
solution: isInner ? SubSolution.InnerModule : SubSolution.Module
|
|
203
|
+
}));
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export const getMonorepoNewCases = () => {
|
|
207
|
+
const cases = [...getMWASubProjectCases(false), ...getMWASubProjectCases(true), ...getModuleSubProjectCases(false), ...getModuleSubProjectCases(true)];
|
|
208
|
+
return cases;
|
|
71
209
|
};
|
package/dist/js/node/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getMonorepoCases = exports.getModuleCases = exports.getMWACases = exports.RunWayValues = exports.PackageManagerValues = exports.MonorepoValueMap = exports.ModuleValueMap = exports.MWAValueMap = exports.LanguageValues = exports.ClientRouteValues = exports.BooleanConfigValues = void 0;
|
|
6
|
+
exports.getMonorepoNewCases = exports.getMonorepoCases = exports.getModuleNewCases = exports.getModuleCases = exports.getMWANewCases = exports.getMWACases = exports.RunWayValues = exports.PackageManagerValues = exports.MonorepoValueMap = exports.ModuleValueMap = exports.ModuleSubProjectValueMap = exports.MWAValueMap = exports.MWASubProjectValueMap = exports.MWAServerValueMap = exports.MWAEntryValueMap = exports.MWABFFValueMap = exports.LanguageValues = exports.FrameworkValues = exports.ClientRouteValues = exports.BooleanConfigValues = exports.BFFTypeValues = void 0;
|
|
7
7
|
|
|
8
8
|
var _covertable = _interopRequireDefault(require("covertable"));
|
|
9
9
|
|
|
@@ -27,6 +27,10 @@ const BooleanConfigValues = Object.values(_generatorCommon.BooleanConfig);
|
|
|
27
27
|
exports.BooleanConfigValues = BooleanConfigValues;
|
|
28
28
|
const ClientRouteValues = Object.values(_generatorCommon.ClientRoute);
|
|
29
29
|
exports.ClientRouteValues = ClientRouteValues;
|
|
30
|
+
const FrameworkValues = Object.values(_generatorCommon.Framework);
|
|
31
|
+
exports.FrameworkValues = FrameworkValues;
|
|
32
|
+
const BFFTypeValues = Object.values(_generatorCommon.BFFType);
|
|
33
|
+
exports.BFFTypeValues = BFFTypeValues;
|
|
30
34
|
const MWAValueMap = {
|
|
31
35
|
language: LanguageValues,
|
|
32
36
|
packageManager: PackageManagerValues,
|
|
@@ -96,4 +100,158 @@ const getMonorepoCases = () => {
|
|
|
96
100
|
}));
|
|
97
101
|
};
|
|
98
102
|
|
|
99
|
-
exports.getMonorepoCases = getMonorepoCases;
|
|
103
|
+
exports.getMonorepoCases = getMonorepoCases;
|
|
104
|
+
const MWAEntryValueMap = {
|
|
105
|
+
needModifyMWAConfig: BooleanConfigValues,
|
|
106
|
+
clientRoute: ClientRouteValues,
|
|
107
|
+
disableStateManagement: BooleanConfigValues
|
|
108
|
+
};
|
|
109
|
+
exports.MWAEntryValueMap = MWAEntryValueMap;
|
|
110
|
+
|
|
111
|
+
const getMWAEntryCases = () => {
|
|
112
|
+
const cases = (0, _covertable.default)(MWAEntryValueMap, {
|
|
113
|
+
length: Object.keys(MWAEntryValueMap).length
|
|
114
|
+
});
|
|
115
|
+
return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
|
|
116
|
+
name: Object.values(item).join('-')
|
|
117
|
+
}));
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const MWAServerValueMap = {
|
|
121
|
+
framework: FrameworkValues
|
|
122
|
+
};
|
|
123
|
+
exports.MWAServerValueMap = MWAServerValueMap;
|
|
124
|
+
|
|
125
|
+
const getMWAServerCases = () => (0, _covertable.default)(MWAServerValueMap, {
|
|
126
|
+
length: Object.keys(MWAServerValueMap).length
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const MWABFFValueMap = {
|
|
130
|
+
bffType: BFFTypeValues,
|
|
131
|
+
framework: FrameworkValues
|
|
132
|
+
};
|
|
133
|
+
exports.MWABFFValueMap = MWABFFValueMap;
|
|
134
|
+
|
|
135
|
+
const getMWABFFCases = () => (0, _covertable.default)(MWABFFValueMap, {
|
|
136
|
+
length: Object.keys(MWABFFValueMap).length
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const getMWANewCases = () => {
|
|
140
|
+
const cases = [];
|
|
141
|
+
|
|
142
|
+
_generatorCommon.MWAActionTypes.forEach(action => {
|
|
143
|
+
const config = {
|
|
144
|
+
actionType: action
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
_generatorCommon.MWAActionTypesMap[action].forEach(option => {
|
|
148
|
+
config[action] = option;
|
|
149
|
+
|
|
150
|
+
const currentConfig = _objectSpread(_objectSpread({}, config), {}, {
|
|
151
|
+
[action]: option
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
if (option === _generatorCommon.ActionElement.Entry) {
|
|
155
|
+
const entryCases = getMWAEntryCases();
|
|
156
|
+
entryCases.forEach(c => {
|
|
157
|
+
cases.push(_objectSpread(_objectSpread({}, currentConfig), c));
|
|
158
|
+
});
|
|
159
|
+
} else if (option === _generatorCommon.ActionElement.Server) {
|
|
160
|
+
// server only can enable once
|
|
161
|
+
const serverCases = getMWAServerCases();
|
|
162
|
+
cases.push(_objectSpread(_objectSpread({}, currentConfig), serverCases[Math.round(Math.random() * serverCases.length)]));
|
|
163
|
+
} else if (option === _generatorCommon.ActionFunction.BFF) {
|
|
164
|
+
// bff only can enable once
|
|
165
|
+
const bffCases = getMWABFFCases();
|
|
166
|
+
cases.push(_objectSpread(_objectSpread({}, currentConfig), bffCases[Math.round(Math.random() * bffCases.length)]));
|
|
167
|
+
} else {
|
|
168
|
+
cases.push(currentConfig);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
return cases;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
exports.getMWANewCases = getMWANewCases;
|
|
177
|
+
|
|
178
|
+
const getModuleNewCases = () => {
|
|
179
|
+
const cases = [];
|
|
180
|
+
|
|
181
|
+
_generatorCommon.ModuleActionTypes.forEach(action => {
|
|
182
|
+
const config = {
|
|
183
|
+
actionType: action
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
_generatorCommon.ModuleActionTypesMap[action].forEach(option => {
|
|
187
|
+
const currentConfig = _objectSpread(_objectSpread({}, config), {}, {
|
|
188
|
+
[action]: option
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
cases.push(currentConfig);
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
return cases;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
exports.getModuleNewCases = getModuleNewCases;
|
|
199
|
+
const MWASubProjectValueMap = {
|
|
200
|
+
language: LanguageValues,
|
|
201
|
+
needModifyMWAConfig: BooleanConfigValues,
|
|
202
|
+
clientRoute: ClientRouteValues,
|
|
203
|
+
disableStateManagement: BooleanConfigValues,
|
|
204
|
+
enableLess: BooleanConfigValues,
|
|
205
|
+
enableSass: BooleanConfigValues
|
|
206
|
+
};
|
|
207
|
+
exports.MWASubProjectValueMap = MWASubProjectValueMap;
|
|
208
|
+
const ModuleSubProjectValueMap = {
|
|
209
|
+
language: LanguageValues,
|
|
210
|
+
needModifyModuleConfig: BooleanConfigValues,
|
|
211
|
+
enableLess: BooleanConfigValues,
|
|
212
|
+
enableSass: BooleanConfigValues
|
|
213
|
+
};
|
|
214
|
+
exports.ModuleSubProjectValueMap = ModuleSubProjectValueMap;
|
|
215
|
+
|
|
216
|
+
const getMWASubProjectCases = isTest => {
|
|
217
|
+
const cases = (0, _covertable.default)(MWASubProjectValueMap, {
|
|
218
|
+
length: Object.keys(MWASubProjectValueMap).length,
|
|
219
|
+
postFilter: row => {
|
|
220
|
+
if (row.needModifyMWAConfig === _generatorCommon.BooleanConfig.NO && (row.disableStateManagement !== _generatorCommon.BooleanConfig.NO || row.clientRoute !== _generatorCommon.ClientRoute.SelfControlRoute || row.enableLess !== _generatorCommon.BooleanConfig.NO || row.enableSass !== _generatorCommon.BooleanConfig.NO)) {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
|
|
228
|
+
packageName: Object.values(item).join('-'),
|
|
229
|
+
packagePath: Object.values(item).join('-'),
|
|
230
|
+
solution: isTest ? _generatorCommon.SubSolution.MWATest : _generatorCommon.SubSolution.MWA
|
|
231
|
+
}));
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
const getModuleSubProjectCases = isInner => {
|
|
235
|
+
const cases = (0, _covertable.default)(ModuleSubProjectValueMap, {
|
|
236
|
+
length: Object.keys(ModuleSubProjectValueMap).length,
|
|
237
|
+
postFilter: row => {
|
|
238
|
+
if (row.needModifyModuleConfig === _generatorCommon.BooleanConfig.NO && (row.enableLess !== _generatorCommon.BooleanConfig.NO || row.enableSass !== _generatorCommon.BooleanConfig.NO)) {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
|
|
246
|
+
packageName: Object.values(item).join('-'),
|
|
247
|
+
packagePath: Object.values(item).join('-'),
|
|
248
|
+
solution: isInner ? _generatorCommon.SubSolution.InnerModule : _generatorCommon.SubSolution.Module
|
|
249
|
+
}));
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
const getMonorepoNewCases = () => {
|
|
253
|
+
const cases = [...getMWASubProjectCases(false), ...getMWASubProjectCases(true), ...getModuleSubProjectCases(false), ...getModuleSubProjectCases(true)];
|
|
254
|
+
return cases;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
exports.getMonorepoNewCases = getMonorepoNewCases;
|