feat(module-federation): add module federation package (#12961)

This commit is contained in:
Colum Ferry 2022-11-04 09:33:46 +00:00 committed by GitHub
parent ed33d17f8f
commit 377e3bd605
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 241 additions and 0 deletions

View File

@ -27,6 +27,10 @@ module.exports = {
{ name: 'js', description: 'anything TS->JS specific' },
{ name: 'linter', description: 'anything Linter specific' },
{ name: 'misc', description: 'misc stuff' },
{
name: 'module-federation',
description: 'anything related to the Module Federation package',
},
{ name: 'nest', description: 'anything Nest specific' },
{ name: 'nextjs', description: 'anything Next specific' },
{ name: 'node', description: 'anything Node specific' },

View File

@ -0,0 +1,11 @@
{
"githubRoot": "https://github.com/nrwl/nx/blob/master",
"name": "module-federation",
"packageName": "@nrwl/module-federation",
"description": "The Module Federation plugin for Nx contains a Webpack Plugin and helpers to enable Module Federation for your Angular and React apps in your Nx Workspace. ",
"root": "/packages/module-federation",
"source": "/packages/module-federation/src",
"documentation": [],
"generators": [],
"executors": []
}

View File

@ -198,6 +198,13 @@
"path": "generated/packages/make-angular-cli-faster.json",
"schemas": { "executors": [], "generators": [] }
},
{
"name": "module-federation",
"packageName": "module-federation",
"description": "The Module Federation plugin for Nx contains a Webpack Plugin and helpers to enable Module Federation for your Angular and React apps in your Nx Workspace. ",
"path": "generated/packages/module-federation.json",
"schemas": { "executors": [], "generators": [] }
},
{
"name": "nest",
"packageName": "nest",

View File

@ -0,0 +1,14 @@
{
"extends": "../../.eslintrc",
"rules": {},
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["./package.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nrwl/nx/nx-plugin-checks": "error"
}
}
]
}

View File

@ -0,0 +1,13 @@
<p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx.png" width="600" alt="Nx - Smart, Fast and Extensible Build System"></p>
{{links}}
<hr>
# Nx: Smart, Fast and Extensible Build System
Nx is a next generation build system with first class monorepo support and powerful integrations.
This package is a [Module Federation plugin for Nx](https://nx.dev/module-federation/overview).
{{content}}

View File

View File

@ -0,0 +1,11 @@
/* eslint-disable */
export default {
transform: {
'^.+\\.[tj]sx?$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'],
globals: { 'ts-jest': { tsconfig: '<rootDir>/tsconfig.spec.json' } },
displayName: 'module-federation',
testEnvironment: 'node',
preset: '../../jest.preset.js',
};

View File

@ -0,0 +1,4 @@
{
"generators": {},
"packageJsonUpdates": {}
}

View File

@ -0,0 +1,19 @@
import path = require('path');
import json = require('./migrations.json');
type MigrationGenerator = {
cli: string;
version: string;
description: string;
factory: string;
};
describe('Module Federation migrations', () => {
it('should have valid paths', () => {
Object.values<MigrationGenerator>(json.generators).forEach((m) => {
expect(() =>
require.resolve(path.join(__dirname, `${m.factory}.ts`))
).not.toThrow();
});
});
});

View File

@ -0,0 +1,34 @@
{
"name": "@nrwl/module-federation",
"version": "0.0.1",
"private": true,
"description": "The Module Federation plugin for Nx contains a Webpack Plugin and helpers to enable Module Federation for your Angular and React apps in your Nx Workspace. ",
"repository": {
"type": "git",
"url": "https://github.com/nrwl/nx.git",
"directory": "packages/module-federation"
},
"keywords": [
"Monorepo",
"Web",
"Node",
"Webpack",
"Module Federation",
"CLI"
],
"main": "src/index.js",
"typings": "src/index.d.ts",
"license": "MIT",
"bugs": {
"url": "https://github.com/nrwl/nx/issues"
},
"homepage": "https://nx.dev",
"ng-update": {
"requirements": {},
"migrations": "./migrations.json"
},
"dependencies": {},
"publishConfig": {
"access": "public"
}
}

View File

@ -0,0 +1,78 @@
{
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/module-federation/src",
"projectType": "library",
"targets": {
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"packages/module-federation/**/*.ts",
"packages/module-federation/package.json",
"packages/module-federation/migrations.json"
]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["{workspaceRoot}/coverage/module-federation"],
"options": {
"jestConfig": "packages/module-federation/jest.config.ts",
"passWithNoTests": true
}
},
"build-base": {
"executor": "@nrwl/js:tsc",
"options": {
"outputPath": "build/packages/module-federation",
"tsConfig": "packages/module-federation/tsconfig.lib.json",
"main": "packages/module-federation/index.ts",
"updateBuildableProjectDepsInPackageJson": false,
"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": {
"executor": "nx:run-commands",
"outputs": ["{workspaceRoot}/build/packages/module-federation"],
"options": {
"command": "node ./scripts/copy-readme.js module-federation"
}
}
},
"tags": []
}

View File

@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}

View File

@ -0,0 +1,11 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"exclude": ["**/*.spec.ts", "**/*.test.ts", "jest.config.ts"],
"include": ["**/*.ts"]
}

View File

@ -0,0 +1,20 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": [
"**/*.spec.ts",
"**/*.test.ts",
"**/*.spec.tsx",
"**/*.test.tsx",
"**/*.spec.js",
"**/*.test.js",
"**/*.spec.jsx",
"**/*.test.jsx",
"**/*.d.ts",
"jest.config.ts"
]
}

View File

@ -36,6 +36,7 @@
"@nrwl/js": ["packages/js/src"],
"@nrwl/js/*": ["packages/js/*"],
"@nrwl/linter": ["packages/linter"],
"@nrwl/module-federation": ["packages/module-federation"],
"@nrwl/nest": ["packages/nest"],
"@nrwl/next": ["packages/next"],
"@nrwl/node": ["packages/node"],

View File

@ -50,6 +50,7 @@
"js": "packages/js",
"linter": "packages/linter",
"make-angular-cli-faster": "packages/make-angular-cli-faster",
"module-federation": "packages/module-federation",
"nest": "packages/nest",
"next": "packages/next",
"node": "packages/node",