@modern-js/mwa-generator 1.3.0 → 1.3.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/dist/js/node/index.js +265 -0
- package/dist/js/node/main.js +367 -314
- package/package.json +9 -9
- package/templates/ts-template/tsconfig.json +5 -2
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.handleTemplateFile = exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
|
9
|
+
|
|
10
|
+
var _codesmithApiApp = require("@modern-js/codesmith-api-app");
|
|
11
|
+
|
|
12
|
+
var _codesmithApiJson = require("@modern-js/codesmith-api-json");
|
|
13
|
+
|
|
14
|
+
var _generatorCommon = require("@modern-js/generator-common");
|
|
15
|
+
|
|
16
|
+
var _generatorUtils = require("@modern-js/generator-utils");
|
|
17
|
+
|
|
18
|
+
var _locale = require("./locale");
|
|
19
|
+
|
|
20
|
+
const _excluded = ["hasPlugin", "generatorPlugin"];
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
31
|
+
|
|
32
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
33
|
+
|
|
34
|
+
const getGeneratorPath = (generator, distTag) => {
|
|
35
|
+
if (process.env.CODESMITH_ENV === 'development') {
|
|
36
|
+
return _path.default.dirname(require.resolve(generator));
|
|
37
|
+
} else if (distTag) {
|
|
38
|
+
return `${generator}@${distTag}`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return generator;
|
|
42
|
+
}; // eslint-disable-next-line max-statements
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
const handleTemplateFile = async (context, generator, appApi) => {
|
|
46
|
+
const jsonAPI = new _codesmithApiJson.JsonAPI(generator);
|
|
47
|
+
const {
|
|
48
|
+
isMonorepoSubProject,
|
|
49
|
+
isTest,
|
|
50
|
+
projectDir = ''
|
|
51
|
+
} = context.config;
|
|
52
|
+
const {
|
|
53
|
+
outputPath
|
|
54
|
+
} = generator;
|
|
55
|
+
let packages = [];
|
|
56
|
+
|
|
57
|
+
if (isMonorepoSubProject) {
|
|
58
|
+
try {
|
|
59
|
+
packages = (0, _generatorUtils.getAllPackages)(outputPath);
|
|
60
|
+
} catch (e) {
|
|
61
|
+
generator.logger.debug('get all packages error', e);
|
|
62
|
+
generator.logger.warn(_locale.i18n.t(_locale.localeKeys.get_packages_error));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const _context$config = context.config,
|
|
67
|
+
{
|
|
68
|
+
hasPlugin,
|
|
69
|
+
generatorPlugin
|
|
70
|
+
} = _context$config,
|
|
71
|
+
extra = _objectWithoutProperties(_context$config, _excluded);
|
|
72
|
+
|
|
73
|
+
let schema = _generatorCommon.MWASchema;
|
|
74
|
+
let inputValue = {};
|
|
75
|
+
|
|
76
|
+
if (hasPlugin) {
|
|
77
|
+
await generatorPlugin.installPlugins(_generatorCommon.Solution.MWA, extra);
|
|
78
|
+
schema = generatorPlugin.getInputSchema(_generatorCommon.Solution.MWA);
|
|
79
|
+
inputValue = generatorPlugin.getInputValue(); // eslint-disable-next-line require-atomic-updates
|
|
80
|
+
|
|
81
|
+
context.config.gitCommitMessage = generatorPlugin.getGitMessage() || context.config.gitCommitMessage;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const ans = await appApi.getInputBySchema(schema, _objectSpread(_objectSpread(_objectSpread({}, context.config), inputValue), {}, {
|
|
85
|
+
isMwa: true,
|
|
86
|
+
isEmptySrc: true
|
|
87
|
+
}), {
|
|
88
|
+
packageName: input => (0, _generatorUtils.validatePackageName)(input, packages, {
|
|
89
|
+
isMonorepoSubProject
|
|
90
|
+
}),
|
|
91
|
+
packagePath: input => (0, _generatorUtils.validatePackagePath)(input, _path.default.join(process.cwd(), projectDir), {
|
|
92
|
+
isTest,
|
|
93
|
+
isMwa: true
|
|
94
|
+
})
|
|
95
|
+
});
|
|
96
|
+
generator.logger.debug(`inputData=${JSON.stringify(ans)}`, ans);
|
|
97
|
+
const {
|
|
98
|
+
packageName,
|
|
99
|
+
packagePath,
|
|
100
|
+
language,
|
|
101
|
+
runWay,
|
|
102
|
+
packageManager,
|
|
103
|
+
needModifyMWAConfig,
|
|
104
|
+
disableStateManagement,
|
|
105
|
+
clientRoute,
|
|
106
|
+
enableLess,
|
|
107
|
+
enableSass
|
|
108
|
+
} = ans;
|
|
109
|
+
const projectPath = (0, _generatorUtils.getMWAProjectPath)(packagePath, isMonorepoSubProject, isTest);
|
|
110
|
+
|
|
111
|
+
const dirname = _path.default.basename(generator.outputPath);
|
|
112
|
+
|
|
113
|
+
await appApi.runSubGenerator(getGeneratorPath(_generatorCommon.BaseGenerator, context.config.distTag), undefined, _objectSpread(_objectSpread({}, context.config), {}, {
|
|
114
|
+
hasPlugin: false
|
|
115
|
+
}));
|
|
116
|
+
await appApi.forgeTemplate('templates/base-template/**/*', undefined, resourceKey => resourceKey.replace('templates/base-template/', projectPath).replace('.handlebars', ''), {
|
|
117
|
+
name: packageName || dirname,
|
|
118
|
+
packageManager: (0, _generatorUtils.getPackageManagerText)(packageManager),
|
|
119
|
+
isMonorepoSubProject
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
if (language === _generatorCommon.Language.TS) {
|
|
123
|
+
await jsonAPI.update(context.materials.default.get(_path.default.join(projectPath, 'package.json')), {
|
|
124
|
+
query: {},
|
|
125
|
+
update: {
|
|
126
|
+
$set: {
|
|
127
|
+
'devDependencies.typescript': '^4',
|
|
128
|
+
'devDependencies.@types/react': '^17',
|
|
129
|
+
'devDependencies.@types/react-dom': '^17',
|
|
130
|
+
'devDependencies.@types/node': '^14'
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
await appApi.forgeTemplate('templates/ts-template/**/*', undefined, resourceKey => resourceKey.replace('templates/ts-template/', projectPath).replace('.handlebars', ''));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (!isMonorepoSubProject && packageManager === _generatorCommon.PackageManager.Pnpm) {
|
|
138
|
+
await appApi.forgeTemplate('templates/pnpm-template/**/*', undefined, resourceKey => resourceKey.replace('templates/pnpm-template/', projectPath).replace('.handlebars', ''));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
await appApi.runSubGenerator(getGeneratorPath(_generatorCommon.EntryGenerator, context.config.distTag), `./${projectPath}`, _objectSpread(_objectSpread({}, context.config), {}, {
|
|
142
|
+
disableStateManagement: needModifyMWAConfig === _generatorCommon.BooleanConfig.NO ? _generatorCommon.BooleanConfig.NO : disableStateManagement,
|
|
143
|
+
clientRoute: needModifyMWAConfig === _generatorCommon.BooleanConfig.NO ? _generatorCommon.ClientRoute.SelfControlRoute : clientRoute,
|
|
144
|
+
isSubGenerator: true
|
|
145
|
+
}));
|
|
146
|
+
|
|
147
|
+
if (runWay === _generatorCommon.RunWay.Electron) {
|
|
148
|
+
await appApi.runSubGenerator(getGeneratorPath(_generatorCommon.ElectronGenerator, context.config.distTag), undefined, _objectSpread(_objectSpread({}, context.config), {}, {
|
|
149
|
+
projectPath,
|
|
150
|
+
isSubGenerator: true
|
|
151
|
+
}));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (enableLess === _generatorCommon.BooleanConfig.YES) {
|
|
155
|
+
const lessDependence = _generatorCommon.MWAActionFunctionsDependencies[_generatorCommon.ActionFunction.Less];
|
|
156
|
+
await appApi.runSubGenerator(getGeneratorPath(_generatorCommon.DependenceGenerator, context.config.distTag), undefined, {
|
|
157
|
+
dependencies: {
|
|
158
|
+
[lessDependence]: `^${await (0, _generatorUtils.getPackageVersion)(lessDependence)}`
|
|
159
|
+
},
|
|
160
|
+
projectPath,
|
|
161
|
+
isSubGenerator: true
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (enableSass === _generatorCommon.BooleanConfig.YES) {
|
|
166
|
+
const sassDependence = _generatorCommon.MWAActionFunctionsDependencies[_generatorCommon.ActionFunction.Sass];
|
|
167
|
+
[_generatorCommon.ActionFunction.Sass];
|
|
168
|
+
await appApi.runSubGenerator(getGeneratorPath(_generatorCommon.DependenceGenerator, context.config.distTag), undefined, {
|
|
169
|
+
dependencies: {
|
|
170
|
+
[sassDependence]: `${await (0, _generatorUtils.getPackageVersion)(sassDependence)}`
|
|
171
|
+
},
|
|
172
|
+
projectPath,
|
|
173
|
+
isSubGenerator: true
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (isMonorepoSubProject) {
|
|
178
|
+
await appApi.updateWorkspace({
|
|
179
|
+
name: packagePath,
|
|
180
|
+
path: projectPath
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return {
|
|
185
|
+
projectPath,
|
|
186
|
+
isElectron: runWay === _generatorCommon.RunWay.Electron
|
|
187
|
+
};
|
|
188
|
+
}; // eslint-disable-next-line max-statements
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
exports.handleTemplateFile = handleTemplateFile;
|
|
192
|
+
|
|
193
|
+
var _default = async (context, generator) => {
|
|
194
|
+
const appApi = new _codesmithApiApp.AppAPI(context, generator);
|
|
195
|
+
const {
|
|
196
|
+
locale
|
|
197
|
+
} = context.config;
|
|
198
|
+
|
|
199
|
+
_generatorCommon.i18n.changeLanguage({
|
|
200
|
+
locale
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
_generatorUtils.i18n.changeLanguage({
|
|
204
|
+
locale
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
appApi.i18n.changeLanguage({
|
|
208
|
+
locale
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
_locale.i18n.changeLanguage({
|
|
212
|
+
locale
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
if (!(await appApi.checkEnvironment())) {
|
|
216
|
+
// eslint-disable-next-line no-process-exit
|
|
217
|
+
process.exit(1);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
generator.logger.debug(`start run @modern-js/mwa-generator`);
|
|
221
|
+
generator.logger.debug(`context=${JSON.stringify(context)}`);
|
|
222
|
+
generator.logger.debug(`context.data=${JSON.stringify(context.data)}`);
|
|
223
|
+
let projectPath = '';
|
|
224
|
+
let isElectron = false;
|
|
225
|
+
|
|
226
|
+
try {
|
|
227
|
+
({
|
|
228
|
+
projectPath,
|
|
229
|
+
isElectron
|
|
230
|
+
} = await handleTemplateFile(context, generator, appApi));
|
|
231
|
+
} catch (e) {
|
|
232
|
+
generator.logger.error(e); // eslint-disable-next-line no-process-exit
|
|
233
|
+
|
|
234
|
+
process.exit(1);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (context.handleForged) {
|
|
238
|
+
await context.handleForged(_generatorCommon.Solution.MWA, context, context.config.hasPlugin, projectPath);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
try {
|
|
242
|
+
await appApi.runGitAndInstall(context.config.gitCommitMessage);
|
|
243
|
+
} catch (e) {
|
|
244
|
+
generator.logger.error(e); // eslint-disable-next-line no-process-exit
|
|
245
|
+
|
|
246
|
+
process.exit(1);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (isElectron) {
|
|
250
|
+
appApi.showSuccessInfo(`${_locale.i18n.t(_locale.localeKeys.success, {
|
|
251
|
+
packageManager: (0, _generatorUtils.getPackageManagerText)(context.config.packageManager)
|
|
252
|
+
})}
|
|
253
|
+
${_locale.i18n.t(_locale.localeKeys.electron.success, {
|
|
254
|
+
packageManager: (0, _generatorUtils.getPackageManagerText)(context.config.packageManager)
|
|
255
|
+
})}`);
|
|
256
|
+
} else {
|
|
257
|
+
appApi.showSuccessInfo(_locale.i18n.t(_locale.localeKeys.success, {
|
|
258
|
+
packageManager: (0, _generatorUtils.getPackageManagerText)(context.config.packageManager)
|
|
259
|
+
}));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
generator.logger.debug(`forge @modern-js/mwa-generator succeed `);
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
exports.default = _default;
|
package/dist/js/node/main.js
CHANGED
|
@@ -466,7 +466,7 @@ Object.defineProperty(exports, "I18n", ({
|
|
|
466
466
|
}));
|
|
467
467
|
exports.localeKeys = exports.i18n = void 0;
|
|
468
468
|
|
|
469
|
-
var _pluginI18n = __webpack_require__(
|
|
469
|
+
var _pluginI18n = __webpack_require__(54207);
|
|
470
470
|
|
|
471
471
|
var _zh = __webpack_require__(57724);
|
|
472
472
|
|
|
@@ -5689,7 +5689,7 @@ exports.pointer = pointer;
|
|
|
5689
5689
|
|
|
5690
5690
|
/***/ }),
|
|
5691
5691
|
|
|
5692
|
-
/***/
|
|
5692
|
+
/***/ 54207:
|
|
5693
5693
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
5694
5694
|
|
|
5695
5695
|
"use strict";
|
|
@@ -5702,7 +5702,7 @@ exports.I18n = void 0;
|
|
|
5702
5702
|
|
|
5703
5703
|
var _get2 = _interopRequireDefault(__webpack_require__(71189));
|
|
5704
5704
|
|
|
5705
|
-
var _utils = __webpack_require__(
|
|
5705
|
+
var _utils = __webpack_require__(41083);
|
|
5706
5706
|
|
|
5707
5707
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
5708
5708
|
|
|
@@ -5771,7 +5771,7 @@ exports.I18n = I18n;
|
|
|
5771
5771
|
|
|
5772
5772
|
/***/ }),
|
|
5773
5773
|
|
|
5774
|
-
/***/
|
|
5774
|
+
/***/ 41083:
|
|
5775
5775
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
5776
5776
|
|
|
5777
5777
|
"use strict";
|
|
@@ -269421,7 +269421,7 @@ const SubSolutionSchema = {
|
|
|
269421
269421
|
}));
|
|
269422
269422
|
|
|
269423
269423
|
if (data.solution && data.solution !== 'custom') {
|
|
269424
|
-
items.
|
|
269424
|
+
items.unshift({
|
|
269425
269425
|
key: data.solution,
|
|
269426
269426
|
label: `${SubSolutionText[data.solution]()}(${_locale.i18n.t(_locale.localeKeys.solution.default)})`
|
|
269427
269427
|
});
|
|
@@ -269705,7 +269705,8 @@ const EN_LOCALE = {
|
|
|
269705
269705
|
mwa_storybook: 'Enable "Visual Testing (Storybook)"',
|
|
269706
269706
|
ssg: 'Enable "SSG"',
|
|
269707
269707
|
polyfill: 'Enable "UA-based Polyfill feature"',
|
|
269708
|
-
deploy: 'Enable "Deploy"'
|
|
269708
|
+
deploy: 'Enable "Deploy"',
|
|
269709
|
+
proxy: 'Enable "Global Proxy"'
|
|
269709
269710
|
},
|
|
269710
269711
|
element: {
|
|
269711
269712
|
self: 'Create project element',
|
|
@@ -269870,8 +269871,9 @@ const ZH_LOCALE = {
|
|
|
269870
269871
|
runtime_api: '启用「Rumtime API」',
|
|
269871
269872
|
mwa_storybook: '启用「Visual Testing (Storybook)」模式',
|
|
269872
269873
|
ssg: '启用「SSG」功能',
|
|
269873
|
-
polyfill: '
|
|
269874
|
-
deploy: '启用「部署」功能'
|
|
269874
|
+
polyfill: '启用「基于 UA 的 Polyfill」功能',
|
|
269875
|
+
deploy: '启用「部署」功能',
|
|
269876
|
+
proxy: '启用「全局代理」'
|
|
269875
269877
|
},
|
|
269876
269878
|
element: {
|
|
269877
269879
|
self: '创建工程元素',
|
|
@@ -270650,6 +270652,7 @@ exports.ActionFunction = ActionFunction;
|
|
|
270650
270652
|
ActionFunction["SSG"] = "ssg";
|
|
270651
270653
|
ActionFunction["Polyfill"] = "polyfill";
|
|
270652
270654
|
ActionFunction["Deploy"] = "deploy";
|
|
270655
|
+
ActionFunction["Proxy"] = "proxy";
|
|
270653
270656
|
})(ActionFunction || (exports.ActionFunction = ActionFunction = {}));
|
|
270654
270657
|
|
|
270655
270658
|
let ActionRefactor;
|
|
@@ -270686,7 +270689,8 @@ const ActionFunctionText = {
|
|
|
270686
270689
|
[ActionFunction.RuntimeApi]: () => _locale.i18n.t(_locale.localeKeys.action.function.runtime_api),
|
|
270687
270690
|
[ActionFunction.SSG]: () => _locale.i18n.t(_locale.localeKeys.action.function.ssg),
|
|
270688
270691
|
[ActionFunction.Polyfill]: () => _locale.i18n.t(_locale.localeKeys.action.function.polyfill),
|
|
270689
|
-
[ActionFunction.Deploy]: () => _locale.i18n.t(_locale.localeKeys.action.function.deploy)
|
|
270692
|
+
[ActionFunction.Deploy]: () => _locale.i18n.t(_locale.localeKeys.action.function.deploy),
|
|
270693
|
+
[ActionFunction.Proxy]: () => _locale.i18n.t(_locale.localeKeys.action.function.proxy)
|
|
270690
270694
|
};
|
|
270691
270695
|
exports.ActionFunctionText = ActionFunctionText;
|
|
270692
270696
|
const ActionRefactorText = {
|
|
@@ -270911,7 +270915,7 @@ exports.MWAActionTypes = MWAActionTypes;
|
|
|
270911
270915
|
const MWAActionFunctions = [_common.ActionFunction.UnBundle, _common.ActionFunction.TailwindCSS, _common.ActionFunction.Less, _common.ActionFunction.Sass, _common.ActionFunction.BFF, _common.ActionFunction.SSG, _common.ActionFunction.MicroFrontend, _common.ActionFunction.Electron, // ActionFunction.I18n,
|
|
270912
270916
|
_common.ActionFunction.Test, _common.ActionFunction.Storybook, // ActionFunction.E2ETest,
|
|
270913
270917
|
// ActionFunction.Doc,
|
|
270914
|
-
_common.ActionFunction.Polyfill, _common.ActionFunction.Deploy];
|
|
270918
|
+
_common.ActionFunction.Polyfill, _common.ActionFunction.Deploy, _common.ActionFunction.Proxy];
|
|
270915
270919
|
exports.MWAActionFunctions = MWAActionFunctions;
|
|
270916
270920
|
const MWAActionElements = [_common.ActionElement.Entry, _common.ActionElement.Server];
|
|
270917
270921
|
exports.MWAActionElements = MWAActionElements;
|
|
@@ -270958,14 +270962,15 @@ const MWAActionFunctionsDevDependencies = {
|
|
|
270958
270962
|
[_common.ActionFunction.E2ETest]: '@modern-js/plugin-e2e',
|
|
270959
270963
|
[_common.ActionFunction.Doc]: '@modern-js/plugin-docsite',
|
|
270960
270964
|
[_common.ActionFunction.Electron]: '@modern-js/plugin-electron',
|
|
270961
|
-
[_common.ActionFunction.Storybook]: '@modern-js/plugin-storybook'
|
|
270965
|
+
[_common.ActionFunction.Storybook]: '@modern-js/plugin-storybook',
|
|
270966
|
+
[_common.ActionFunction.Proxy]: '@modern-js/plugin-proxy'
|
|
270962
270967
|
};
|
|
270963
270968
|
exports.MWAActionFunctionsDevDependencies = MWAActionFunctionsDevDependencies;
|
|
270964
270969
|
const MWAActionFunctionsDependencies = {
|
|
270965
270970
|
[_common.ActionFunction.Less]: '@modern-js/plugin-less',
|
|
270966
270971
|
[_common.ActionFunction.Sass]: '@modern-js/plugin-sass',
|
|
270967
270972
|
[_common.ActionFunction.BFF]: '@modern-js/plugin-bff',
|
|
270968
|
-
[_common.ActionFunction.MicroFrontend]: '@modern-js/plugin-
|
|
270973
|
+
[_common.ActionFunction.MicroFrontend]: '@modern-js/plugin-garfish',
|
|
270969
270974
|
[_common.ActionFunction.I18n]: '@modern-js/plugin-i18n',
|
|
270970
270975
|
[_common.ActionFunction.SSG]: '@modern-js/plugin-ssg',
|
|
270971
270976
|
[_common.ActionFunction.Polyfill]: '@modern-js/plugin-polyfill'
|
|
@@ -270973,7 +270978,7 @@ const MWAActionFunctionsDependencies = {
|
|
|
270973
270978
|
exports.MWAActionFunctionsDependencies = MWAActionFunctionsDependencies;
|
|
270974
270979
|
const MWAActionFunctionsAppendTypeContent = {
|
|
270975
270980
|
[_common.ActionFunction.Test]: `/// <reference types='@modern-js/plugin-testing/type' />`,
|
|
270976
|
-
[_common.ActionFunction.MicroFrontend]: `/// <reference types='@modern-js/plugin-
|
|
270981
|
+
[_common.ActionFunction.MicroFrontend]: `/// <reference types='@modern-js/plugin-garfish/type' />`
|
|
270977
270982
|
};
|
|
270978
270983
|
exports.MWAActionFunctionsAppendTypeContent = MWAActionFunctionsAppendTypeContent;
|
|
270979
270984
|
const MWANewActionGenerators = {
|
|
@@ -270996,7 +271001,8 @@ const MWANewActionGenerators = {
|
|
|
270996
271001
|
[_common.ActionFunction.Storybook]: '@modern-js/dependence-generator',
|
|
270997
271002
|
[_common.ActionFunction.SSG]: '@modern-js/ssg-generator',
|
|
270998
271003
|
[_common.ActionFunction.Polyfill]: '@modern-js/dependence-generator',
|
|
270999
|
-
[_common.ActionFunction.Deploy]: '@modern-js/cloud-deploy-generator'
|
|
271004
|
+
[_common.ActionFunction.Deploy]: '@modern-js/cloud-deploy-generator',
|
|
271005
|
+
[_common.ActionFunction.Proxy]: '@modern-js/dependence-generator'
|
|
271000
271006
|
},
|
|
271001
271007
|
[_common.ActionType.Refactor]: {
|
|
271002
271008
|
[_common.ActionRefactor.BFFToApp]: '@modern-js/bff-refactor-generator'
|
|
@@ -271371,6 +271377,278 @@ function stripAnsi(string) {
|
|
|
271371
271377
|
|
|
271372
271378
|
/***/ }),
|
|
271373
271379
|
|
|
271380
|
+
/***/ 34701:
|
|
271381
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
271382
|
+
|
|
271383
|
+
"use strict";
|
|
271384
|
+
|
|
271385
|
+
|
|
271386
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
271387
|
+
value: true
|
|
271388
|
+
}));
|
|
271389
|
+
exports.handleTemplateFile = exports["default"] = void 0;
|
|
271390
|
+
|
|
271391
|
+
var _path = _interopRequireDefault(__webpack_require__(71017));
|
|
271392
|
+
|
|
271393
|
+
var _codesmithApiApp = __webpack_require__(83028);
|
|
271394
|
+
|
|
271395
|
+
var _codesmithApiJson = __webpack_require__(54517);
|
|
271396
|
+
|
|
271397
|
+
var _generatorCommon = __webpack_require__(50828);
|
|
271398
|
+
|
|
271399
|
+
var _generatorUtils = __webpack_require__(89489);
|
|
271400
|
+
|
|
271401
|
+
var _locale = __webpack_require__(62443);
|
|
271402
|
+
|
|
271403
|
+
const _excluded = ["hasPlugin", "generatorPlugin"];
|
|
271404
|
+
|
|
271405
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
271406
|
+
|
|
271407
|
+
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; }
|
|
271408
|
+
|
|
271409
|
+
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; }
|
|
271410
|
+
|
|
271411
|
+
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; }
|
|
271412
|
+
|
|
271413
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
271414
|
+
|
|
271415
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
271416
|
+
|
|
271417
|
+
const getGeneratorPath = (generator, distTag) => {
|
|
271418
|
+
if (process.env.CODESMITH_ENV === 'development') {
|
|
271419
|
+
return _path.default.dirname(/*require.resolve*/(__webpack_require__(10063).resolve(generator)));
|
|
271420
|
+
} else if (distTag) {
|
|
271421
|
+
return `${generator}@${distTag}`;
|
|
271422
|
+
}
|
|
271423
|
+
|
|
271424
|
+
return generator;
|
|
271425
|
+
}; // eslint-disable-next-line max-statements
|
|
271426
|
+
|
|
271427
|
+
|
|
271428
|
+
const handleTemplateFile = async (context, generator, appApi) => {
|
|
271429
|
+
const jsonAPI = new _codesmithApiJson.JsonAPI(generator);
|
|
271430
|
+
const {
|
|
271431
|
+
isMonorepoSubProject,
|
|
271432
|
+
isTest,
|
|
271433
|
+
projectDir = ''
|
|
271434
|
+
} = context.config;
|
|
271435
|
+
const {
|
|
271436
|
+
outputPath
|
|
271437
|
+
} = generator;
|
|
271438
|
+
let packages = [];
|
|
271439
|
+
|
|
271440
|
+
if (isMonorepoSubProject) {
|
|
271441
|
+
try {
|
|
271442
|
+
packages = (0, _generatorUtils.getAllPackages)(outputPath);
|
|
271443
|
+
} catch (e) {
|
|
271444
|
+
generator.logger.debug('get all packages error', e);
|
|
271445
|
+
generator.logger.warn(_locale.i18n.t(_locale.localeKeys.get_packages_error));
|
|
271446
|
+
}
|
|
271447
|
+
}
|
|
271448
|
+
|
|
271449
|
+
const _context$config = context.config,
|
|
271450
|
+
{
|
|
271451
|
+
hasPlugin,
|
|
271452
|
+
generatorPlugin
|
|
271453
|
+
} = _context$config,
|
|
271454
|
+
extra = _objectWithoutProperties(_context$config, _excluded);
|
|
271455
|
+
|
|
271456
|
+
let schema = _generatorCommon.MWASchema;
|
|
271457
|
+
let inputValue = {};
|
|
271458
|
+
|
|
271459
|
+
if (hasPlugin) {
|
|
271460
|
+
await generatorPlugin.installPlugins(_generatorCommon.Solution.MWA, extra);
|
|
271461
|
+
schema = generatorPlugin.getInputSchema(_generatorCommon.Solution.MWA);
|
|
271462
|
+
inputValue = generatorPlugin.getInputValue(); // eslint-disable-next-line require-atomic-updates
|
|
271463
|
+
|
|
271464
|
+
context.config.gitCommitMessage = generatorPlugin.getGitMessage() || context.config.gitCommitMessage;
|
|
271465
|
+
}
|
|
271466
|
+
|
|
271467
|
+
const ans = await appApi.getInputBySchema(schema, _objectSpread(_objectSpread(_objectSpread({}, context.config), inputValue), {}, {
|
|
271468
|
+
isMwa: true,
|
|
271469
|
+
isEmptySrc: true
|
|
271470
|
+
}), {
|
|
271471
|
+
packageName: input => (0, _generatorUtils.validatePackageName)(input, packages, {
|
|
271472
|
+
isMonorepoSubProject
|
|
271473
|
+
}),
|
|
271474
|
+
packagePath: input => (0, _generatorUtils.validatePackagePath)(input, _path.default.join(process.cwd(), projectDir), {
|
|
271475
|
+
isTest,
|
|
271476
|
+
isMwa: true
|
|
271477
|
+
})
|
|
271478
|
+
});
|
|
271479
|
+
generator.logger.debug(`inputData=${JSON.stringify(ans)}`, ans);
|
|
271480
|
+
const {
|
|
271481
|
+
packageName,
|
|
271482
|
+
packagePath,
|
|
271483
|
+
language,
|
|
271484
|
+
runWay,
|
|
271485
|
+
packageManager,
|
|
271486
|
+
needModifyMWAConfig,
|
|
271487
|
+
disableStateManagement,
|
|
271488
|
+
clientRoute,
|
|
271489
|
+
enableLess,
|
|
271490
|
+
enableSass
|
|
271491
|
+
} = ans;
|
|
271492
|
+
const projectPath = (0, _generatorUtils.getMWAProjectPath)(packagePath, isMonorepoSubProject, isTest);
|
|
271493
|
+
|
|
271494
|
+
const dirname = _path.default.basename(generator.outputPath);
|
|
271495
|
+
|
|
271496
|
+
await appApi.runSubGenerator(getGeneratorPath(_generatorCommon.BaseGenerator, context.config.distTag), undefined, _objectSpread(_objectSpread({}, context.config), {}, {
|
|
271497
|
+
hasPlugin: false
|
|
271498
|
+
}));
|
|
271499
|
+
await appApi.forgeTemplate('templates/base-template/**/*', undefined, resourceKey => resourceKey.replace('templates/base-template/', projectPath).replace('.handlebars', ''), {
|
|
271500
|
+
name: packageName || dirname,
|
|
271501
|
+
packageManager: (0, _generatorUtils.getPackageManagerText)(packageManager),
|
|
271502
|
+
isMonorepoSubProject
|
|
271503
|
+
});
|
|
271504
|
+
|
|
271505
|
+
if (language === _generatorCommon.Language.TS) {
|
|
271506
|
+
await jsonAPI.update(context.materials.default.get(_path.default.join(projectPath, 'package.json')), {
|
|
271507
|
+
query: {},
|
|
271508
|
+
update: {
|
|
271509
|
+
$set: {
|
|
271510
|
+
'devDependencies.typescript': '^4',
|
|
271511
|
+
'devDependencies.@types/react': '^17',
|
|
271512
|
+
'devDependencies.@types/react-dom': '^17',
|
|
271513
|
+
'devDependencies.@types/node': '^14'
|
|
271514
|
+
}
|
|
271515
|
+
}
|
|
271516
|
+
});
|
|
271517
|
+
await appApi.forgeTemplate('templates/ts-template/**/*', undefined, resourceKey => resourceKey.replace('templates/ts-template/', projectPath).replace('.handlebars', ''));
|
|
271518
|
+
}
|
|
271519
|
+
|
|
271520
|
+
if (!isMonorepoSubProject && packageManager === _generatorCommon.PackageManager.Pnpm) {
|
|
271521
|
+
await appApi.forgeTemplate('templates/pnpm-template/**/*', undefined, resourceKey => resourceKey.replace('templates/pnpm-template/', projectPath).replace('.handlebars', ''));
|
|
271522
|
+
}
|
|
271523
|
+
|
|
271524
|
+
await appApi.runSubGenerator(getGeneratorPath(_generatorCommon.EntryGenerator, context.config.distTag), `./${projectPath}`, _objectSpread(_objectSpread({}, context.config), {}, {
|
|
271525
|
+
disableStateManagement: needModifyMWAConfig === _generatorCommon.BooleanConfig.NO ? _generatorCommon.BooleanConfig.NO : disableStateManagement,
|
|
271526
|
+
clientRoute: needModifyMWAConfig === _generatorCommon.BooleanConfig.NO ? _generatorCommon.ClientRoute.SelfControlRoute : clientRoute,
|
|
271527
|
+
isSubGenerator: true
|
|
271528
|
+
}));
|
|
271529
|
+
|
|
271530
|
+
if (runWay === _generatorCommon.RunWay.Electron) {
|
|
271531
|
+
await appApi.runSubGenerator(getGeneratorPath(_generatorCommon.ElectronGenerator, context.config.distTag), undefined, _objectSpread(_objectSpread({}, context.config), {}, {
|
|
271532
|
+
projectPath,
|
|
271533
|
+
isSubGenerator: true
|
|
271534
|
+
}));
|
|
271535
|
+
}
|
|
271536
|
+
|
|
271537
|
+
if (enableLess === _generatorCommon.BooleanConfig.YES) {
|
|
271538
|
+
const lessDependence = _generatorCommon.MWAActionFunctionsDependencies[_generatorCommon.ActionFunction.Less];
|
|
271539
|
+
await appApi.runSubGenerator(getGeneratorPath(_generatorCommon.DependenceGenerator, context.config.distTag), undefined, {
|
|
271540
|
+
dependencies: {
|
|
271541
|
+
[lessDependence]: `^${await (0, _generatorUtils.getPackageVersion)(lessDependence)}`
|
|
271542
|
+
},
|
|
271543
|
+
projectPath,
|
|
271544
|
+
isSubGenerator: true
|
|
271545
|
+
});
|
|
271546
|
+
}
|
|
271547
|
+
|
|
271548
|
+
if (enableSass === _generatorCommon.BooleanConfig.YES) {
|
|
271549
|
+
const sassDependence = _generatorCommon.MWAActionFunctionsDependencies[_generatorCommon.ActionFunction.Sass];
|
|
271550
|
+
[_generatorCommon.ActionFunction.Sass];
|
|
271551
|
+
await appApi.runSubGenerator(getGeneratorPath(_generatorCommon.DependenceGenerator, context.config.distTag), undefined, {
|
|
271552
|
+
dependencies: {
|
|
271553
|
+
[sassDependence]: `${await (0, _generatorUtils.getPackageVersion)(sassDependence)}`
|
|
271554
|
+
},
|
|
271555
|
+
projectPath,
|
|
271556
|
+
isSubGenerator: true
|
|
271557
|
+
});
|
|
271558
|
+
}
|
|
271559
|
+
|
|
271560
|
+
if (isMonorepoSubProject) {
|
|
271561
|
+
await appApi.updateWorkspace({
|
|
271562
|
+
name: packagePath,
|
|
271563
|
+
path: projectPath
|
|
271564
|
+
});
|
|
271565
|
+
}
|
|
271566
|
+
|
|
271567
|
+
return {
|
|
271568
|
+
projectPath,
|
|
271569
|
+
isElectron: runWay === _generatorCommon.RunWay.Electron
|
|
271570
|
+
};
|
|
271571
|
+
}; // eslint-disable-next-line max-statements
|
|
271572
|
+
|
|
271573
|
+
|
|
271574
|
+
exports.handleTemplateFile = handleTemplateFile;
|
|
271575
|
+
|
|
271576
|
+
var _default = async (context, generator) => {
|
|
271577
|
+
const appApi = new _codesmithApiApp.AppAPI(context, generator);
|
|
271578
|
+
const {
|
|
271579
|
+
locale
|
|
271580
|
+
} = context.config;
|
|
271581
|
+
|
|
271582
|
+
_generatorCommon.i18n.changeLanguage({
|
|
271583
|
+
locale
|
|
271584
|
+
});
|
|
271585
|
+
|
|
271586
|
+
_generatorUtils.i18n.changeLanguage({
|
|
271587
|
+
locale
|
|
271588
|
+
});
|
|
271589
|
+
|
|
271590
|
+
appApi.i18n.changeLanguage({
|
|
271591
|
+
locale
|
|
271592
|
+
});
|
|
271593
|
+
|
|
271594
|
+
_locale.i18n.changeLanguage({
|
|
271595
|
+
locale
|
|
271596
|
+
});
|
|
271597
|
+
|
|
271598
|
+
if (!(await appApi.checkEnvironment())) {
|
|
271599
|
+
// eslint-disable-next-line no-process-exit
|
|
271600
|
+
process.exit(1);
|
|
271601
|
+
}
|
|
271602
|
+
|
|
271603
|
+
generator.logger.debug(`start run @modern-js/mwa-generator`);
|
|
271604
|
+
generator.logger.debug(`context=${JSON.stringify(context)}`);
|
|
271605
|
+
generator.logger.debug(`context.data=${JSON.stringify(context.data)}`);
|
|
271606
|
+
let projectPath = '';
|
|
271607
|
+
let isElectron = false;
|
|
271608
|
+
|
|
271609
|
+
try {
|
|
271610
|
+
({
|
|
271611
|
+
projectPath,
|
|
271612
|
+
isElectron
|
|
271613
|
+
} = await handleTemplateFile(context, generator, appApi));
|
|
271614
|
+
} catch (e) {
|
|
271615
|
+
generator.logger.error(e); // eslint-disable-next-line no-process-exit
|
|
271616
|
+
|
|
271617
|
+
process.exit(1);
|
|
271618
|
+
}
|
|
271619
|
+
|
|
271620
|
+
if (context.handleForged) {
|
|
271621
|
+
await context.handleForged(_generatorCommon.Solution.MWA, context, context.config.hasPlugin, projectPath);
|
|
271622
|
+
}
|
|
271623
|
+
|
|
271624
|
+
try {
|
|
271625
|
+
await appApi.runGitAndInstall(context.config.gitCommitMessage);
|
|
271626
|
+
} catch (e) {
|
|
271627
|
+
generator.logger.error(e); // eslint-disable-next-line no-process-exit
|
|
271628
|
+
|
|
271629
|
+
process.exit(1);
|
|
271630
|
+
}
|
|
271631
|
+
|
|
271632
|
+
if (isElectron) {
|
|
271633
|
+
appApi.showSuccessInfo(`${_locale.i18n.t(_locale.localeKeys.success, {
|
|
271634
|
+
packageManager: (0, _generatorUtils.getPackageManagerText)(context.config.packageManager)
|
|
271635
|
+
})}
|
|
271636
|
+
${_locale.i18n.t(_locale.localeKeys.electron.success, {
|
|
271637
|
+
packageManager: (0, _generatorUtils.getPackageManagerText)(context.config.packageManager)
|
|
271638
|
+
})}`);
|
|
271639
|
+
} else {
|
|
271640
|
+
appApi.showSuccessInfo(_locale.i18n.t(_locale.localeKeys.success, {
|
|
271641
|
+
packageManager: (0, _generatorUtils.getPackageManagerText)(context.config.packageManager)
|
|
271642
|
+
}));
|
|
271643
|
+
}
|
|
271644
|
+
|
|
271645
|
+
generator.logger.debug(`forge @modern-js/mwa-generator succeed `);
|
|
271646
|
+
};
|
|
271647
|
+
|
|
271648
|
+
exports["default"] = _default;
|
|
271649
|
+
|
|
271650
|
+
/***/ }),
|
|
271651
|
+
|
|
271374
271652
|
/***/ 9085:
|
|
271375
271653
|
/***/ ((__unused_webpack_module, exports) => {
|
|
271376
271654
|
|
|
@@ -271837,7 +272115,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
271837
272115
|
exports.clearConsole = void 0;
|
|
271838
272116
|
|
|
271839
272117
|
const clearConsole = () => {
|
|
271840
|
-
if (process.stdout.isTTY) {
|
|
272118
|
+
if (process.stdout.isTTY && !process.env.DEBUG) {
|
|
271841
272119
|
process.stdout.write('\x1B[H\x1B[2J');
|
|
271842
272120
|
}
|
|
271843
272121
|
};
|
|
@@ -271847,7 +272125,7 @@ exports.clearConsole = clearConsole;
|
|
|
271847
272125
|
/***/ }),
|
|
271848
272126
|
|
|
271849
272127
|
/***/ 4002:
|
|
271850
|
-
/***/ ((
|
|
272128
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
271851
272129
|
|
|
271852
272130
|
"use strict";
|
|
271853
272131
|
|
|
@@ -271855,7 +272133,7 @@ exports.clearConsole = clearConsole;
|
|
|
271855
272133
|
Object.defineProperty(exports, "__esModule", ({
|
|
271856
272134
|
value: true
|
|
271857
272135
|
}));
|
|
271858
|
-
exports.requireExistModule = exports.compatRequire = void 0;
|
|
272136
|
+
exports.requireExistModule = exports.compatRequire = exports.cleanRequireCache = void 0;
|
|
271859
272137
|
|
|
271860
272138
|
var _findExists = __webpack_require__(3664);
|
|
271861
272139
|
|
|
@@ -271884,6 +272162,14 @@ const requireExistModule = (filename, extensions = ['.ts', '.js']) => {
|
|
|
271884
272162
|
|
|
271885
272163
|
exports.requireExistModule = requireExistModule;
|
|
271886
272164
|
|
|
272165
|
+
const cleanRequireCache = filelist => {
|
|
272166
|
+
filelist.forEach(filepath => {
|
|
272167
|
+
delete __webpack_require__.c[filepath];
|
|
272168
|
+
});
|
|
272169
|
+
};
|
|
272170
|
+
|
|
272171
|
+
exports.cleanRequireCache = cleanRequireCache;
|
|
272172
|
+
|
|
271887
272173
|
/***/ }),
|
|
271888
272174
|
|
|
271889
272175
|
/***/ 36762:
|
|
@@ -271895,23 +272181,11 @@ exports.requireExistModule = requireExistModule;
|
|
|
271895
272181
|
Object.defineProperty(exports, "__esModule", ({
|
|
271896
272182
|
value: true
|
|
271897
272183
|
}));
|
|
271898
|
-
exports.SHARED_DIR = exports.SERVER_RENDER_FUNCTION_NAME = exports.SERVER_DIR = exports.SERVER_BUNDLE_DIRECTORY = exports.ROUTE_SPEC_FILE = exports.PLUGIN_SCHEMAS = exports.MAIN_ENTRY_NAME = exports.LOADABLE_STATS_FILE = exports.LAUNCH_EDITOR_ENDPOINT = exports.
|
|
271899
|
-
|
|
271900
|
-
/**
|
|
271901
|
-
* alias to src directory
|
|
271902
|
-
*/
|
|
271903
|
-
const INTERNAL_SRC_ALIAS = '@_modern_js_src';
|
|
271904
|
-
/**
|
|
271905
|
-
* alias to node_modules/.modern-js
|
|
271906
|
-
*/
|
|
272184
|
+
exports.SHARED_DIR = exports.SERVER_RENDER_FUNCTION_NAME = exports.SERVER_DIR = exports.SERVER_BUNDLE_DIRECTORY = exports.ROUTE_SPEC_FILE = exports.PLUGIN_SCHEMAS = exports.MAIN_ENTRY_NAME = exports.LOADABLE_STATS_FILE = exports.LAUNCH_EDITOR_ENDPOINT = exports.INTERNAL_PLUGINS = exports.HMR_SOCK_PATH = exports.ENTRY_NAME_PATTERN = exports.API_DIR = void 0;
|
|
271907
272185
|
|
|
271908
|
-
exports.INTERNAL_SRC_ALIAS = INTERNAL_SRC_ALIAS;
|
|
271909
|
-
const INTERNAL_DIR_ALAIS = '@_modern_js_internal';
|
|
271910
272186
|
/**
|
|
271911
272187
|
* hmr socket connect path
|
|
271912
272188
|
*/
|
|
271913
|
-
|
|
271914
|
-
exports.INTERNAL_DIR_ALAIS = INTERNAL_DIR_ALAIS;
|
|
271915
272189
|
const HMR_SOCK_PATH = '/_modern_js_hmr_ws';
|
|
271916
272190
|
/**
|
|
271917
272191
|
* route specification file
|
|
@@ -271955,17 +272229,11 @@ const SERVER_RENDER_FUNCTION_NAME = 'serverRender';
|
|
|
271955
272229
|
|
|
271956
272230
|
exports.SERVER_RENDER_FUNCTION_NAME = SERVER_RENDER_FUNCTION_NAME;
|
|
271957
272231
|
const LOADABLE_STATS_FILE = 'loadable-stats.json';
|
|
271958
|
-
/**
|
|
271959
|
-
* real entry generate by modern.js
|
|
271960
|
-
*/
|
|
271961
|
-
|
|
271962
|
-
exports.LOADABLE_STATS_FILE = LOADABLE_STATS_FILE;
|
|
271963
|
-
const HIDE_MODERN_JS_DIR = './node_modules/.modern-js';
|
|
271964
272232
|
/**
|
|
271965
272233
|
* internal specified folder
|
|
271966
272234
|
*/
|
|
271967
272235
|
|
|
271968
|
-
exports.
|
|
272236
|
+
exports.LOADABLE_STATS_FILE = LOADABLE_STATS_FILE;
|
|
271969
272237
|
const API_DIR = 'api';
|
|
271970
272238
|
exports.API_DIR = API_DIR;
|
|
271971
272239
|
const SERVER_DIR = 'server';
|
|
@@ -272046,8 +272314,8 @@ const INTERNAL_PLUGINS = {
|
|
|
272046
272314
|
cli: '@modern-js/plugin-server/cli',
|
|
272047
272315
|
server: '@modern-js/plugin-server/server'
|
|
272048
272316
|
},
|
|
272049
|
-
'@modern-js/plugin-
|
|
272050
|
-
cli: '@modern-js/plugin-
|
|
272317
|
+
'@modern-js/plugin-garfish': {
|
|
272318
|
+
cli: '@modern-js/plugin-garfish/cli'
|
|
272051
272319
|
},
|
|
272052
272320
|
'@modern-js/plugin-jarvis': {
|
|
272053
272321
|
cli: '@modern-js/plugin-jarvis/cli'
|
|
@@ -272071,6 +272339,7 @@ const INTERNAL_PLUGINS = {
|
|
|
272071
272339
|
cli: '@modern-js/plugin-static-hosting/cli'
|
|
272072
272340
|
},
|
|
272073
272341
|
'@modern-js/plugin-polyfill': {
|
|
272342
|
+
cli: '@modern-js/plugin-polyfill/cli',
|
|
272074
272343
|
server: '@modern-js/plugin-polyfill'
|
|
272075
272344
|
},
|
|
272076
272345
|
'@modern-js/plugin-multiprocess': {
|
|
@@ -272214,7 +272483,7 @@ const PLUGIN_SCHEMAS = {
|
|
|
272214
272483
|
typeof: ['object', 'function']
|
|
272215
272484
|
}
|
|
272216
272485
|
}],
|
|
272217
|
-
'@modern-js/plugin-
|
|
272486
|
+
'@modern-js/plugin-garfish': [{
|
|
272218
272487
|
target: 'runtime.masterApp',
|
|
272219
272488
|
schema: {
|
|
272220
272489
|
type: ['object']
|
|
@@ -273194,6 +273463,20 @@ Object.keys(_nodeEnv).forEach(function (key) {
|
|
|
273194
273463
|
});
|
|
273195
273464
|
});
|
|
273196
273465
|
|
|
273466
|
+
var _wait = __webpack_require__(96649);
|
|
273467
|
+
|
|
273468
|
+
Object.keys(_wait).forEach(function (key) {
|
|
273469
|
+
if (key === "default" || key === "__esModule") return;
|
|
273470
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
273471
|
+
if (key in exports && exports[key] === _wait[key]) return;
|
|
273472
|
+
Object.defineProperty(exports, key, {
|
|
273473
|
+
enumerable: true,
|
|
273474
|
+
get: function () {
|
|
273475
|
+
return _wait[key];
|
|
273476
|
+
}
|
|
273477
|
+
});
|
|
273478
|
+
});
|
|
273479
|
+
|
|
273197
273480
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
273198
273481
|
|
|
273199
273482
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -273936,13 +274219,15 @@ const prettyInstructions = (appContext, config) => {
|
|
|
273936
274219
|
const {
|
|
273937
274220
|
entrypoints,
|
|
273938
274221
|
serverRoutes,
|
|
273939
|
-
port
|
|
274222
|
+
port,
|
|
274223
|
+
existSrc,
|
|
274224
|
+
checkedEntries
|
|
273940
274225
|
} = appContext;
|
|
273941
274226
|
const urls = getAddressUrls(config.dev.https && (0, _is.isDev)() ? 'https' : 'http', port);
|
|
273942
|
-
const routes = serverRoutes.filter(route => route.entryName);
|
|
274227
|
+
const routes = existSrc ? serverRoutes.filter(route => route.entryName) : serverRoutes;
|
|
273943
274228
|
let message = 'App running at:\n\n';
|
|
273944
274229
|
|
|
273945
|
-
if (isSingleEntry(entrypoints)) {
|
|
274230
|
+
if (isSingleEntry(entrypoints) || !existSrc) {
|
|
273946
274231
|
message += urls.map(({
|
|
273947
274232
|
type,
|
|
273948
274233
|
url
|
|
@@ -273956,11 +274241,19 @@ const prettyInstructions = (appContext, config) => {
|
|
|
273956
274241
|
message += ` ${_chalk.default.bold(`> ${type}`)}\n`;
|
|
273957
274242
|
routes.forEach(({
|
|
273958
274243
|
entryName,
|
|
273959
|
-
urlPath
|
|
274244
|
+
urlPath,
|
|
274245
|
+
isSSR
|
|
273960
274246
|
}) => {
|
|
273961
|
-
|
|
274247
|
+
if (!checkedEntries.includes(entryName)) {
|
|
274248
|
+
return;
|
|
274249
|
+
}
|
|
274250
|
+
|
|
274251
|
+
message += ` ${_chalk.default.yellowBright(isSSR ? 'λ' : '○')} ${_chalk.default.yellowBright(entryName.padEnd(maxNameLength + 8))}${_chalk.default.cyanBright(normalizeUrl(`${url}/${urlPath}`))}\n`;
|
|
273962
274252
|
});
|
|
273963
274253
|
});
|
|
274254
|
+
message += '\n';
|
|
274255
|
+
message += _chalk.default.cyanBright(' λ (Server) server-side renders at runtime\n');
|
|
274256
|
+
message += _chalk.default.cyanBright(' ○ (Static) client-side rendered as static HTML\n');
|
|
273964
274257
|
}
|
|
273965
274258
|
|
|
273966
274259
|
return message;
|
|
@@ -274166,6 +274459,25 @@ exports.createRuntimeExportsUtils = createRuntimeExportsUtils;
|
|
|
274166
274459
|
|
|
274167
274460
|
/***/ }),
|
|
274168
274461
|
|
|
274462
|
+
/***/ 96649:
|
|
274463
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
274464
|
+
|
|
274465
|
+
"use strict";
|
|
274466
|
+
|
|
274467
|
+
|
|
274468
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
274469
|
+
value: true
|
|
274470
|
+
}));
|
|
274471
|
+
exports.wait = void 0;
|
|
274472
|
+
|
|
274473
|
+
const wait = (time = 0) => new Promise(resolve => {
|
|
274474
|
+
setTimeout(resolve, time);
|
|
274475
|
+
});
|
|
274476
|
+
|
|
274477
|
+
exports.wait = wait;
|
|
274478
|
+
|
|
274479
|
+
/***/ }),
|
|
274480
|
+
|
|
274169
274481
|
/***/ 31116:
|
|
274170
274482
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
274171
274483
|
|
|
@@ -281197,6 +281509,9 @@ module.exports = JSON.parse('{"v0.8":{"start":"2012-06-25","end":"2014-07-31"},"
|
|
|
281197
281509
|
/******/ return module.exports;
|
|
281198
281510
|
/******/ }
|
|
281199
281511
|
/******/
|
|
281512
|
+
/******/ // expose the module cache
|
|
281513
|
+
/******/ __webpack_require__.c = __webpack_module_cache__;
|
|
281514
|
+
/******/
|
|
281200
281515
|
/************************************************************************/
|
|
281201
281516
|
/******/ /* webpack/runtime/define property getters */
|
|
281202
281517
|
/******/ (() => {
|
|
@@ -281236,274 +281551,12 @@ module.exports = JSON.parse('{"v0.8":{"start":"2012-06-25","end":"2014-07-31"},"
|
|
|
281236
281551
|
/******/ })();
|
|
281237
281552
|
/******/
|
|
281238
281553
|
/************************************************************************/
|
|
281239
|
-
|
|
281240
|
-
//
|
|
281241
|
-
|
|
281242
|
-
|
|
281243
|
-
var
|
|
281244
|
-
|
|
281245
|
-
|
|
281246
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
281247
|
-
value: true
|
|
281248
|
-
}));
|
|
281249
|
-
exports["default"] = void 0;
|
|
281250
|
-
|
|
281251
|
-
var _path = _interopRequireDefault(__webpack_require__(71017));
|
|
281252
|
-
|
|
281253
|
-
var _codesmithApiApp = __webpack_require__(83028);
|
|
281254
|
-
|
|
281255
|
-
var _codesmithApiJson = __webpack_require__(54517);
|
|
281256
|
-
|
|
281257
|
-
var _generatorCommon = __webpack_require__(50828);
|
|
281258
|
-
|
|
281259
|
-
var _generatorUtils = __webpack_require__(89489);
|
|
281260
|
-
|
|
281261
|
-
var _locale = __webpack_require__(62443);
|
|
281262
|
-
|
|
281263
|
-
const _excluded = ["hasPlugin", "generatorPlugin"];
|
|
281264
|
-
|
|
281265
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
281266
|
-
|
|
281267
|
-
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; }
|
|
281268
|
-
|
|
281269
|
-
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; }
|
|
281270
|
-
|
|
281271
|
-
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; }
|
|
281272
|
-
|
|
281273
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
281274
|
-
|
|
281275
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
281276
|
-
|
|
281277
|
-
const getGeneratorPath = (generator, distTag) => {
|
|
281278
|
-
if (process.env.CODESMITH_ENV === 'development') {
|
|
281279
|
-
return _path.default.dirname(/*require.resolve*/(__webpack_require__(10063).resolve(generator)));
|
|
281280
|
-
} else if (distTag) {
|
|
281281
|
-
return `${generator}@${distTag}`;
|
|
281282
|
-
}
|
|
281283
|
-
|
|
281284
|
-
return generator;
|
|
281285
|
-
}; // eslint-disable-next-line max-statements
|
|
281286
|
-
|
|
281287
|
-
|
|
281288
|
-
const handleTemplateFile = async (context, generator, appApi) => {
|
|
281289
|
-
const jsonAPI = new _codesmithApiJson.JsonAPI(generator);
|
|
281290
|
-
const {
|
|
281291
|
-
isMonorepoSubProject,
|
|
281292
|
-
isTest,
|
|
281293
|
-
projectDir = ''
|
|
281294
|
-
} = context.config;
|
|
281295
|
-
const {
|
|
281296
|
-
outputPath
|
|
281297
|
-
} = generator;
|
|
281298
|
-
let packages = [];
|
|
281299
|
-
|
|
281300
|
-
if (isMonorepoSubProject) {
|
|
281301
|
-
try {
|
|
281302
|
-
packages = (0, _generatorUtils.getAllPackages)(outputPath);
|
|
281303
|
-
} catch (e) {
|
|
281304
|
-
generator.logger.debug('get all packages error', e);
|
|
281305
|
-
generator.logger.warn(_locale.i18n.t(_locale.localeKeys.get_packages_error));
|
|
281306
|
-
}
|
|
281307
|
-
}
|
|
281308
|
-
|
|
281309
|
-
const _context$config = context.config,
|
|
281310
|
-
{
|
|
281311
|
-
hasPlugin,
|
|
281312
|
-
generatorPlugin
|
|
281313
|
-
} = _context$config,
|
|
281314
|
-
extra = _objectWithoutProperties(_context$config, _excluded);
|
|
281315
|
-
|
|
281316
|
-
let schema = _generatorCommon.MWASchema;
|
|
281317
|
-
let inputValue = {};
|
|
281318
|
-
|
|
281319
|
-
if (hasPlugin) {
|
|
281320
|
-
await generatorPlugin.installPlugins(_generatorCommon.Solution.MWA, extra);
|
|
281321
|
-
schema = generatorPlugin.getInputSchema(_generatorCommon.Solution.MWA);
|
|
281322
|
-
inputValue = generatorPlugin.getInputValue(); // eslint-disable-next-line require-atomic-updates
|
|
281323
|
-
|
|
281324
|
-
context.config.gitCommitMessage = generatorPlugin.getGitMessage() || context.config.gitCommitMessage;
|
|
281325
|
-
}
|
|
281326
|
-
|
|
281327
|
-
const ans = await appApi.getInputBySchema(schema, _objectSpread(_objectSpread(_objectSpread({}, context.config), inputValue), {}, {
|
|
281328
|
-
isMwa: true,
|
|
281329
|
-
isEmptySrc: true
|
|
281330
|
-
}), {
|
|
281331
|
-
packageName: input => (0, _generatorUtils.validatePackageName)(input, packages, {
|
|
281332
|
-
isMonorepoSubProject
|
|
281333
|
-
}),
|
|
281334
|
-
packagePath: input => (0, _generatorUtils.validatePackagePath)(input, _path.default.join(process.cwd(), projectDir), {
|
|
281335
|
-
isTest,
|
|
281336
|
-
isMwa: true
|
|
281337
|
-
})
|
|
281338
|
-
});
|
|
281339
|
-
generator.logger.debug(`inputData=${JSON.stringify(ans)}`, ans);
|
|
281340
|
-
const {
|
|
281341
|
-
packageName,
|
|
281342
|
-
packagePath,
|
|
281343
|
-
language,
|
|
281344
|
-
runWay,
|
|
281345
|
-
packageManager,
|
|
281346
|
-
needModifyMWAConfig,
|
|
281347
|
-
disableStateManagement,
|
|
281348
|
-
clientRoute,
|
|
281349
|
-
enableLess,
|
|
281350
|
-
enableSass
|
|
281351
|
-
} = ans;
|
|
281352
|
-
const projectPath = (0, _generatorUtils.getMWAProjectPath)(packagePath, isMonorepoSubProject, isTest);
|
|
281353
|
-
|
|
281354
|
-
const dirname = _path.default.basename(generator.outputPath);
|
|
281355
|
-
|
|
281356
|
-
await appApi.runSubGenerator(getGeneratorPath(_generatorCommon.BaseGenerator, context.config.distTag), undefined, _objectSpread(_objectSpread({}, context.config), {}, {
|
|
281357
|
-
hasPlugin: false
|
|
281358
|
-
}));
|
|
281359
|
-
await appApi.forgeTemplate('templates/base-template/**/*', undefined, resourceKey => resourceKey.replace('templates/base-template/', projectPath).replace('.handlebars', ''), {
|
|
281360
|
-
name: packageName || dirname,
|
|
281361
|
-
packageManager: (0, _generatorUtils.getPackageManagerText)(packageManager),
|
|
281362
|
-
isMonorepoSubProject
|
|
281363
|
-
});
|
|
281364
|
-
|
|
281365
|
-
if (language === _generatorCommon.Language.TS) {
|
|
281366
|
-
await jsonAPI.update(context.materials.default.get(_path.default.join(projectPath, 'package.json')), {
|
|
281367
|
-
query: {},
|
|
281368
|
-
update: {
|
|
281369
|
-
$set: {
|
|
281370
|
-
'devDependencies.typescript': '^4',
|
|
281371
|
-
'devDependencies.@types/react': '^17',
|
|
281372
|
-
'devDependencies.@types/react-dom': '^17',
|
|
281373
|
-
'devDependencies.@types/node': '^14'
|
|
281374
|
-
}
|
|
281375
|
-
}
|
|
281376
|
-
});
|
|
281377
|
-
await appApi.forgeTemplate('templates/ts-template/**/*', undefined, resourceKey => resourceKey.replace('templates/ts-template/', projectPath).replace('.handlebars', ''));
|
|
281378
|
-
}
|
|
281379
|
-
|
|
281380
|
-
if (!isMonorepoSubProject && packageManager === _generatorCommon.PackageManager.Pnpm) {
|
|
281381
|
-
await appApi.forgeTemplate('templates/pnpm-template/**/*', undefined, resourceKey => resourceKey.replace('templates/pnpm-template/', projectPath).replace('.handlebars', ''));
|
|
281382
|
-
}
|
|
281383
|
-
|
|
281384
|
-
await appApi.runSubGenerator(getGeneratorPath(_generatorCommon.EntryGenerator, context.config.distTag), `./${projectPath}`, _objectSpread(_objectSpread({}, context.config), {}, {
|
|
281385
|
-
disableStateManagement: needModifyMWAConfig === _generatorCommon.BooleanConfig.NO ? _generatorCommon.BooleanConfig.NO : disableStateManagement,
|
|
281386
|
-
clientRoute: needModifyMWAConfig === _generatorCommon.BooleanConfig.NO ? _generatorCommon.ClientRoute.SelfControlRoute : clientRoute,
|
|
281387
|
-
isSubGenerator: true
|
|
281388
|
-
}));
|
|
281389
|
-
|
|
281390
|
-
if (runWay === _generatorCommon.RunWay.Electron) {
|
|
281391
|
-
await appApi.runSubGenerator(getGeneratorPath(_generatorCommon.ElectronGenerator, context.config.distTag), undefined, _objectSpread(_objectSpread({}, context.config), {}, {
|
|
281392
|
-
projectPath,
|
|
281393
|
-
isSubGenerator: true
|
|
281394
|
-
}));
|
|
281395
|
-
}
|
|
281396
|
-
|
|
281397
|
-
if (enableLess === _generatorCommon.BooleanConfig.YES) {
|
|
281398
|
-
const lessDependence = _generatorCommon.MWAActionFunctionsDependencies[_generatorCommon.ActionFunction.Less];
|
|
281399
|
-
await appApi.runSubGenerator(getGeneratorPath(_generatorCommon.DependenceGenerator, context.config.distTag), undefined, {
|
|
281400
|
-
dependencies: {
|
|
281401
|
-
[lessDependence]: `^${await (0, _generatorUtils.getPackageVersion)(lessDependence)}`
|
|
281402
|
-
},
|
|
281403
|
-
isSubGenerator: true
|
|
281404
|
-
});
|
|
281405
|
-
}
|
|
281406
|
-
|
|
281407
|
-
if (enableSass === _generatorCommon.BooleanConfig.YES) {
|
|
281408
|
-
const sassDependence = _generatorCommon.MWAActionFunctionsDependencies[_generatorCommon.ActionFunction.Sass];
|
|
281409
|
-
[_generatorCommon.ActionFunction.Sass];
|
|
281410
|
-
await appApi.runSubGenerator(getGeneratorPath(_generatorCommon.DependenceGenerator, context.config.distTag), undefined, {
|
|
281411
|
-
dependencies: {
|
|
281412
|
-
[sassDependence]: `${await (0, _generatorUtils.getPackageVersion)(sassDependence)}`
|
|
281413
|
-
},
|
|
281414
|
-
isSubGenerator: true
|
|
281415
|
-
});
|
|
281416
|
-
}
|
|
281417
|
-
|
|
281418
|
-
if (isMonorepoSubProject) {
|
|
281419
|
-
await appApi.updateWorkspace({
|
|
281420
|
-
name: packagePath,
|
|
281421
|
-
path: projectPath
|
|
281422
|
-
});
|
|
281423
|
-
}
|
|
281424
|
-
|
|
281425
|
-
return {
|
|
281426
|
-
projectPath,
|
|
281427
|
-
isElectron: runWay === _generatorCommon.RunWay.Electron
|
|
281428
|
-
};
|
|
281429
|
-
}; // eslint-disable-next-line max-statements
|
|
281430
|
-
|
|
281431
|
-
|
|
281432
|
-
var _default = async (context, generator) => {
|
|
281433
|
-
const appApi = new _codesmithApiApp.AppAPI(context, generator);
|
|
281434
|
-
const {
|
|
281435
|
-
locale
|
|
281436
|
-
} = context.config;
|
|
281437
|
-
|
|
281438
|
-
_generatorCommon.i18n.changeLanguage({
|
|
281439
|
-
locale
|
|
281440
|
-
});
|
|
281441
|
-
|
|
281442
|
-
_generatorUtils.i18n.changeLanguage({
|
|
281443
|
-
locale
|
|
281444
|
-
});
|
|
281445
|
-
|
|
281446
|
-
appApi.i18n.changeLanguage({
|
|
281447
|
-
locale
|
|
281448
|
-
});
|
|
281449
|
-
|
|
281450
|
-
_locale.i18n.changeLanguage({
|
|
281451
|
-
locale
|
|
281452
|
-
});
|
|
281453
|
-
|
|
281454
|
-
if (!(await appApi.checkEnvironment())) {
|
|
281455
|
-
// eslint-disable-next-line no-process-exit
|
|
281456
|
-
process.exit(1);
|
|
281457
|
-
}
|
|
281458
|
-
|
|
281459
|
-
generator.logger.debug(`start run @modern-js/mwa-generator`);
|
|
281460
|
-
generator.logger.debug(`context=${JSON.stringify(context)}`);
|
|
281461
|
-
generator.logger.debug(`context.data=${JSON.stringify(context.data)}`);
|
|
281462
|
-
let projectPath = '';
|
|
281463
|
-
let isElectron = false;
|
|
281464
|
-
|
|
281465
|
-
try {
|
|
281466
|
-
({
|
|
281467
|
-
projectPath,
|
|
281468
|
-
isElectron
|
|
281469
|
-
} = await handleTemplateFile(context, generator, appApi));
|
|
281470
|
-
} catch (e) {
|
|
281471
|
-
generator.logger.error(e); // eslint-disable-next-line no-process-exit
|
|
281472
|
-
|
|
281473
|
-
process.exit(1);
|
|
281474
|
-
}
|
|
281475
|
-
|
|
281476
|
-
if (context.handleForged) {
|
|
281477
|
-
await context.handleForged(_generatorCommon.Solution.MWA, context, context.config.hasPlugin, projectPath);
|
|
281478
|
-
}
|
|
281479
|
-
|
|
281480
|
-
try {
|
|
281481
|
-
await appApi.runGitAndInstall(context.config.gitCommitMessage);
|
|
281482
|
-
} catch (e) {
|
|
281483
|
-
generator.logger.error(e); // eslint-disable-next-line no-process-exit
|
|
281484
|
-
|
|
281485
|
-
process.exit(1);
|
|
281486
|
-
}
|
|
281487
|
-
|
|
281488
|
-
if (isElectron) {
|
|
281489
|
-
appApi.showSuccessInfo(`${_locale.i18n.t(_locale.localeKeys.success, {
|
|
281490
|
-
packageManager: (0, _generatorUtils.getPackageManagerText)(context.config.packageManager)
|
|
281491
|
-
})}
|
|
281492
|
-
${_locale.i18n.t(_locale.localeKeys.electron.success, {
|
|
281493
|
-
packageManager: (0, _generatorUtils.getPackageManagerText)(context.config.packageManager)
|
|
281494
|
-
})}`);
|
|
281495
|
-
} else {
|
|
281496
|
-
appApi.showSuccessInfo(_locale.i18n.t(_locale.localeKeys.success, {
|
|
281497
|
-
packageManager: (0, _generatorUtils.getPackageManagerText)(context.config.packageManager)
|
|
281498
|
-
}));
|
|
281499
|
-
}
|
|
281500
|
-
|
|
281501
|
-
generator.logger.debug(`forge @modern-js/mwa-generator succeed `);
|
|
281502
|
-
};
|
|
281503
|
-
|
|
281504
|
-
exports["default"] = _default;
|
|
281505
|
-
})();
|
|
281506
|
-
|
|
281507
|
-
module.exports = __webpack_exports__;
|
|
281554
|
+
/******/
|
|
281555
|
+
/******/ // module cache are used so entry inlining is disabled
|
|
281556
|
+
/******/ // startup
|
|
281557
|
+
/******/ // Load entry module and return exports
|
|
281558
|
+
/******/ var __webpack_exports__ = __webpack_require__(34701);
|
|
281559
|
+
/******/ module.exports = __webpack_exports__;
|
|
281560
|
+
/******/
|
|
281508
281561
|
/******/ })()
|
|
281509
281562
|
;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.3.
|
|
14
|
+
"version": "1.3.4",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"main": "./dist/js/node/main.js",
|
|
17
17
|
"files": [
|
|
@@ -20,17 +20,17 @@
|
|
|
20
20
|
],
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@babel/runtime": "^7",
|
|
23
|
-
"@modern-js/base-generator": "^1.3.
|
|
23
|
+
"@modern-js/base-generator": "^1.3.1",
|
|
24
24
|
"@modern-js/codesmith": "^1.0.8",
|
|
25
25
|
"@modern-js/codesmith-api-app": "^1.0.7",
|
|
26
26
|
"@modern-js/codesmith-api-json": "^1.0.7",
|
|
27
|
-
"@modern-js/codesmith-tools": "^1.0.
|
|
28
|
-
"@modern-js/entry-generator": "^1.3.
|
|
29
|
-
"@modern-js/electron-generator": "^1.2.
|
|
30
|
-
"@modern-js/dependence-generator": "^1.2.
|
|
31
|
-
"@modern-js/generator-common": "^1.
|
|
32
|
-
"@modern-js/generator-utils": "^1.2.
|
|
33
|
-
"@modern-js/plugin-i18n": "^1.2.
|
|
27
|
+
"@modern-js/codesmith-tools": "^1.0.9",
|
|
28
|
+
"@modern-js/entry-generator": "^1.3.1",
|
|
29
|
+
"@modern-js/electron-generator": "^1.2.1",
|
|
30
|
+
"@modern-js/dependence-generator": "^1.2.2",
|
|
31
|
+
"@modern-js/generator-common": "^1.4.2",
|
|
32
|
+
"@modern-js/generator-utils": "^1.2.1",
|
|
33
|
+
"@modern-js/plugin-i18n": "^1.2.1",
|
|
34
34
|
"@types/jest": "^26",
|
|
35
35
|
"@types/node": "^14",
|
|
36
36
|
"typescript": "^4",
|