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

fix(angular): remote port incrementer when no targets #9452

Merged
merged 1 commit into from Mar 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/angular/src/generators/mfe-remote/mfe-remote.spec.ts
Expand Up @@ -77,4 +77,18 @@ describe('MFE Remote App Generator', () => {
const project = readProjectConfiguration(tree, 'test');
expect(project.targets.serve.options.port).toEqual(4202);
});

it('should generate a remote mfe app and automatically find the next port available even when there are no other targets', async () => {
// ARRANGE
const tree = createTreeWithEmptyWorkspace(2);

// ACT
await mfeRemote(tree, {
name: 'test',
});

// ASSERT
const project = readProjectConfiguration(tree, 'test');
expect(project.targets.serve.options.port).toEqual(4201);
});
});
2 changes: 1 addition & 1 deletion packages/angular/src/generators/mfe-remote/mfe-remote.ts
Expand Up @@ -7,7 +7,7 @@ import { getMfeProjects } from '../../utils/get-mfe-projects';
function findNextAvailablePort(tree: Tree) {
const mfeProjects = getMfeProjects(tree);

const ports = new Set<number>();
const ports = new Set<number>([4200]);
for (const mfeProject of mfeProjects) {
const { targets } = readProjectConfiguration(tree, mfeProject);
const port = targets?.serve?.options?.port ?? 4200;
Expand Down