From 67f47c287a6b571bbb6940ff31971d184bd50b8a Mon Sep 17 00:00:00 2001 From: Nicholas Cunningham Date: Wed, 1 Nov 2023 12:52:29 -0600 Subject: [PATCH] fix(module-federation): refactor federate-module generator (#19979) --- .../angular/generators/federate-module.json | 12 ++++++------ .../packages/react/generators/federate-module.json | 12 ++++++------ .../recipes/module-federation/federate-a-module.md | 4 ++-- e2e/angular-core/src/module-federation.test.ts | 4 ++-- e2e/react-core/src/react-module-federation.test.ts | 4 ++-- .../src/generators/federate-module/schema.json | 14 +++++++------- .../src/generators/federate-module/schema.json | 14 +++++++------- 7 files changed, 32 insertions(+), 32 deletions(-) diff --git a/docs/generated/packages/angular/generators/federate-module.json b/docs/generated/packages/angular/generators/federate-module.json index 2d9e2c76f975f..2656515cbf058 100644 --- a/docs/generated/packages/angular/generators/federate-module.json +++ b/docs/generated/packages/angular/generators/federate-module.json @@ -15,19 +15,19 @@ ], "type": "object", "properties": { + "path": { + "type": "string", + "$default": { "$source": "argv", "index": 0 }, + "description": "The path to locate the federated module.", + "x-prompt": "What is the path to the module to be federated?" + }, "name": { "description": "The name of the module.", "type": "string", - "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What name would you like to use for the module?", "pattern": "^[a-zA-Z][^:]*$", "x-priority": "important" }, - "path": { - "type": "string", - "description": "The path to locate the federated module.", - "x-prompt": "What is the path to the module to be federated?" - }, "remote": { "type": "string", "description": "The name of the remote.", diff --git a/docs/generated/packages/react/generators/federate-module.json b/docs/generated/packages/react/generators/federate-module.json index a4fad24584eca..5eebeb4a220fc 100644 --- a/docs/generated/packages/react/generators/federate-module.json +++ b/docs/generated/packages/react/generators/federate-module.json @@ -15,19 +15,19 @@ ], "type": "object", "properties": { + "path": { + "type": "string", + "$default": { "$source": "argv", "index": 0 }, + "description": "The path to locate the federated module. This path should be relative to the workspace root and the file should exist.", + "x-prompt": "What is the path to the module to be federated?" + }, "name": { "description": "The name of the module.", "type": "string", - "$default": { "$source": "argv", "index": 0 }, "x-prompt": "What name would you like to use for the module?", "pattern": "^[a-zA-Z][^:]*$", "x-priority": "important" }, - "path": { - "type": "string", - "description": "The path to locate the federated module. This path should be relative to the workspace root and the file should exist.", - "x-prompt": "What is the path to the module to be federated?" - }, "remote": { "type": "string", "description": "The name of the remote.", diff --git a/docs/shared/recipes/module-federation/federate-a-module.md b/docs/shared/recipes/module-federation/federate-a-module.md index eb2db17cc9c23..7c4ca1c604d16 100644 --- a/docs/shared/recipes/module-federation/federate-a-module.md +++ b/docs/shared/recipes/module-federation/federate-a-module.md @@ -46,14 +46,14 @@ Now that we have created the module, we need to configure it to be federated. {%tab label="React"%} ```shell -nx generate @nx/react:federate-module Hello --remote=greeting --path=hello/src/index.ts --projectNameAndRootFormat=as-provided +nx generate @nx/react:federate-module hello/src/index.ts --name=hello --remote=greeting --projectNameAndRootFormat=as-provided ``` {% /tab %} {%tab label="Angular"%} ```shell -nx generate @nx/angular:federate-module Hello --remote=greeting --path=hello/src/index.ts --projectNameAndRootFormat=as-provided +nx generate @nx/angular:federate-module hello/src/index.ts --name=hello --remote=greeting --projectNameAndRootFormat=as-provided ``` {% /tab %} diff --git a/e2e/angular-core/src/module-federation.test.ts b/e2e/angular-core/src/module-federation.test.ts index 97f0bde368584..1b1ed145e066b 100644 --- a/e2e/angular-core/src/module-federation.test.ts +++ b/e2e/angular-core/src/module-federation.test.ts @@ -326,7 +326,7 @@ describe('Angular Module Federation', () => { // Federate Module runCLI( - `generate @nx/angular:federate-module ${module} --remote=${remote} --path=${lib}/src/index.ts --no-interactive` + `generate @nx/angular:federate-module ${lib}/src/index.ts --name=${module} --remote=${remote} --no-interactive` ); updateFile(`${lib}/src/index.ts`, `export { isEven } from './lib/${lib}';`); @@ -403,7 +403,7 @@ describe('Angular Module Federation', () => { // Federate Module runCLI( - `generate @nx/angular:federate-module ${module} --remote=${childRemote} --path=${lib}/src/index.ts --no-interactive` + `generate @nx/angular:federate-module ${lib}/src/index.ts --name=${module} --remote=${childRemote} --no-interactive` ); updateFile(`${lib}/src/index.ts`, `export { isEven } from './lib/${lib}';`); diff --git a/e2e/react-core/src/react-module-federation.test.ts b/e2e/react-core/src/react-module-federation.test.ts index 5f8831212c864..cb2bcf6504e69 100644 --- a/e2e/react-core/src/react-module-federation.test.ts +++ b/e2e/react-core/src/react-module-federation.test.ts @@ -475,7 +475,7 @@ describe('React Module Federation', () => { // Federate Module runCLI( - `generate @nx/react:federate-module ${module} --remote=${remote} --path=${lib}/src/index.ts --no-interactive` + `generate @nx/react:federate-module ${lib}/src/index.ts --name=${module} --remote=${remote} --no-interactive` ); updateFile( @@ -566,7 +566,7 @@ describe('React Module Federation', () => { // Federate Module runCLI( - `generate @nx/react:federate-module ${module} --remote=${childRemote} --path=${lib}/src/index.ts --no-interactive` + `generate @nx/react:federate-module ${lib}/src/index.ts --name=${module} --remote=${childRemote} --no-interactive` ); updateFile( diff --git a/packages/angular/src/generators/federate-module/schema.json b/packages/angular/src/generators/federate-module/schema.json index d586d263da808..49caf7c66f0e6 100644 --- a/packages/angular/src/generators/federate-module/schema.json +++ b/packages/angular/src/generators/federate-module/schema.json @@ -12,22 +12,22 @@ ], "type": "object", "properties": { - "name": { - "description": "The name of the module.", + "path": { "type": "string", "$default": { "$source": "argv", "index": 0 }, + "description": "The path to locate the federated module.", + "x-prompt": "What is the path to the module to be federated?" + }, + "name": { + "description": "The name of the module.", + "type": "string", "x-prompt": "What name would you like to use for the module?", "pattern": "^[a-zA-Z][^:]*$", "x-priority": "important" }, - "path": { - "type": "string", - "description": "The path to locate the federated module.", - "x-prompt": "What is the path to the module to be federated?" - }, "remote": { "type": "string", "description": "The name of the remote.", diff --git a/packages/react/src/generators/federate-module/schema.json b/packages/react/src/generators/federate-module/schema.json index 20175464132d1..90e3d47f97e67 100644 --- a/packages/react/src/generators/federate-module/schema.json +++ b/packages/react/src/generators/federate-module/schema.json @@ -12,22 +12,22 @@ ], "type": "object", "properties": { - "name": { - "description": "The name of the module.", + "path": { "type": "string", "$default": { "$source": "argv", "index": 0 }, + "description": "The path to locate the federated module. This path should be relative to the workspace root and the file should exist.", + "x-prompt": "What is the path to the module to be federated?" + }, + "name": { + "description": "The name of the module.", + "type": "string", "x-prompt": "What name would you like to use for the module?", "pattern": "^[a-zA-Z][^:]*$", "x-priority": "important" }, - "path": { - "type": "string", - "description": "The path to locate the federated module. This path should be relative to the workspace root and the file should exist.", - "x-prompt": "What is the path to the module to be federated?" - }, "remote": { "type": "string", "description": "The name of the remote.",