create-module-federation 0.0.0-next-20250306064243 → 0.0.0-next-20250306071320
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/index.js +8 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -115,6 +115,7 @@ function logHelpMessage(name, templates) {
|
|
|
115
115
|
-d, --dir create project in specified directory
|
|
116
116
|
-t, --template specify the template to use
|
|
117
117
|
-n, --name specify the mf name
|
|
118
|
+
-r, --role specify the mf role type: provider or consumer
|
|
118
119
|
--override override files in target directory
|
|
119
120
|
|
|
120
121
|
Templates:
|
|
@@ -175,7 +176,7 @@ async function getLibTemplateName({ template }) {
|
|
|
175
176
|
}
|
|
176
177
|
].filter(Boolean)
|
|
177
178
|
}));
|
|
178
|
-
const roleType =
|
|
179
|
+
const roleType = "provider";
|
|
179
180
|
if (!tools || !Object.keys(tools).length) return `${roleType}-${templateName}-ts`;
|
|
180
181
|
return `${roleType}-${templateName}-${tools[0]}-ts`;
|
|
181
182
|
}
|
|
@@ -191,8 +192,8 @@ function getTemplateDir(templateName) {
|
|
|
191
192
|
}
|
|
192
193
|
async function forgeTemplate({ projectType, argv, templateParameters, distFolder }) {
|
|
193
194
|
let framework = 'modern';
|
|
194
|
-
let roleType =
|
|
195
|
-
if ('app' === projectType) {
|
|
195
|
+
let roleType = "provider";
|
|
196
|
+
if (!argv?.template && 'app' === projectType) {
|
|
196
197
|
framework = checkCancel(await (0, __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.select)({
|
|
197
198
|
message: 'Select template',
|
|
198
199
|
options: [
|
|
@@ -206,7 +207,7 @@ async function forgeTemplate({ projectType, argv, templateParameters, distFolder
|
|
|
206
207
|
}
|
|
207
208
|
]
|
|
208
209
|
}));
|
|
209
|
-
roleType = checkCancel(await (0, __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.select)({
|
|
210
|
+
roleType = argv.role || checkCancel(await (0, __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.select)({
|
|
210
211
|
message: 'Please select the role of project you want to create:',
|
|
211
212
|
initialValue: 'provider',
|
|
212
213
|
options: [
|
|
@@ -278,7 +279,8 @@ async function create({ name, templates }) {
|
|
|
278
279
|
h: 'help',
|
|
279
280
|
d: 'dir',
|
|
280
281
|
t: 'template',
|
|
281
|
-
n: 'name'
|
|
282
|
+
n: 'name',
|
|
283
|
+
r: 'role'
|
|
282
284
|
}
|
|
283
285
|
});
|
|
284
286
|
console.log('');
|
|
@@ -299,7 +301,7 @@ async function create({ name, templates }) {
|
|
|
299
301
|
if (0 === value.length) return 'Name is required';
|
|
300
302
|
}
|
|
301
303
|
}));
|
|
302
|
-
const { targetDir } = formatProjectName(__WEBPACK_EXTERNAL_MODULE_path__["default"].join(argv.dir ||
|
|
304
|
+
const { targetDir } = formatProjectName(__WEBPACK_EXTERNAL_MODULE_path__["default"].join(argv.dir || mfName));
|
|
303
305
|
const distFolder = __WEBPACK_EXTERNAL_MODULE_path__["default"].isAbsolute(targetDir) ? targetDir : __WEBPACK_EXTERNAL_MODULE_path__["default"].join(cwd, targetDir);
|
|
304
306
|
if (!argv.override && __WEBPACK_EXTERNAL_MODULE_fs__["default"].existsSync(distFolder) && !isEmptyDir(distFolder)) {
|
|
305
307
|
const option = checkCancel(await (0, __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.select)({
|
package/package.json
CHANGED