Skip to content

Commit

Permalink
fix(module-federation): refactor federate-module generator (#19979)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndcunningham authored Nov 1, 2023
1 parent c83afeb commit 67f47c2
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 32 deletions.
12 changes: 6 additions & 6 deletions docs/generated/packages/angular/generators/federate-module.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
12 changes: 6 additions & 6 deletions docs/generated/packages/react/generators/federate-module.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
4 changes: 2 additions & 2 deletions docs/shared/recipes/module-federation/federate-a-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
4 changes: 2 additions & 2 deletions e2e/angular-core/src/module-federation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}';`);
Expand Down Expand Up @@ -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}';`);
Expand Down
4 changes: 2 additions & 2 deletions e2e/react-core/src/react-module-federation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
14 changes: 7 additions & 7 deletions packages/angular/src/generators/federate-module/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
14 changes: 7 additions & 7 deletions packages/react/src/generators/federate-module/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down

1 comment on commit 67f47c2

@vercel
Copy link

@vercel vercel bot commented on 67f47c2 Nov 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-nrwl.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx.dev
nx-five.vercel.app

Please sign in to comment.