feat(module-federation): add initial module-federation package (#28783)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> We do not currently have an `@nx/module-federation` package to house the shared executors and utils for Module Federation across `Webpack`, `Rspack` and `Angular`. ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> Create a single package to store the Module Federation capabilities within Nx ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
This commit is contained in:
parent
1e1cd3a0c5
commit
06af0ee53b
@ -106,6 +106,9 @@ rust-toolchain @nrwl/nx-native-reviewers
|
||||
/packages/vite/** @nrwl/nx-js-reviewers
|
||||
/e2e/vite/** @nrwl/nx-js-reviewers
|
||||
|
||||
## Module Federation
|
||||
/packages/module-federation/** @nrwl/nx-js-reviewers
|
||||
|
||||
## Tools
|
||||
/docs/generated/packages/cypress/** @nrwl/nx-testing-tools-reviewers @nrwl/nx-docs-reviewers
|
||||
/docs/shared/packages/cypress/** @nrwl/nx-testing-tools-reviewers @nrwl/nx-docs-reviewers
|
||||
|
||||
@ -8203,6 +8203,14 @@
|
||||
"isExternal": false,
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"id": "module-federation",
|
||||
"path": "/nx-api/module-federation",
|
||||
"name": "module-federation",
|
||||
"children": [],
|
||||
"isExternal": false,
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"id": "nest",
|
||||
"path": "/nx-api/nest",
|
||||
|
||||
@ -1306,6 +1306,18 @@
|
||||
},
|
||||
"path": "/nx-api/js"
|
||||
},
|
||||
"module-federation": {
|
||||
"githubRoot": "https://github.com/nrwl/nx/blob/master",
|
||||
"name": "module-federation",
|
||||
"packageName": "@nx/module-federation",
|
||||
"description": "The Nx Plugin for Module Federation contains executors and utilities that support building applications using Module Federation.",
|
||||
"documents": {},
|
||||
"root": "/packages/module-federation",
|
||||
"source": "/packages/module-federation/src",
|
||||
"executors": {},
|
||||
"generators": {},
|
||||
"path": "/nx-api/module-federation"
|
||||
},
|
||||
"nest": {
|
||||
"githubRoot": "https://github.com/nrwl/nx/blob/master",
|
||||
"name": "nest",
|
||||
|
||||
@ -1292,6 +1292,17 @@
|
||||
"root": "/packages/js",
|
||||
"source": "/packages/js/src"
|
||||
},
|
||||
{
|
||||
"description": "The Nx Plugin for Module Federation contains executors and utilities that support building applications using Module Federation.",
|
||||
"documents": [],
|
||||
"executors": [],
|
||||
"generators": [],
|
||||
"githubRoot": "https://github.com/nrwl/nx/blob/master",
|
||||
"name": "module-federation",
|
||||
"packageName": "@nx/module-federation",
|
||||
"root": "/packages/module-federation",
|
||||
"source": "/packages/module-federation/src"
|
||||
},
|
||||
{
|
||||
"description": "The Nx Plugin for Nest contains executors and generators for allowing your workspace to create powerful Nest best in class APIs.",
|
||||
"documents": [
|
||||
|
||||
@ -491,6 +491,7 @@
|
||||
- [setup-build](/nx-api/js/generators/setup-build)
|
||||
- [typescript-sync](/nx-api/js/generators/typescript-sync)
|
||||
- [setup-prettier](/nx-api/js/generators/setup-prettier)
|
||||
- [module-federation](/nx-api/module-federation)
|
||||
- [nest](/nx-api/nest)
|
||||
- [documents](/nx-api/nest/documents)
|
||||
- [Overview](/nx-api/nest/documents/overview)
|
||||
|
||||
45
packages/module-federation/.eslintrc.json
Normal file
45
packages/module-federation/.eslintrc.json
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"extends": ["../../.eslintrc.json"],
|
||||
"ignorePatterns": ["!**/*"],
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": ["*.ts", "*.tsx"],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": ["*.js", "*.jsx"],
|
||||
"rules": {}
|
||||
},
|
||||
{
|
||||
"files": ["./package.json", "./generators.json", "./executors.json"],
|
||||
"parser": "jsonc-eslint-parser",
|
||||
"rules": {
|
||||
"@nx/nx-plugin-checks": "error"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["./package.json"],
|
||||
"parser": "jsonc-eslint-parser",
|
||||
"rules": {
|
||||
"@nx/dependency-checks": [
|
||||
"error",
|
||||
{
|
||||
"buildTargets": ["build-base"],
|
||||
"ignoredDependencies": [
|
||||
"nx",
|
||||
"eslint",
|
||||
"typescript",
|
||||
"@nx/cypress",
|
||||
"@nx/playwright",
|
||||
"@nx/vite"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
18
packages/module-federation/README.md
Normal file
18
packages/module-federation/README.md
Normal file
@ -0,0 +1,18 @@
|
||||
<p style="text-align: center;">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
|
||||
<img alt="Nx - Smart Monorepos · Fast CI" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
{{links}}
|
||||
|
||||
<hr>
|
||||
|
||||
# Nx: Smart Monorepos · Fast CI
|
||||
|
||||
Nx is a build system, optimized for monorepos, with plugins for popular frameworks and tools and advanced CI capabilities including caching and distribution.
|
||||
|
||||
This package is a [Module Federation plugin for Nx](https://nx.dev/nx-api/module-federation).
|
||||
|
||||
{{content}}
|
||||
4
packages/module-federation/executors.json
Normal file
4
packages/module-federation/executors.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"executors": {}
|
||||
}
|
||||
0
packages/module-federation/index.ts
Normal file
0
packages/module-federation/index.ts
Normal file
16
packages/module-federation/jest.config.ts
Normal file
16
packages/module-federation/jest.config.ts
Normal file
@ -0,0 +1,16 @@
|
||||
/* eslint-disable */
|
||||
export default {
|
||||
displayName: 'module-federation',
|
||||
preset: '../../jest.preset.js',
|
||||
globals: {},
|
||||
transform: {
|
||||
'^.+\\.[tj]s$': [
|
||||
'ts-jest',
|
||||
{
|
||||
tsconfig: '<rootDir>/tsconfig.spec.json',
|
||||
},
|
||||
],
|
||||
},
|
||||
moduleFileExtensions: ['ts', 'js', 'html'],
|
||||
coverageDirectory: '../../coverage/packages/module-federation',
|
||||
};
|
||||
1
packages/module-federation/migrations.json
Normal file
1
packages/module-federation/migrations.json
Normal file
@ -0,0 +1 @@
|
||||
{}
|
||||
33
packages/module-federation/package.json
Normal file
33
packages/module-federation/package.json
Normal file
@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "@nx/module-federation",
|
||||
"description": "The Nx Plugin for Module Federation contains executors and utilities that support building applications using Module Federation.",
|
||||
"version": "0.0.1",
|
||||
"type": "commonjs",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nrwl/nx.git",
|
||||
"directory": "packages/module-federation"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/nrwl/nx/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"Monorepo",
|
||||
"Rspack",
|
||||
"Webpack",
|
||||
"Bundling",
|
||||
"Module Federation"
|
||||
],
|
||||
"author": "Colum Ferry",
|
||||
"license": "MIT",
|
||||
"homepage": "https://nx.dev",
|
||||
"main": "index.js",
|
||||
"executors": "./executors.json",
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
},
|
||||
"peerDependencies": {},
|
||||
"nx-migrations": {
|
||||
"migrations": "./migrations.json"
|
||||
}
|
||||
}
|
||||
60
packages/module-federation/project.json
Normal file
60
packages/module-federation/project.json
Normal file
@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "module-federation",
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "packages/module-federation",
|
||||
"projectType": "library",
|
||||
"targets": {
|
||||
"build-base": {
|
||||
"executor": "@nx/js:tsc",
|
||||
"options": {
|
||||
"outputPath": "build/packages/module-federation",
|
||||
"tsConfig": "packages/module-federation/tsconfig.lib.json",
|
||||
"main": "packages/module-federation/index.ts",
|
||||
"generateExportsField": true,
|
||||
"additionalEntryPoints": [
|
||||
"{projectRoot}/{executors,generators,migrations}.json",
|
||||
"{projectRoot}/plugin.ts"
|
||||
],
|
||||
"assets": [
|
||||
{
|
||||
"input": "packages/module-federation",
|
||||
"glob": "**/files/**",
|
||||
"output": "/"
|
||||
},
|
||||
{
|
||||
"input": "packages/module-federation",
|
||||
"glob": "**/files/**/.gitkeep",
|
||||
"output": "/"
|
||||
},
|
||||
{
|
||||
"input": "packages/module-federation",
|
||||
"glob": "**/*.json",
|
||||
"ignore": ["**/tsconfig*.json", "project.json", ".eslintrc.json"],
|
||||
"output": "/"
|
||||
},
|
||||
{
|
||||
"input": "packages/module-federation",
|
||||
"glob": "**/*.js",
|
||||
"ignore": ["**/jest.config.js"],
|
||||
"output": "/"
|
||||
},
|
||||
{
|
||||
"input": "packages/module-federation",
|
||||
"glob": "**/*.d.ts",
|
||||
"output": "/"
|
||||
},
|
||||
{
|
||||
"input": "",
|
||||
"glob": "LICENSE",
|
||||
"output": "/"
|
||||
}
|
||||
]
|
||||
},
|
||||
"outputs": ["{options.outputPath}"]
|
||||
},
|
||||
"build": {
|
||||
"command": "node ./scripts/copy-readme.js module-federation",
|
||||
"outputs": ["{workspaceRoot}/build/packages/module-federation"]
|
||||
}
|
||||
}
|
||||
}
|
||||
16
packages/module-federation/tsconfig.json
Normal file
16
packages/module-federation/tsconfig.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs"
|
||||
},
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.lib.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.spec.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
10
packages/module-federation/tsconfig.lib.json
Normal file
10
packages/module-federation/tsconfig.lib.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../dist/out-tsc",
|
||||
"declaration": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["**/*.ts"],
|
||||
"exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"]
|
||||
}
|
||||
9
packages/module-federation/tsconfig.spec.json
Normal file
9
packages/module-federation/tsconfig.spec.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../dist/out-tsc",
|
||||
"module": "commonjs",
|
||||
"types": ["jest", "node"]
|
||||
},
|
||||
"include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user