Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: feat: add Create a new Module Federation project cli #3446

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/beige-otters-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-module-federation': patch
---

feat: add Create a new Module Federation project cli
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules/
vite.config.ts
**/dist/**
**/dist/**
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ apps/website-new/docs

/.nx/workspace-data
/.nx/cache

**/*.handlebars
6 changes: 3 additions & 3 deletions apps/rslib-module/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ export default defineConfig({
root: './dist/mf',
},
},
server: {
port: 3001,
},
},
],
server: {
port: 3001,
},
plugins: [
pluginReact(),
pluginModuleFederation({
Expand Down
1 change: 1 addition & 0 deletions packages/create-module-federation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# create-module-federation
21 changes: 21 additions & 0 deletions packages/create-module-federation/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024-present hanric(2heal1)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions packages/create-module-federation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# `create-module-federation`
27 changes: 27 additions & 0 deletions packages/create-module-federation/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html

module.exports = {
clearMocks: true,
testEnvironment: 'jsdom',
coveragePathIgnorePatterns: ['__tests__', '/node_modules/'],
coverageProvider: 'v8',
coverageReporters: ['cobertura', 'clover', 'json', 'lcov', 'text'],
globals: {
__DEV__: true,
__TEST__: true,
__BROWSER__: false,
__VERSION__: '"unknown"',
},
preset: 'ts-jest',
transformIgnorePatterns: [
// Change MODULE_NAME_HERE to your module that isn't being compiled
'/node_modules/(?!((@byted/garfish-)|(byted-tea-sdk))).+\\.js$',
],
transform: {
'^.+\\.(t|j)sx?$': ['@swc/jest'],
},
rootDir: __dirname,
testMatch: ['<rootDir>__tests__/**/**.spec.[jt]s?(x)'],
testPathIgnorePatterns: ['/node_modules/'],
};
47 changes: 47 additions & 0 deletions packages/create-module-federation/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "create-module-federation",
"description": "Create a new Module Federation project",
"public": true,
"sideEffects": false,
"version": "0.0.0-1737428758075",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/module-federation/core/",
"directory": "packages/create-module-federation"
},
"publishConfig": {
"access": "public"
},
"type": "module",
"scripts": {
"build": "rslib build"
},
"main": "./dist/index.js",
"engines": {
"node": ">=16.7.0"
},
"bin": {
"create-module-federation": "./dist/index.js"
},
"files": [
"templates",
"dist"
],
"dependencies": {
"@clack/prompts": "^0.8.2",
"execa": "5.1.1",
"fs-extra": "9.1.0",
"minimist": "^1.2.8",
"rslog": "^1.2.3",
"glob": "7.2.0",
"handlebars": "4.7.7"
},
"devDependencies": {
"@types/glob": "7.2.0",
"@types/minimist": "^1.2.5",
"@types/fs-extra": "9.0.6",
"@rslib/core": "^0.3.1",
"rsbuild-plugin-publint": "^0.2.1"
}
}
64 changes: 64 additions & 0 deletions packages/create-module-federation/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "create-module-federation",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/create-module-federation/src",
"projectType": "library",
"tags": ["type:pkg"],
"targets": {
"build": {
"executor": "nx:run-commands",
"options": {
"parallel": false,
"dependsOn": [
{
"target": "build",
"dependencies": true
}
],
"commands": [
"cd packages/create-module-federation; pnpm run build",
"cp packages/create-module-federation/LICENSE packages/create-module-federation/dist"
]
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"packages/create-module-federation/**/*.ts",
"packages/create-module-federation/package.json"
]
}
},
"test": {
"executor": "nx:run-commands",
"options": {
"parallel": false,
"dependsOn": [
{
"target": "build",
"dependencies": true
}
],
"commands": ["echo 'no test'"]
}
},
"pre-release": {
"executor": "nx:run-commands",
"options": {
"parallel": false,
"commands": [
{
"command": "nx run create-module-federation:test",
"forwardAllArgs": false
},
{
"command": "nx run create-module-federation:build",
"forwardAllArgs": false
}
]
}
}
}
}
7 changes: 7 additions & 0 deletions packages/create-module-federation/rslib.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { pluginPublint } from 'rsbuild-plugin-publint';
import { defineConfig } from '@rslib/core';

export default defineConfig({
lib: [{ format: 'esm' }],
plugins: [pluginPublint()],
});
Loading
Loading