create-module-federation 0.0.0-next-20250306073231 → 0.0.0-next-20250306125957
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/README.md +40 -1
- package/dist/index.js +4 -3
- package/package.json +1 -1
- package/templates/provider-modern-ts/modern.config.ts +18 -0
- package/templates/provider-rsbuild-ts/rsbuild.config.ts +11 -0
- /package/templates/{modern-common → consumer-modern-ts}/modern.config.ts +0 -0
- /package/templates/{rsbuild-common → consumer-rsbuild-ts}/rsbuild.config.ts +0 -0
package/README.md
CHANGED
|
@@ -1 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://module-federation.io/" target="blank"><img src="https://module-federation.io/module-federation.svg" alt="Module Federation 2.0" /></a>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# create-module-federation
|
|
6
|
+
|
|
7
|
+
Create a new Module Federation project.
|
|
8
|
+
|
|
9
|
+
<p>
|
|
10
|
+
<a href="https://npmjs.com/package/create-module-federation">
|
|
11
|
+
<img src="https://img.shields.io/npm/v/create-module-federation?style=flat-square&colorA=564341&colorB=EDED91" alt="npm version" />
|
|
12
|
+
</a>
|
|
13
|
+
<img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="license" />
|
|
14
|
+
<a href="https://npmcharts.com/compare/create-module-federation?minimal=true"><img src="https://img.shields.io/npm/dm/create-module-federation.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="downloads" /></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
Using `npm create`:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm create module-federation@latest
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Using CLI flags:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx create-module-federation --dir my-project --template provider-modern --name provider
|
|
29
|
+
|
|
30
|
+
# Using abbreviations
|
|
31
|
+
npx create-module-federation -d my-project -t provider-modern -n provider
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Documentation
|
|
35
|
+
|
|
36
|
+
See [Documentation](https://module-federation.io/guide/start/quick-start).
|
|
37
|
+
|
|
38
|
+
## License
|
|
39
|
+
|
|
40
|
+
[MIT](https://github.com/module-federation/core/blob/main/LICENSE).
|
package/dist/index.js
CHANGED
|
@@ -324,7 +324,8 @@ async function create({ name, templates }) {
|
|
|
324
324
|
if ("other" === projectType) {
|
|
325
325
|
const otherOptions = Object.keys(OTHER_TYPE).map((key)=>({
|
|
326
326
|
value: key,
|
|
327
|
-
label: OTHER_TYPE[key].label
|
|
327
|
+
label: OTHER_TYPE[key].label,
|
|
328
|
+
hint: OTHER_TYPE[key].hint
|
|
328
329
|
}));
|
|
329
330
|
const otherProjectKey = checkCancel(await (0, __WEBPACK_EXTERNAL_MODULE__clack_prompts_3cae1695__.select)({
|
|
330
331
|
message: 'Please select the type of template you want to create:',
|
|
@@ -359,11 +360,11 @@ async function create({ name, templates }) {
|
|
|
359
360
|
}
|
|
360
361
|
const TEMPLATES = [
|
|
361
362
|
'provider-modern',
|
|
362
|
-
'consumer-modern',
|
|
363
363
|
'provider-rsbuild',
|
|
364
|
-
'consumer-rsbuild',
|
|
365
364
|
'rslib',
|
|
366
365
|
'rslib-storybook',
|
|
366
|
+
'consumer-modern',
|
|
367
|
+
'consumer-rsbuild',
|
|
367
368
|
'create-zephyr'
|
|
368
369
|
];
|
|
369
370
|
create({
|
package/package.json
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { appTools, defineConfig } from '@modern-js/app-tools';
|
|
2
|
+
import { moduleFederationPlugin } from '@module-federation/modern-js';
|
|
3
|
+
|
|
4
|
+
// https://modernjs.dev/en/configure/app/usage
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
runtime: {
|
|
7
|
+
router: true,
|
|
8
|
+
},
|
|
9
|
+
plugins: [
|
|
10
|
+
appTools({
|
|
11
|
+
bundler: 'rspack', // Set to 'webpack' to enable webpack
|
|
12
|
+
}),
|
|
13
|
+
moduleFederationPlugin(),
|
|
14
|
+
],
|
|
15
|
+
server: {
|
|
16
|
+
port: 3001,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { defineConfig } from '@rsbuild/core';
|
|
2
|
+
import { pluginReact } from '@rsbuild/plugin-react';
|
|
3
|
+
import { pluginModuleFederation } from '@module-federation/rsbuild-plugin';
|
|
4
|
+
import moduleFederationConfig from './module-federation.config';
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [pluginReact(), pluginModuleFederation(moduleFederationConfig)],
|
|
8
|
+
server: {
|
|
9
|
+
port: 3001,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
File without changes
|
|
File without changes
|