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

feat(module-federation): add initial module-federation package #28783

Merged
merged 5 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 3 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -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/** @jaysoo @Coly010 @ndcunningham
Coly010 marked this conversation as resolved.
Show resolved Hide resolved

## 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
Expand Down
8 changes: 8 additions & 0 deletions docs/generated/manifests/menus.json
Original file line number Diff line number Diff line change
Expand Up @@ -8179,6 +8179,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",
Expand Down
12 changes: 12 additions & 0 deletions docs/generated/manifests/nx-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 11 additions & 0 deletions docs/generated/packages-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
1 change: 1 addition & 0 deletions docs/shared/reference/sitemap.md
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,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)
Expand Down
45 changes: 45 additions & 0 deletions packages/module-federation/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -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 changes: 18 additions & 0 deletions packages/module-federation/README.md
Original file line number Diff line number Diff line change
@@ -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 changes: 4 additions & 0 deletions packages/module-federation/executors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "http://json-schema.org/schema",
"executors": {}
}
Empty file.
16 changes: 16 additions & 0 deletions packages/module-federation/jest.config.ts
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions packages/module-federation/migrations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
33 changes: 33 additions & 0 deletions packages/module-federation/package.json
Original file line number Diff line number Diff line change
@@ -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 changes: 60 additions & 0 deletions packages/module-federation/project.json
Original file line number Diff line number Diff line change
@@ -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 changes: 16 additions & 0 deletions packages/module-federation/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs"
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
10 changes: 10 additions & 0 deletions packages/module-federation/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions packages/module-federation/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -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"]
}