feat(angular): remove mfe-remote alias in favour of remote (#9832)

This commit is contained in:
Colum Ferry 2022-04-14 11:11:46 +01:00 committed by GitHub
parent 40403fa58b
commit 73d8967a2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 48 additions and 50 deletions

View File

@ -186,21 +186,21 @@
"description": "Generate a Module Federation configuration for the application", "description": "Generate a Module Federation configuration for the application",
"type": "boolean", "type": "boolean",
"default": false, "default": false,
"x-deprecated": "Use the `mfe-host` or `mfe-remote` generators instead. Support for generating MFE applications using the application generator will be removed in an upcoming version." "x-deprecated": "Use the `mfe-host` or `remote` generators instead. Support for generating MFE applications using the application generator will be removed in an upcoming version."
}, },
"mfeType": { "mfeType": {
"type": "string", "type": "string",
"enum": ["host", "remote"], "enum": ["host", "remote"],
"description": "Type of application to generate the Module Federation configuration for.", "description": "Type of application to generate the Module Federation configuration for.",
"default": "remote", "default": "remote",
"x-deprecated": "Use the `mfe-host` or `mfe-remote` generators instead. Support for generating MFE applications using the application generator will be removed in an upcoming version." "x-deprecated": "Use the `mfe-host` or `remote` generators instead. Support for generating MFE applications using the application generator will be removed in an upcoming version."
}, },
"federationType": { "federationType": {
"type": "string", "type": "string",
"enum": ["static", "dynamic"], "enum": ["static", "dynamic"],
"description": "Use either Static or Dynamic Module Federation pattern for the application.", "description": "Use either Static or Dynamic Module Federation pattern for the application.",
"default": "static", "default": "static",
"x-deprecated": "Use the `mfe-host` or `mfe-remote` generators instead. Support for generating MFE applications using the application generator will be removed in an upcoming version." "x-deprecated": "Use the `mfe-host` or `remote` generators instead. Support for generating MFE applications using the application generator will be removed in an upcoming version."
}, },
"port": { "port": {
"type": "number", "type": "number",
@ -209,12 +209,12 @@
"remotes": { "remotes": {
"type": "array", "type": "array",
"description": "A list of remote application names that the host application should consume.", "description": "A list of remote application names that the host application should consume.",
"x-deprecated": "Use the `mfe-host` or `mfe-remote` generators instead. Support for generating MFE applications using the application generator will be removed in an upcoming version." "x-deprecated": "Use the `mfe-host` or `remote` generators instead. Support for generating MFE applications using the application generator will be removed in an upcoming version."
}, },
"host": { "host": {
"type": "string", "type": "string",
"description": "The name of the host application that the remote application will be consumed by.", "description": "The name of the host application that the remote application will be consumed by.",
"x-deprecated": "Use the `mfe-host` or `mfe-remote` generators instead. Support for generating MFE applications using the application generator will be removed in an upcoming version." "x-deprecated": "Use the `mfe-host` or `remote` generators instead. Support for generating MFE applications using the application generator will be removed in an upcoming version."
}, },
"setParserOptionsProject": { "setParserOptionsProject": {
"type": "boolean", "type": "boolean",
@ -877,19 +877,19 @@
"path": "/packages/angular/src/generators/library-secondary-entry-point/schema.json" "path": "/packages/angular/src/generators/library-secondary-entry-point/schema.json"
}, },
{ {
"name": "mfe-remote", "name": "remote",
"factory": "./src/generators/mfe-remote/mfe-remote", "factory": "./src/generators/remote/remote",
"schema": { "schema": {
"$schema": "http://json-schema.org/schema", "$schema": "http://json-schema.org/schema",
"$id": "NxMFERemote", "$id": "NxMFRemote",
"cli": "nx", "cli": "nx",
"title": "Nx MFE Remote App", "title": "Nx Module Federation Remote App",
"description": "Create an Angular Remote Micro Frontend Application.", "description": "Create an Angular Remote Module Federation Application.",
"type": "object", "type": "object",
"examples": [ "examples": [
{ {
"command": "nx g @nrwl/angular:mfe-remote appName --host=host --port=4201", "command": "nx g @nrwl/angular:remote appName --host=host --port=4201",
"description": "Create an Angular app with configuration in place for MFE. If host is provided, attach this remote app to host app's configuration." "description": "Create an Angular app with configuration in place for Module Federation. If host is provided, attach this remote app to host app's configuration."
} }
], ],
"properties": { "properties": {
@ -1024,11 +1024,11 @@
"required": ["name"], "required": ["name"],
"presets": [] "presets": []
}, },
"aliases": ["remote"], "description": "Generate a Remote Angular Module Federation Application.",
"description": "Generate a Remote Angular Micro-Frontend Application.", "implementation": "/packages/angular/src/generators/remote/remote.ts",
"implementation": "/packages/angular/src/generators/mfe-remote/mfe-remote.ts", "aliases": [],
"hidden": false, "hidden": false,
"path": "/packages/angular/src/generators/mfe-remote/schema.json" "path": "/packages/angular/src/generators/remote/schema.json"
}, },
{ {
"name": "move", "name": "move",

View File

@ -28,7 +28,7 @@
"karma-project", "karma-project",
"library", "library",
"library-secondary-entry-point", "library-secondary-entry-point",
"mfe-remote", "remote",
"move", "move",
"convert-to-with-mf", "convert-to-with-mf",
"mfe-host", "mfe-host",

View File

@ -71,11 +71,10 @@
"aliases": ["secondary-entry-point", "entry-point"], "aliases": ["secondary-entry-point", "entry-point"],
"description": "Creates a secondary entry point for an Angular publishable library." "description": "Creates a secondary entry point for an Angular publishable library."
}, },
"mfe-remote": { "remote": {
"factory": "./src/generators/mfe-remote/mfe-remote.compat", "factory": "./src/generators/remote/remote.compat",
"schema": "./src/generators/mfe-remote/schema.json", "schema": "./src/generators/remote/schema.json",
"aliases": ["remote"], "description": "Generate a Remote Angular Module Federation Application."
"description": "Generate a Remote Angular Micro-Frontend Application."
}, },
"move": { "move": {
"factory": "./src/generators/move/move#angularMoveSchematic", "factory": "./src/generators/move/move#angularMoveSchematic",
@ -220,11 +219,10 @@
"aliases": ["secondary-entry-point", "entry-point"], "aliases": ["secondary-entry-point", "entry-point"],
"description": "Creates a secondary entry point for an Angular publishable library." "description": "Creates a secondary entry point for an Angular publishable library."
}, },
"mfe-remote": { "remote": {
"factory": "./src/generators/mfe-remote/mfe-remote", "factory": "./src/generators/remote/remote",
"schema": "./src/generators/mfe-remote/schema.json", "schema": "./src/generators/remote/schema.json",
"aliases": ["remote"], "description": "Generate a Remote Angular Module Federation Application."
"description": "Generate a Remote Angular Micro-Frontend Application."
}, },
"move": { "move": {
"factory": "./src/generators/move/move#angularMoveGenerator", "factory": "./src/generators/move/move#angularMoveGenerator",

View File

@ -21,4 +21,4 @@ export * from './src/generators/add-linting/add-linting';
export * from './src/generators/component-cypress-spec/component-cypress-spec'; export * from './src/generators/component-cypress-spec/component-cypress-spec';
export * from './src/generators/component-story/component-story'; export * from './src/generators/component-story/component-story';
export * from './src/generators/web-worker/web-worker'; export * from './src/generators/web-worker/web-worker';
export * from './src/generators/mfe-remote/mfe-remote'; export * from './src/generators/remote/remote';

View File

@ -132,21 +132,21 @@
"description": "Generate a Module Federation configuration for the application", "description": "Generate a Module Federation configuration for the application",
"type": "boolean", "type": "boolean",
"default": false, "default": false,
"x-deprecated": "Use the `mfe-host` or `mfe-remote` generators instead. Support for generating MFE applications using the application generator will be removed in an upcoming version." "x-deprecated": "Use the `mfe-host` or `remote` generators instead. Support for generating MFE applications using the application generator will be removed in an upcoming version."
}, },
"mfeType": { "mfeType": {
"type": "string", "type": "string",
"enum": ["host", "remote"], "enum": ["host", "remote"],
"description": "Type of application to generate the Module Federation configuration for.", "description": "Type of application to generate the Module Federation configuration for.",
"default": "remote", "default": "remote",
"x-deprecated": "Use the `mfe-host` or `mfe-remote` generators instead. Support for generating MFE applications using the application generator will be removed in an upcoming version." "x-deprecated": "Use the `mfe-host` or `remote` generators instead. Support for generating MFE applications using the application generator will be removed in an upcoming version."
}, },
"federationType": { "federationType": {
"type": "string", "type": "string",
"enum": ["static", "dynamic"], "enum": ["static", "dynamic"],
"description": "Use either Static or Dynamic Module Federation pattern for the application.", "description": "Use either Static or Dynamic Module Federation pattern for the application.",
"default": "static", "default": "static",
"x-deprecated": "Use the `mfe-host` or `mfe-remote` generators instead. Support for generating MFE applications using the application generator will be removed in an upcoming version." "x-deprecated": "Use the `mfe-host` or `remote` generators instead. Support for generating MFE applications using the application generator will be removed in an upcoming version."
}, },
"port": { "port": {
"type": "number", "type": "number",
@ -155,12 +155,12 @@
"remotes": { "remotes": {
"type": "array", "type": "array",
"description": "A list of remote application names that the host application should consume.", "description": "A list of remote application names that the host application should consume.",
"x-deprecated": "Use the `mfe-host` or `mfe-remote` generators instead. Support for generating MFE applications using the application generator will be removed in an upcoming version." "x-deprecated": "Use the `mfe-host` or `remote` generators instead. Support for generating MFE applications using the application generator will be removed in an upcoming version."
}, },
"host": { "host": {
"type": "string", "type": "string",
"description": "The name of the host application that the remote application will be consumed by.", "description": "The name of the host application that the remote application will be consumed by.",
"x-deprecated": "Use the `mfe-host` or `mfe-remote` generators instead. Support for generating MFE applications using the application generator will be removed in an upcoming version." "x-deprecated": "Use the `mfe-host` or `remote` generators instead. Support for generating MFE applications using the application generator will be removed in an upcoming version."
}, },
"setParserOptionsProject": { "setParserOptionsProject": {
"type": "boolean", "type": "boolean",

View File

@ -1,4 +0,0 @@
import { convertNxGenerator } from '@nrwl/devkit';
import mfeRemote from './mfe-remote';
export default convertNxGenerator(mfeRemote);

View File

@ -0,0 +1,4 @@
import { convertNxGenerator } from '@nrwl/devkit';
import remote from './remote';
export default convertNxGenerator(remote);

View File

@ -1,5 +1,5 @@
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import mfeRemote from './mfe-remote'; import remote from './remote';
import applicationGenerator from '../application/application'; import applicationGenerator from '../application/application';
import { readProjectConfiguration } from '@nrwl/devkit'; import { readProjectConfiguration } from '@nrwl/devkit';
@ -9,7 +9,7 @@ describe('MFE Remote App Generator', () => {
const tree = createTreeWithEmptyWorkspace(2); const tree = createTreeWithEmptyWorkspace(2);
// ACT // ACT
await mfeRemote(tree, { await remote(tree, {
name: 'test', name: 'test',
port: 4201, port: 4201,
}); });
@ -30,7 +30,7 @@ describe('MFE Remote App Generator', () => {
}); });
// ACT // ACT
await mfeRemote(tree, { await remote(tree, {
name: 'test', name: 'test',
host: 'host', host: 'host',
port: 4201, port: 4201,
@ -47,7 +47,7 @@ describe('MFE Remote App Generator', () => {
// ACT // ACT
try { try {
await mfeRemote(tree, { await remote(tree, {
name: 'test', name: 'test',
host: 'host', host: 'host',
port: 4201, port: 4201,
@ -63,13 +63,13 @@ describe('MFE Remote App Generator', () => {
it('should generate a remote mfe app and automatically find the next port available', async () => { it('should generate a remote mfe app and automatically find the next port available', async () => {
// ARRANGE // ARRANGE
const tree = createTreeWithEmptyWorkspace(2); const tree = createTreeWithEmptyWorkspace(2);
await mfeRemote(tree, { await remote(tree, {
name: 'existing', name: 'existing',
port: 4201, port: 4201,
}); });
// ACT // ACT
await mfeRemote(tree, { await remote(tree, {
name: 'test', name: 'test',
}); });
@ -83,7 +83,7 @@ describe('MFE Remote App Generator', () => {
const tree = createTreeWithEmptyWorkspace(2); const tree = createTreeWithEmptyWorkspace(2);
// ACT // ACT
await mfeRemote(tree, { await remote(tree, {
name: 'test', name: 'test',
}); });

View File

@ -19,7 +19,7 @@ function findNextAvailablePort(tree: Tree) {
return nextAvailablePort; return nextAvailablePort;
} }
export default async function mfeRemote(tree: Tree, options: Schema) { export default async function remote(tree: Tree, options: Schema) {
const projects = getProjects(tree); const projects = getProjects(tree);
if (options.host && !projects.has(options.host)) { if (options.host && !projects.has(options.host)) {
throw new Error( throw new Error(

View File

@ -1,14 +1,14 @@
{ {
"$schema": "http://json-schema.org/schema", "$schema": "http://json-schema.org/schema",
"$id": "NxMFERemote", "$id": "NxMFRemote",
"cli": "nx", "cli": "nx",
"title": "Nx MFE Remote App", "title": "Nx Module Federation Remote App",
"description": "Create an Angular Remote Micro Frontend Application.", "description": "Create an Angular Remote Module Federation Application.",
"type": "object", "type": "object",
"examples": [ "examples": [
{ {
"command": "nx g @nrwl/angular:mfe-remote appName --host=host --port=4201", "command": "nx g @nrwl/angular:remote appName --host=host --port=4201",
"description": "Create an Angular app with configuration in place for MFE. If host is provided, attach this remote app to host app's configuration." "description": "Create an Angular app with configuration in place for Module Federation. If host is provided, attach this remote app to host app's configuration."
} }
], ],
"properties": { "properties": {