Skip to content

Commit

Permalink
feat(angular): switch default to typescript configuration for module …
Browse files Browse the repository at this point in the history
…federation
  • Loading branch information
Coly010 committed Oct 4, 2023
1 parent 601b74d commit fd25d38
Show file tree
Hide file tree
Showing 34 changed files with 1,692 additions and 35 deletions.
5 changes: 5 additions & 0 deletions docs/generated/packages/angular/generators/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@
"type": "boolean",
"default": false,
"x-priority": "important"
},
"typescriptConfiguration": {
"type": "boolean",
"description": "Whether the module federation configuration and webpack configuration files should use TS.",
"default": true
}
},
"additionalProperties": false,
Expand Down
5 changes: 5 additions & 0 deletions docs/generated/packages/angular/generators/remote.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@
"description": "Whether to configure SSR for the remote application to be consumed by a host application using SSR.",
"type": "boolean",
"default": false
},
"typescriptConfiguration": {
"type": "boolean",
"description": "Whether the module federation configuration and webpack configuration files should use TS.",
"default": true
}
},
"additionalProperties": false,
Expand Down
5 changes: 5 additions & 0 deletions docs/generated/packages/angular/generators/setup-mf.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@
"type": "boolean",
"description": "Whether the application is a standalone application. _Note: This is only supported in Angular versions >= 14.1.0_",
"default": false
},
"typescriptConfiguration": {
"type": "boolean",
"description": "Whether the module federation configuration and webpack configuration files should use TS.",
"default": true
}
},
"required": ["appName", "mfType"],
Expand Down
19 changes: 10 additions & 9 deletions e2e/angular-core/src/module-federation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('Angular Module Federation', () => {
}Module } from '@${proj}/${sharedLib}';
import { ${
names(secondaryEntry).className
}Module } from '@${proj}/${secondaryEntry}';
}Module } from '@${proj}/${sharedLib}/${secondaryEntry}';
import { AppComponent } from './app.component';
import { NxWelcomeComponent } from './nx-welcome.component';
import { RouterModule } from '@angular/router';
Expand All @@ -79,7 +79,7 @@ describe('Angular Module Federation', () => {
declarations: [AppComponent, NxWelcomeComponent],
imports: [
BrowserModule,
SharedModule,
${names(sharedLib).className}Module,
RouterModule.forRoot(
[
{
Expand Down Expand Up @@ -107,14 +107,15 @@ describe('Angular Module Federation', () => {
import { ${names(sharedLib).className}Module } from '@${proj}/${sharedLib}';
import { ${
names(secondaryEntry).className
}Module } from '@${proj}/${secondaryEntry}';
}Module } from '@${proj}/${sharedLib}/${secondaryEntry}';
import { RemoteEntryComponent } from './entry.component';
import { NxWelcomeComponent } from './nx-welcome.component';
@NgModule({
declarations: [RemoteEntryComponent],
declarations: [RemoteEntryComponent, NxWelcomeComponent],
imports: [
CommonModule,
SharedModule,
${names(sharedLib).className}Module,
RouterModule.forChild([
{
path: '',
Expand All @@ -131,7 +132,7 @@ describe('Angular Module Federation', () => {
const process = await runCommandUntil(
`serve ${hostApp} --port=${hostPort} --dev-remotes=${remoteApp1}`,
(output) =>
output.includes(`listening on localhost:${remotePort}`) &&
output.includes(`NX All remotes started`) &&
output.includes(`listening on localhost:${hostPort}`)
);

Expand Down Expand Up @@ -164,8 +165,8 @@ describe('Angular Module Federation', () => {
const process = await runCommandUntil(
`serve ${app1} --dev-remotes=${app2}`,
(output) =>
output.includes(`listening on localhost:${app1Port}`) &&
output.includes(`listening on localhost:${app2Port}`)
output.includes(`NX All remotes started`) &&
output.includes(`listening on localhost:${app1Port}`)
);

// port and process cleanup
Expand Down Expand Up @@ -235,7 +236,7 @@ describe('Angular Module Federation', () => {
const process = await runCommandUntil(
`serve ${hostApp} --port=${hostPort} --dev-remotes=${remoteApp}`,
(output) =>
output.includes(`listening on localhost:${remotePort}`) &&
!output.includes(`Remote '${remoteApp}' failed to serve correctly`) &&
output.includes(`listening on localhost:${hostPort}`)
);

Expand Down
Loading

0 comments on commit fd25d38

Please sign in to comment.