@modern-js/generator-cases 3.0.0-beta.3 → 3.0.0-beta.4

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,16 @@
1
1
  # @modern-js/generator-cases
2
2
 
3
+ ## 3.0.0-beta.4
4
+
5
+ ### Major Changes
6
+
7
+ - dda38c9c3e: chore: v2
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [dda38c9c3e]
12
+ - @modern-js/generator-common@3.0.0-beta.4
13
+
3
14
  ## 3.0.0-beta.3
4
15
 
5
16
  ### Major Changes
@@ -1,90 +1,118 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3
- 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; }
4
- import make from 'covertable';
5
- import { Solution, PackageManager, Language, BooleanConfig, MWAActionTypes, MWAActionTypesMap, Framework, BFFType, ActionElement, ActionFunction, ModuleActionTypes, ModuleActionTypesMap, SubSolution } from '@modern-js/generator-common';
6
- export const LanguageValues = Object.values(Language);
7
- export const PackageManagerValues = Object.values(PackageManager);
8
- export const BooleanConfigValues = Object.values(BooleanConfig);
9
- export const FrameworkValues = Object.values(Framework);
10
- export const BFFTypeValues = Object.values(BFFType);
11
- export const MWAValueMap = {
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import make from "covertable";
21
+ import {
22
+ Solution,
23
+ PackageManager,
24
+ Language,
25
+ BooleanConfig,
26
+ MWAActionTypes,
27
+ MWAActionTypesMap,
28
+ Framework,
29
+ BFFType,
30
+ ActionElement,
31
+ ActionFunction,
32
+ ModuleActionTypes,
33
+ ModuleActionTypesMap,
34
+ SubSolution
35
+ } from "@modern-js/generator-common";
36
+ const LanguageValues = Object.values(Language);
37
+ const PackageManagerValues = Object.values(PackageManager);
38
+ const BooleanConfigValues = Object.values(BooleanConfig);
39
+ const FrameworkValues = Object.values(Framework);
40
+ const BFFTypeValues = Object.values(BFFType);
41
+ const MWAValueMap = {
12
42
  language: LanguageValues,
13
43
  packageManager: PackageManagerValues
14
44
  };
15
- export const ModuleValueMap = {
45
+ const ModuleValueMap = {
16
46
  language: LanguageValues,
17
47
  packageManager: PackageManagerValues
18
48
  };
19
- export const MonorepoValueMap = {
20
- packageManager: PackageManagerValues.filter(packageManager => packageManager !== 'npm')
49
+ const MonorepoValueMap = {
50
+ packageManager: PackageManagerValues.filter(
51
+ (packageManager) => packageManager !== "npm"
52
+ )
21
53
  };
22
- export const getMWACases = length => {
54
+ const getMWACases = (length) => {
23
55
  const cases = make(MWAValueMap, {
24
56
  length: length || Object.keys(MWAValueMap).length
25
57
  });
26
- return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
58
+ return cases.map((item) => __spreadProps(__spreadValues({}, item), {
27
59
  solution: Solution.MWA
28
60
  }));
29
61
  };
30
- export const getModuleCases = length => {
62
+ const getModuleCases = (length) => {
31
63
  const cases = make(ModuleValueMap, {
32
64
  length: length || Object.keys(ModuleValueMap).length
33
65
  });
34
- return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
66
+ return cases.map((item) => __spreadProps(__spreadValues({}, item), {
35
67
  solution: Solution.Module
36
68
  }));
37
69
  };
38
- export const getMonorepoCases = () => {
70
+ const getMonorepoCases = () => {
39
71
  const cases = make(MonorepoValueMap, {
40
72
  length: Object.keys(MonorepoValueMap).length
41
73
  });
42
- return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
74
+ return cases.map((item) => __spreadProps(__spreadValues({}, item), {
43
75
  solution: Solution.Monorepo
44
76
  }));
45
77
  };
46
- const getMWAEntryCases = _length => {
47
- return [{
48
- name: 'test'
49
- }];
78
+ const getMWAEntryCases = (_length) => {
79
+ return [
80
+ {
81
+ name: "test"
82
+ }
83
+ ];
50
84
  };
51
- export const MWAServerValueMap = {
85
+ const MWAServerValueMap = {
52
86
  framework: FrameworkValues
53
87
  };
54
88
  const getMWAServerCases = () => make(MWAServerValueMap, {
55
89
  length: Object.keys(MWAServerValueMap).length
56
90
  });
57
- export const MWABFFValueMap = {
91
+ const MWABFFValueMap = {
58
92
  bffType: BFFTypeValues,
59
93
  framework: FrameworkValues
60
94
  };
61
- const getMWABFFCases = length => make(MWABFFValueMap, {
95
+ const getMWABFFCases = (length) => make(MWABFFValueMap, {
62
96
  length: length || Object.keys(MWABFFValueMap).length
63
97
  });
64
- export const getMWANewCases = length => {
98
+ const getMWANewCases = (length) => {
65
99
  const cases = [];
66
- MWAActionTypes.forEach(action => {
67
- const config = {
68
- actionType: action
69
- };
70
- MWAActionTypesMap[action].forEach(option => {
100
+ MWAActionTypes.forEach((action) => {
101
+ const config = { actionType: action };
102
+ MWAActionTypesMap[action].forEach((option) => {
71
103
  config[action] = option;
72
- const currentConfig = _objectSpread(_objectSpread({}, config), {}, {
73
- [action]: option
74
- });
104
+ const currentConfig = __spreadProps(__spreadValues({}, config), { [action]: option });
75
105
  if (option === ActionElement.Entry) {
76
106
  const entryCases = getMWAEntryCases(length);
77
- entryCases.forEach(c => {
78
- cases.push(_objectSpread(_objectSpread({}, currentConfig), c));
107
+ entryCases.forEach((c) => {
108
+ cases.push(__spreadValues(__spreadValues({}, currentConfig), c));
79
109
  });
80
110
  } else if (option === ActionElement.Server) {
81
- // server only can enable once
82
111
  const serverCases = getMWAServerCases();
83
- cases.push(_objectSpread(_objectSpread({}, currentConfig), serverCases[Math.round(Math.random() * serverCases.length)]));
112
+ cases.push(__spreadValues(__spreadValues({}, currentConfig), serverCases[Math.round(Math.random() * serverCases.length)]));
84
113
  } else if (option === ActionFunction.BFF) {
85
- // bff only can enable once
86
114
  const bffCases = getMWABFFCases(length);
87
- cases.push(_objectSpread(_objectSpread({}, currentConfig), bffCases[Math.round(Math.random() * bffCases.length)]));
115
+ cases.push(__spreadValues(__spreadValues({}, currentConfig), bffCases[Math.round(Math.random() * bffCases.length)]));
88
116
  } else {
89
117
  cases.push(currentConfig);
90
118
  }
@@ -92,34 +120,30 @@ export const getMWANewCases = length => {
92
120
  });
93
121
  return cases;
94
122
  };
95
- export const getModuleNewCases = () => {
123
+ const getModuleNewCases = () => {
96
124
  const cases = [];
97
- ModuleActionTypes.forEach(action => {
98
- const config = {
99
- actionType: action
100
- };
101
- ModuleActionTypesMap[action].forEach(option => {
102
- const currentConfig = _objectSpread(_objectSpread({}, config), {}, {
103
- [action]: option
104
- });
125
+ ModuleActionTypes.forEach((action) => {
126
+ const config = { actionType: action };
127
+ ModuleActionTypesMap[action].forEach((option) => {
128
+ const currentConfig = __spreadProps(__spreadValues({}, config), { [action]: option });
105
129
  cases.push(currentConfig);
106
130
  });
107
131
  });
108
132
  return cases;
109
133
  };
110
- export const MWASubProjectValueMap = {
134
+ const MWASubProjectValueMap = {
111
135
  language: LanguageValues
112
136
  };
113
- export const ModuleSubProjectValueMap = {
137
+ const ModuleSubProjectValueMap = {
114
138
  language: LanguageValues
115
139
  };
116
140
  const getMWASubProjectCases = (isTest, length) => {
117
141
  const cases = make(MWASubProjectValueMap, {
118
142
  length: length || Object.keys(MWASubProjectValueMap).length
119
143
  });
120
- return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
121
- packageName: Object.values(item).join('-'),
122
- packagePath: Object.values(item).join('-'),
144
+ return cases.map((item) => __spreadProps(__spreadValues({}, item), {
145
+ packageName: Object.values(item).join("-"),
146
+ packagePath: Object.values(item).join("-"),
123
147
  solution: isTest ? SubSolution.MWATest : SubSolution.MWA
124
148
  }));
125
149
  };
@@ -127,13 +151,38 @@ const getModuleSubProjectCases = (isInner, length) => {
127
151
  const cases = make(ModuleSubProjectValueMap, {
128
152
  length: length || Object.keys(ModuleSubProjectValueMap).length
129
153
  });
130
- return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
131
- packageName: Object.values(item).join('-'),
132
- packagePath: Object.values(item).join('-'),
154
+ return cases.map((item) => __spreadProps(__spreadValues({}, item), {
155
+ packageName: Object.values(item).join("-"),
156
+ packagePath: Object.values(item).join("-"),
133
157
  solution: isInner ? SubSolution.InnerModule : SubSolution.Module
134
158
  }));
135
159
  };
136
- export const getMonorepoNewCases = length => {
137
- const cases = [...getMWASubProjectCases(false, length), ...getMWASubProjectCases(true, length), ...getModuleSubProjectCases(false, length), ...getModuleSubProjectCases(true, length)];
160
+ const getMonorepoNewCases = (length) => {
161
+ const cases = [
162
+ ...getMWASubProjectCases(false, length),
163
+ ...getMWASubProjectCases(true, length),
164
+ ...getModuleSubProjectCases(false, length),
165
+ ...getModuleSubProjectCases(true, length)
166
+ ];
138
167
  return cases;
139
- };
168
+ };
169
+ export {
170
+ BFFTypeValues,
171
+ BooleanConfigValues,
172
+ FrameworkValues,
173
+ LanguageValues,
174
+ MWABFFValueMap,
175
+ MWAServerValueMap,
176
+ MWASubProjectValueMap,
177
+ MWAValueMap,
178
+ ModuleSubProjectValueMap,
179
+ ModuleValueMap,
180
+ MonorepoValueMap,
181
+ PackageManagerValues,
182
+ getMWACases,
183
+ getMWANewCases,
184
+ getModuleCases,
185
+ getModuleNewCases,
186
+ getMonorepoCases,
187
+ getMonorepoNewCases
188
+ };
@@ -1,110 +1,149 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
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) => {
8
+ 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
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
+ var stdin_exports = {};
25
+ __export(stdin_exports, {
26
+ BFFTypeValues: () => BFFTypeValues,
27
+ BooleanConfigValues: () => BooleanConfigValues,
28
+ FrameworkValues: () => FrameworkValues,
29
+ LanguageValues: () => LanguageValues,
30
+ MWABFFValueMap: () => MWABFFValueMap,
31
+ MWAServerValueMap: () => MWAServerValueMap,
32
+ MWASubProjectValueMap: () => MWASubProjectValueMap,
33
+ MWAValueMap: () => MWAValueMap,
34
+ ModuleSubProjectValueMap: () => ModuleSubProjectValueMap,
35
+ ModuleValueMap: () => ModuleValueMap,
36
+ MonorepoValueMap: () => MonorepoValueMap,
37
+ PackageManagerValues: () => PackageManagerValues,
38
+ getMWACases: () => getMWACases,
39
+ getMWANewCases: () => getMWANewCases,
40
+ getModuleCases: () => getModuleCases,
41
+ getModuleNewCases: () => getModuleNewCases,
42
+ getMonorepoCases: () => getMonorepoCases,
43
+ getMonorepoNewCases: () => getMonorepoNewCases
5
44
  });
6
- exports.getMonorepoNewCases = exports.getMonorepoCases = exports.getModuleNewCases = exports.getModuleCases = exports.getMWANewCases = exports.getMWACases = exports.PackageManagerValues = exports.MonorepoValueMap = exports.ModuleValueMap = exports.ModuleSubProjectValueMap = exports.MWAValueMap = exports.MWASubProjectValueMap = exports.MWAServerValueMap = exports.MWABFFValueMap = exports.LanguageValues = exports.FrameworkValues = exports.BooleanConfigValues = exports.BFFTypeValues = void 0;
7
- var _covertable = _interopRequireDefault(require("covertable"));
8
- var _generatorCommon = require("@modern-js/generator-common");
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
- 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; }
13
- const LanguageValues = Object.values(_generatorCommon.Language);
14
- exports.LanguageValues = LanguageValues;
15
- const PackageManagerValues = Object.values(_generatorCommon.PackageManager);
16
- exports.PackageManagerValues = PackageManagerValues;
17
- const BooleanConfigValues = Object.values(_generatorCommon.BooleanConfig);
18
- exports.BooleanConfigValues = BooleanConfigValues;
19
- const FrameworkValues = Object.values(_generatorCommon.Framework);
20
- exports.FrameworkValues = FrameworkValues;
21
- const BFFTypeValues = Object.values(_generatorCommon.BFFType);
22
- exports.BFFTypeValues = BFFTypeValues;
45
+ module.exports = __toCommonJS(stdin_exports);
46
+ var import_covertable = __toESM(require("covertable"));
47
+ var import_generator_common = require("@modern-js/generator-common");
48
+ var __defProp2 = Object.defineProperty;
49
+ var __defProps = Object.defineProperties;
50
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
51
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
52
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
53
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
54
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
55
+ var __spreadValues = (a, b) => {
56
+ for (var prop in b || (b = {}))
57
+ if (__hasOwnProp2.call(b, prop))
58
+ __defNormalProp(a, prop, b[prop]);
59
+ if (__getOwnPropSymbols)
60
+ for (var prop of __getOwnPropSymbols(b)) {
61
+ if (__propIsEnum.call(b, prop))
62
+ __defNormalProp(a, prop, b[prop]);
63
+ }
64
+ return a;
65
+ };
66
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
67
+ const LanguageValues = Object.values(import_generator_common.Language);
68
+ const PackageManagerValues = Object.values(import_generator_common.PackageManager);
69
+ const BooleanConfigValues = Object.values(import_generator_common.BooleanConfig);
70
+ const FrameworkValues = Object.values(import_generator_common.Framework);
71
+ const BFFTypeValues = Object.values(import_generator_common.BFFType);
23
72
  const MWAValueMap = {
24
73
  language: LanguageValues,
25
74
  packageManager: PackageManagerValues
26
75
  };
27
- exports.MWAValueMap = MWAValueMap;
28
76
  const ModuleValueMap = {
29
77
  language: LanguageValues,
30
78
  packageManager: PackageManagerValues
31
79
  };
32
- exports.ModuleValueMap = ModuleValueMap;
33
80
  const MonorepoValueMap = {
34
- packageManager: PackageManagerValues.filter(packageManager => packageManager !== 'npm')
81
+ packageManager: PackageManagerValues.filter(
82
+ (packageManager) => packageManager !== "npm"
83
+ )
35
84
  };
36
- exports.MonorepoValueMap = MonorepoValueMap;
37
- const getMWACases = length => {
38
- const cases = (0, _covertable.default)(MWAValueMap, {
85
+ const getMWACases = (length) => {
86
+ const cases = (0, import_covertable.default)(MWAValueMap, {
39
87
  length: length || Object.keys(MWAValueMap).length
40
88
  });
41
- return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
42
- solution: _generatorCommon.Solution.MWA
89
+ return cases.map((item) => __spreadProps(__spreadValues({}, item), {
90
+ solution: import_generator_common.Solution.MWA
43
91
  }));
44
92
  };
45
- exports.getMWACases = getMWACases;
46
- const getModuleCases = length => {
47
- const cases = (0, _covertable.default)(ModuleValueMap, {
93
+ const getModuleCases = (length) => {
94
+ const cases = (0, import_covertable.default)(ModuleValueMap, {
48
95
  length: length || Object.keys(ModuleValueMap).length
49
96
  });
50
- return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
51
- solution: _generatorCommon.Solution.Module
97
+ return cases.map((item) => __spreadProps(__spreadValues({}, item), {
98
+ solution: import_generator_common.Solution.Module
52
99
  }));
53
100
  };
54
- exports.getModuleCases = getModuleCases;
55
101
  const getMonorepoCases = () => {
56
- const cases = (0, _covertable.default)(MonorepoValueMap, {
102
+ const cases = (0, import_covertable.default)(MonorepoValueMap, {
57
103
  length: Object.keys(MonorepoValueMap).length
58
104
  });
59
- return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
60
- solution: _generatorCommon.Solution.Monorepo
105
+ return cases.map((item) => __spreadProps(__spreadValues({}, item), {
106
+ solution: import_generator_common.Solution.Monorepo
61
107
  }));
62
108
  };
63
- exports.getMonorepoCases = getMonorepoCases;
64
- const getMWAEntryCases = _length => {
65
- return [{
66
- name: 'test'
67
- }];
109
+ const getMWAEntryCases = (_length) => {
110
+ return [
111
+ {
112
+ name: "test"
113
+ }
114
+ ];
68
115
  };
69
116
  const MWAServerValueMap = {
70
117
  framework: FrameworkValues
71
118
  };
72
- exports.MWAServerValueMap = MWAServerValueMap;
73
- const getMWAServerCases = () => (0, _covertable.default)(MWAServerValueMap, {
119
+ const getMWAServerCases = () => (0, import_covertable.default)(MWAServerValueMap, {
74
120
  length: Object.keys(MWAServerValueMap).length
75
121
  });
76
122
  const MWABFFValueMap = {
77
123
  bffType: BFFTypeValues,
78
124
  framework: FrameworkValues
79
125
  };
80
- exports.MWABFFValueMap = MWABFFValueMap;
81
- const getMWABFFCases = length => (0, _covertable.default)(MWABFFValueMap, {
126
+ const getMWABFFCases = (length) => (0, import_covertable.default)(MWABFFValueMap, {
82
127
  length: length || Object.keys(MWABFFValueMap).length
83
128
  });
84
- const getMWANewCases = length => {
129
+ const getMWANewCases = (length) => {
85
130
  const cases = [];
86
- _generatorCommon.MWAActionTypes.forEach(action => {
87
- const config = {
88
- actionType: action
89
- };
90
- _generatorCommon.MWAActionTypesMap[action].forEach(option => {
131
+ import_generator_common.MWAActionTypes.forEach((action) => {
132
+ const config = { actionType: action };
133
+ import_generator_common.MWAActionTypesMap[action].forEach((option) => {
91
134
  config[action] = option;
92
- const currentConfig = _objectSpread(_objectSpread({}, config), {}, {
93
- [action]: option
94
- });
95
- if (option === _generatorCommon.ActionElement.Entry) {
135
+ const currentConfig = __spreadProps(__spreadValues({}, config), { [action]: option });
136
+ if (option === import_generator_common.ActionElement.Entry) {
96
137
  const entryCases = getMWAEntryCases(length);
97
- entryCases.forEach(c => {
98
- cases.push(_objectSpread(_objectSpread({}, currentConfig), c));
138
+ entryCases.forEach((c) => {
139
+ cases.push(__spreadValues(__spreadValues({}, currentConfig), c));
99
140
  });
100
- } else if (option === _generatorCommon.ActionElement.Server) {
101
- // server only can enable once
141
+ } else if (option === import_generator_common.ActionElement.Server) {
102
142
  const serverCases = getMWAServerCases();
103
- cases.push(_objectSpread(_objectSpread({}, currentConfig), serverCases[Math.round(Math.random() * serverCases.length)]));
104
- } else if (option === _generatorCommon.ActionFunction.BFF) {
105
- // bff only can enable once
143
+ cases.push(__spreadValues(__spreadValues({}, currentConfig), serverCases[Math.round(Math.random() * serverCases.length)]));
144
+ } else if (option === import_generator_common.ActionFunction.BFF) {
106
145
  const bffCases = getMWABFFCases(length);
107
- cases.push(_objectSpread(_objectSpread({}, currentConfig), bffCases[Math.round(Math.random() * bffCases.length)]));
146
+ cases.push(__spreadValues(__spreadValues({}, currentConfig), bffCases[Math.round(Math.random() * bffCases.length)]));
108
147
  } else {
109
148
  cases.push(currentConfig);
110
149
  }
@@ -112,53 +151,49 @@ const getMWANewCases = length => {
112
151
  });
113
152
  return cases;
114
153
  };
115
- exports.getMWANewCases = getMWANewCases;
116
154
  const getModuleNewCases = () => {
117
155
  const cases = [];
118
- _generatorCommon.ModuleActionTypes.forEach(action => {
119
- const config = {
120
- actionType: action
121
- };
122
- _generatorCommon.ModuleActionTypesMap[action].forEach(option => {
123
- const currentConfig = _objectSpread(_objectSpread({}, config), {}, {
124
- [action]: option
125
- });
156
+ import_generator_common.ModuleActionTypes.forEach((action) => {
157
+ const config = { actionType: action };
158
+ import_generator_common.ModuleActionTypesMap[action].forEach((option) => {
159
+ const currentConfig = __spreadProps(__spreadValues({}, config), { [action]: option });
126
160
  cases.push(currentConfig);
127
161
  });
128
162
  });
129
163
  return cases;
130
164
  };
131
- exports.getModuleNewCases = getModuleNewCases;
132
165
  const MWASubProjectValueMap = {
133
166
  language: LanguageValues
134
167
  };
135
- exports.MWASubProjectValueMap = MWASubProjectValueMap;
136
168
  const ModuleSubProjectValueMap = {
137
169
  language: LanguageValues
138
170
  };
139
- exports.ModuleSubProjectValueMap = ModuleSubProjectValueMap;
140
171
  const getMWASubProjectCases = (isTest, length) => {
141
- const cases = (0, _covertable.default)(MWASubProjectValueMap, {
172
+ const cases = (0, import_covertable.default)(MWASubProjectValueMap, {
142
173
  length: length || Object.keys(MWASubProjectValueMap).length
143
174
  });
144
- return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
145
- packageName: Object.values(item).join('-'),
146
- packagePath: Object.values(item).join('-'),
147
- solution: isTest ? _generatorCommon.SubSolution.MWATest : _generatorCommon.SubSolution.MWA
175
+ return cases.map((item) => __spreadProps(__spreadValues({}, item), {
176
+ packageName: Object.values(item).join("-"),
177
+ packagePath: Object.values(item).join("-"),
178
+ solution: isTest ? import_generator_common.SubSolution.MWATest : import_generator_common.SubSolution.MWA
148
179
  }));
149
180
  };
150
181
  const getModuleSubProjectCases = (isInner, length) => {
151
- const cases = (0, _covertable.default)(ModuleSubProjectValueMap, {
182
+ const cases = (0, import_covertable.default)(ModuleSubProjectValueMap, {
152
183
  length: length || Object.keys(ModuleSubProjectValueMap).length
153
184
  });
154
- return cases.map(item => _objectSpread(_objectSpread({}, item), {}, {
155
- packageName: Object.values(item).join('-'),
156
- packagePath: Object.values(item).join('-'),
157
- solution: isInner ? _generatorCommon.SubSolution.InnerModule : _generatorCommon.SubSolution.Module
185
+ return cases.map((item) => __spreadProps(__spreadValues({}, item), {
186
+ packageName: Object.values(item).join("-"),
187
+ packagePath: Object.values(item).join("-"),
188
+ solution: isInner ? import_generator_common.SubSolution.InnerModule : import_generator_common.SubSolution.Module
158
189
  }));
159
190
  };
160
- const getMonorepoNewCases = length => {
161
- const cases = [...getMWASubProjectCases(false, length), ...getMWASubProjectCases(true, length), ...getModuleSubProjectCases(false, length), ...getModuleSubProjectCases(true, length)];
191
+ const getMonorepoNewCases = (length) => {
192
+ const cases = [
193
+ ...getMWASubProjectCases(false, length),
194
+ ...getMWASubProjectCases(true, length),
195
+ ...getModuleSubProjectCases(false, length),
196
+ ...getModuleSubProjectCases(true, length)
197
+ ];
162
198
  return cases;
163
199
  };
164
- exports.getMonorepoNewCases = getMonorepoNewCases;
@@ -1,151 +1,226 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
- import make from 'covertable';
5
- import { Solution, PackageManager, Language, BooleanConfig, MWAActionTypes, MWAActionTypesMap, Framework, BFFType, ActionElement, ActionFunction, ModuleActionTypes, ModuleActionTypesMap, SubSolution } from '@modern-js/generator-common';
6
- export var LanguageValues = Object.values(Language);
7
- export var PackageManagerValues = Object.values(PackageManager);
8
- export var BooleanConfigValues = Object.values(BooleanConfig);
9
- export var FrameworkValues = Object.values(Framework);
10
- export var BFFTypeValues = Object.values(BFFType);
11
- export var MWAValueMap = {
12
- language: LanguageValues,
13
- packageManager: PackageManagerValues
14
- };
15
- export var ModuleValueMap = {
16
- language: LanguageValues,
17
- packageManager: PackageManagerValues
18
- };
19
- export var MonorepoValueMap = {
20
- packageManager: PackageManagerValues.filter(function (packageManager) {
21
- return packageManager !== 'npm';
22
- })
23
- };
24
- export var getMWACases = function getMWACases(length) {
25
- var cases = make(MWAValueMap, {
26
- length: length || Object.keys(MWAValueMap).length
27
- });
28
- return cases.map(function (item) {
29
- return _objectSpread(_objectSpread({}, item), {}, {
30
- solution: Solution.MWA
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;
5
+ }
6
+ function _arrayWithoutHoles(arr) {
7
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
8
+ }
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;
21
+ }
22
+ function _iterableToArray(iter) {
23
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
24
+ }
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.");
27
+ }
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
+ });
40
+ }
41
+ return target;
42
+ }
43
+ 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);
53
+ }
54
+ return keys;
55
+ }
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;
66
+ }
67
+ function _toConsumableArray(arr) {
68
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
69
+ }
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);
77
+ }
78
+ import make from "covertable";
79
+ import { Solution, PackageManager, Language, BooleanConfig, MWAActionTypes, MWAActionTypesMap, Framework, BFFType, ActionElement, ActionFunction, ModuleActionTypes, ModuleActionTypesMap, SubSolution } 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 MWAValueMap = {
86
+ language: LanguageValues,
87
+ packageManager: PackageManagerValues
88
+ };
89
+ var ModuleValueMap = {
90
+ language: LanguageValues,
91
+ packageManager: PackageManagerValues
92
+ };
93
+ var MonorepoValueMap = {
94
+ packageManager: PackageManagerValues.filter(function(packageManager) {
95
+ return packageManager !== "npm";
96
+ })
97
+ };
98
+ var getMWACases = function(length) {
99
+ var cases = make(MWAValueMap, {
100
+ length: length || Object.keys(MWAValueMap).length
31
101
  });
32
- });
33
- };
34
- export var getModuleCases = function getModuleCases(length) {
35
- var cases = make(ModuleValueMap, {
36
- length: length || Object.keys(ModuleValueMap).length
37
- });
38
- return cases.map(function (item) {
39
- return _objectSpread(_objectSpread({}, item), {}, {
40
- solution: Solution.Module
102
+ return cases.map(function(item) {
103
+ return _objectSpreadProps(_objectSpread({}, item), {
104
+ solution: Solution.MWA
105
+ });
41
106
  });
42
- });
43
- };
44
- export var getMonorepoCases = function getMonorepoCases() {
45
- var cases = make(MonorepoValueMap, {
46
- length: Object.keys(MonorepoValueMap).length
47
- });
48
- return cases.map(function (item) {
49
- return _objectSpread(_objectSpread({}, item), {}, {
50
- solution: Solution.Monorepo
107
+ };
108
+ var getModuleCases = function(length) {
109
+ var cases = make(ModuleValueMap, {
110
+ length: length || Object.keys(ModuleValueMap).length
51
111
  });
52
- });
53
- };
54
- var getMWAEntryCases = function getMWAEntryCases(_length) {
55
- return [{
56
- name: 'test'
57
- }];
58
- };
59
- export var MWAServerValueMap = {
60
- framework: FrameworkValues
61
- };
62
- var getMWAServerCases = function getMWAServerCases() {
63
- return make(MWAServerValueMap, {
64
- length: Object.keys(MWAServerValueMap).length
65
- });
66
- };
67
- export var MWABFFValueMap = {
68
- bffType: BFFTypeValues,
69
- framework: FrameworkValues
70
- };
71
- var getMWABFFCases = function getMWABFFCases(length) {
72
- return make(MWABFFValueMap, {
73
- length: length || Object.keys(MWABFFValueMap).length
74
- });
75
- };
76
- export var getMWANewCases = function getMWANewCases(length) {
77
- var cases = [];
78
- MWAActionTypes.forEach(function (action) {
79
- var config = {
80
- actionType: action
81
- };
82
- MWAActionTypesMap[action].forEach(function (option) {
83
- config[action] = option;
84
- var currentConfig = _objectSpread(_objectSpread({}, config), {}, _defineProperty({}, action, option));
85
- if (option === ActionElement.Entry) {
86
- var entryCases = getMWAEntryCases(length);
87
- entryCases.forEach(function (c) {
88
- cases.push(_objectSpread(_objectSpread({}, currentConfig), c));
112
+ return cases.map(function(item) {
113
+ return _objectSpreadProps(_objectSpread({}, item), {
114
+ solution: Solution.Module
89
115
  });
90
- } else if (option === ActionElement.Server) {
91
- // server only can enable once
92
- var serverCases = getMWAServerCases();
93
- cases.push(_objectSpread(_objectSpread({}, currentConfig), serverCases[Math.round(Math.random() * serverCases.length)]));
94
- } else if (option === ActionFunction.BFF) {
95
- // bff only can enable once
96
- var bffCases = getMWABFFCases(length);
97
- cases.push(_objectSpread(_objectSpread({}, currentConfig), bffCases[Math.round(Math.random() * bffCases.length)]));
98
- } else {
99
- cases.push(currentConfig);
100
- }
101
116
  });
102
- });
103
- return cases;
104
- };
105
- export var getModuleNewCases = function getModuleNewCases() {
106
- var cases = [];
107
- ModuleActionTypes.forEach(function (action) {
108
- var config = {
109
- actionType: action
110
- };
111
- ModuleActionTypesMap[action].forEach(function (option) {
112
- var currentConfig = _objectSpread(_objectSpread({}, config), {}, _defineProperty({}, action, option));
113
- cases.push(currentConfig);
117
+ };
118
+ var getMonorepoCases = function() {
119
+ var cases = make(MonorepoValueMap, {
120
+ length: Object.keys(MonorepoValueMap).length
114
121
  });
115
- });
116
- return cases;
117
- };
118
- export var MWASubProjectValueMap = {
119
- language: LanguageValues
120
- };
121
- export var ModuleSubProjectValueMap = {
122
- language: LanguageValues
123
- };
124
- var getMWASubProjectCases = function getMWASubProjectCases(isTest, length) {
125
- var cases = make(MWASubProjectValueMap, {
126
- length: length || Object.keys(MWASubProjectValueMap).length
127
- });
128
- return cases.map(function (item) {
129
- return _objectSpread(_objectSpread({}, item), {}, {
130
- packageName: Object.values(item).join('-'),
131
- packagePath: Object.values(item).join('-'),
132
- solution: isTest ? SubSolution.MWATest : SubSolution.MWA
122
+ return cases.map(function(item) {
123
+ return _objectSpreadProps(_objectSpread({}, item), {
124
+ solution: Solution.Monorepo
125
+ });
133
126
  });
134
- });
135
- };
136
- var getModuleSubProjectCases = function getModuleSubProjectCases(isInner, length) {
137
- var cases = make(ModuleSubProjectValueMap, {
138
- length: length || Object.keys(ModuleSubProjectValueMap).length
139
- });
140
- return cases.map(function (item) {
141
- return _objectSpread(_objectSpread({}, item), {}, {
142
- packageName: Object.values(item).join('-'),
143
- packagePath: Object.values(item).join('-'),
144
- solution: isInner ? SubSolution.InnerModule : SubSolution.Module
127
+ };
128
+ var getMWAEntryCases = function(_length) {
129
+ return [
130
+ {
131
+ name: "test"
132
+ }
133
+ ];
134
+ };
135
+ var MWAServerValueMap = {
136
+ framework: FrameworkValues
137
+ };
138
+ var getMWAServerCases = function() {
139
+ return make(MWAServerValueMap, {
140
+ length: Object.keys(MWAServerValueMap).length
145
141
  });
146
- });
147
142
  };
148
- export var getMonorepoNewCases = function getMonorepoNewCases(length) {
149
- var cases = [].concat(_toConsumableArray(getMWASubProjectCases(false, length)), _toConsumableArray(getMWASubProjectCases(true, length)), _toConsumableArray(getModuleSubProjectCases(false, length)), _toConsumableArray(getModuleSubProjectCases(true, length)));
150
- return cases;
151
- };
143
+ var MWABFFValueMap = {
144
+ bffType: BFFTypeValues,
145
+ framework: FrameworkValues
146
+ };
147
+ var getMWABFFCases = function(length) {
148
+ return make(MWABFFValueMap, {
149
+ length: length || Object.keys(MWABFFValueMap).length
150
+ });
151
+ };
152
+ var getMWANewCases = function(length) {
153
+ var cases = [];
154
+ MWAActionTypes.forEach(function(action) {
155
+ var config = {
156
+ actionType: action
157
+ };
158
+ MWAActionTypesMap[action].forEach(function(option) {
159
+ config[action] = option;
160
+ var currentConfig = _objectSpreadProps(_objectSpread({}, config), _defineProperty({}, action, option));
161
+ if (option === ActionElement.Entry) {
162
+ var entryCases = getMWAEntryCases(length);
163
+ entryCases.forEach(function(c) {
164
+ cases.push(_objectSpread({}, currentConfig, c));
165
+ });
166
+ } else if (option === ActionElement.Server) {
167
+ var serverCases = getMWAServerCases();
168
+ cases.push(_objectSpread({}, currentConfig, serverCases[Math.round(Math.random() * serverCases.length)]));
169
+ } else if (option === ActionFunction.BFF) {
170
+ var bffCases = getMWABFFCases(length);
171
+ cases.push(_objectSpread({}, currentConfig, bffCases[Math.round(Math.random() * bffCases.length)]));
172
+ } else {
173
+ cases.push(currentConfig);
174
+ }
175
+ });
176
+ });
177
+ return cases;
178
+ };
179
+ var getModuleNewCases = function() {
180
+ var cases = [];
181
+ ModuleActionTypes.forEach(function(action) {
182
+ var config = {
183
+ actionType: action
184
+ };
185
+ ModuleActionTypesMap[action].forEach(function(option) {
186
+ var currentConfig = _objectSpreadProps(_objectSpread({}, config), _defineProperty({}, action, option));
187
+ cases.push(currentConfig);
188
+ });
189
+ });
190
+ return cases;
191
+ };
192
+ var MWASubProjectValueMap = {
193
+ language: LanguageValues
194
+ };
195
+ var ModuleSubProjectValueMap = {
196
+ language: LanguageValues
197
+ };
198
+ var getMWASubProjectCases = function(isTest, length) {
199
+ var cases = make(MWASubProjectValueMap, {
200
+ length: length || Object.keys(MWASubProjectValueMap).length
201
+ });
202
+ return cases.map(function(item) {
203
+ return _objectSpreadProps(_objectSpread({}, item), {
204
+ packageName: Object.values(item).join("-"),
205
+ packagePath: Object.values(item).join("-"),
206
+ solution: isTest ? SubSolution.MWATest : SubSolution.MWA
207
+ });
208
+ });
209
+ };
210
+ var getModuleSubProjectCases = function(isInner, length) {
211
+ var cases = make(ModuleSubProjectValueMap, {
212
+ length: length || Object.keys(ModuleSubProjectValueMap).length
213
+ });
214
+ return cases.map(function(item) {
215
+ return _objectSpreadProps(_objectSpread({}, item), {
216
+ packageName: Object.values(item).join("-"),
217
+ packagePath: Object.values(item).join("-"),
218
+ solution: isInner ? SubSolution.InnerModule : SubSolution.Module
219
+ });
220
+ });
221
+ };
222
+ var getMonorepoNewCases = function(length) {
223
+ var cases = _toConsumableArray(getMWASubProjectCases(false, length)).concat(_toConsumableArray(getMWASubProjectCases(true, length)), _toConsumableArray(getModuleSubProjectCases(false, length)), _toConsumableArray(getModuleSubProjectCases(true, length)));
224
+ return cases;
225
+ };
226
+ export { BFFTypeValues, BooleanConfigValues, FrameworkValues, LanguageValues, MWABFFValueMap, MWAServerValueMap, MWASubProjectValueMap, MWAValueMap, ModuleSubProjectValueMap, ModuleValueMap, MonorepoValueMap, PackageManagerValues, getMWACases, getMWANewCases, getModuleCases, getModuleNewCases, getMonorepoCases, getMonorepoNewCases };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "3.0.0-beta.3",
14
+ "version": "3.0.0-beta.4",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -30,15 +30,15 @@
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7.18.0",
32
32
  "covertable": "^2.2.2",
33
- "@modern-js/generator-common": "3.0.0-beta.3"
33
+ "@modern-js/generator-common": "3.0.0-beta.4"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/jest": "^27",
37
37
  "@types/node": "^14",
38
38
  "typescript": "^4",
39
39
  "jest": "^27",
40
- "@scripts/build": "2.0.0-beta.3",
41
- "@scripts/jest-config": "2.0.0-beta.3"
40
+ "@scripts/build": "2.0.0-beta.4",
41
+ "@scripts/jest-config": "2.0.0-beta.4"
42
42
  },
43
43
  "sideEffects": false,
44
44
  "publishConfig": {