Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": ["prefer-arrow"],
"plugins": [],
"extends": ["plugin:@typescript-eslint/recommended"],
"rules": {
"semi": ["error", "always"],
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/single-spa-angular.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ jobs:
- name: Run ESLint
run: yarn lint

- name: Run Jest
run: yarn test:ci

- name: Build packages
run: yarn build

Expand All @@ -47,3 +44,6 @@ jobs:
env:
NO_UPDATE_CHECK: 1
run: yarn test:ci:integration

- name: Run Jest
run: yarn test:ci
14 changes: 0 additions & 14 deletions apps/chat/src/app/app-routing.module.ts

This file was deleted.

2 changes: 1 addition & 1 deletion apps/chat/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ <h1 class="title is-1">This is /chat page!</h1>

<button class="button" (click)="goToChatGroups()">Go to /chat/groups</button>

<router-outlet></router-outlet>
<router-outlet />
4 changes: 2 additions & 2 deletions apps/chat/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Component, ChangeDetectionStrategy } from '@angular/core';
import { Router } from '@angular/router';
import { Router, RouterOutlet } from '@angular/router';

@Component({
selector: 'chat-root',
templateUrl: './app.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: false,
imports: [RouterOutlet],
})
export class AppComponent {
constructor(private router: Router) {}
Expand Down
9 changes: 9 additions & 0 deletions apps/chat/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { APP_BASE_HREF } from '@angular/common';
import type { ApplicationConfig } from '@angular/core';
import { provideRouter } from '@angular/router';

import { routes } from './app.routes';

export const appConfig: ApplicationConfig = {
providers: [{ provide: APP_BASE_HREF, useValue: '/chat' }, provideRouter(routes)],
};
15 changes: 0 additions & 15 deletions apps/chat/src/app/app.module.ts

This file was deleted.

12 changes: 12 additions & 0 deletions apps/chat/src/app/app.routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { Routes } from '@angular/router';

export const routes: Routes = [
{
path: 'groups',
loadComponent: () => import('./pages/groups/groups.component').then(m => m.GroupsComponent),
},
{
path: 'rooms',
loadComponent: () => import('./pages/rooms/rooms.component').then(m => m.RoomsComponent),
},
];
12 changes: 0 additions & 12 deletions apps/chat/src/app/pages/groups/groups-routing.module.ts

This file was deleted.

1 change: 0 additions & 1 deletion apps/chat/src/app/pages/groups/groups.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Router } from '@angular/router';
selector: 'chat-groups',
templateUrl: './groups.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: false,
})
export class GroupsComponent {
constructor(private router: Router) {}
Expand Down
11 changes: 0 additions & 11 deletions apps/chat/src/app/pages/groups/groups.module.ts

This file was deleted.

12 changes: 0 additions & 12 deletions apps/chat/src/app/pages/rooms/rooms-routing.module.ts

This file was deleted.

1 change: 0 additions & 1 deletion apps/chat/src/app/pages/rooms/rooms.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ import { Component, ChangeDetectionStrategy } from '@angular/core';
selector: 'chat-rooms',
templateUrl: './rooms.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: false,
})
export class RoomsComponent {}
11 changes: 0 additions & 11 deletions apps/chat/src/app/pages/rooms/rooms.module.ts

This file was deleted.

24 changes: 9 additions & 15 deletions apps/chat/src/main.single-spa.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
import { NgZone } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { NavigationStart, Router } from '@angular/router';
import { singleSpaAngular, getSingleSpaExtraProviders, enableProdMode } from 'single-spa-angular';
import { getSingleSpaExtraProviders, singleSpaAngular } from 'single-spa-angular';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
import { singleSpaPropsSubject } from './single-spa/single-spa-props';

if (environment.production) {
enableProdMode();
}
import { bootstrapApplication, platformBrowser } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
import { appConfig } from './app/app.config';

const lifecycles = singleSpaAngular({
bootstrapFunction: async singleSpaProps => {
const platformRef = platformBrowser(getSingleSpaExtraProviders());
singleSpaPropsSubject.next(singleSpaProps);
const ngModuleRef = await platformBrowserDynamic(getSingleSpaExtraProviders()).bootstrapModule(
AppModule,
);
ngModuleRef.onDestroy(() => {
const appRef = await bootstrapApplication(AppComponent, appConfig, { platformRef });
appRef.onDestroy(() => {
// This is used only for testing purposes.
window.dispatchEvent(new CustomEvent('chatDestroyed'));
});
return ngModuleRef;
return appRef;
},
template: '<chat-root />',
NgZone,
NgZone: 'noop',
Router,
NavigationStart,
});
Expand Down
5 changes: 4 additions & 1 deletion apps/chat/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
}
],
"compilerOptions": {
"target": "es2020"
"target": "es2020",
"module": "preserve",
"moduleResolution": "bundler",
"lib": ["dom", "es2022"]
}
}
14 changes: 3 additions & 11 deletions apps/elements/src/main.single-spa.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { singleSpaAngularElements } from 'single-spa-angular/elements';
import { enableProdMode, getSingleSpaExtraProviders } from 'single-spa-angular';
import { getSingleSpaExtraProviders } from 'single-spa-angular';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

// @ts-ignore
import unmountableStyles from './main.scss?unmountable';

if (environment.production) {
enableProdMode();
}
import { platformBrowser } from '@angular/platform-browser';

const lifecycles = singleSpaAngularElements({
template: '<elements-root />',
bootstrapFunction: async () => {
unmountableStyles.use();

const ngModuleRef = await platformBrowserDynamic(getSingleSpaExtraProviders()).bootstrapModule(
const ngModuleRef = await platformBrowser(getSingleSpaExtraProviders()).bootstrapModule(
AppModule,
{
ngZone: 'noop',
},
);

ngModuleRef.onDestroy(() => unmountableStyles.unuse());
Expand Down
5 changes: 4 additions & 1 deletion apps/elements/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
}
],
"compilerOptions": {
"target": "es2020"
"target": "es2020",
"module": "preserve",
"moduleResolution": "bundler",
"lib": ["dom", "es2022"]
}
}
14 changes: 0 additions & 14 deletions apps/navbar/src/app/app-routing.module.ts

This file was deleted.

4 changes: 2 additions & 2 deletions apps/navbar/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<navbar-primary-nav></navbar-primary-nav>
<router-outlet></router-outlet>
<navbar-primary-nav />
<router-outlet />
5 changes: 4 additions & 1 deletion apps/navbar/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { Component, ChangeDetectionStrategy } from '@angular/core';
import { RouterOutlet } from '@angular/router';

import { PrimaryNavComponent } from './components/primary-nav/primary-nav.component';

@Component({
selector: 'navbar-root',
templateUrl: './app.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: false,
imports: [RouterOutlet, PrimaryNavComponent],
})
export class AppComponent {}
16 changes: 16 additions & 0 deletions apps/navbar/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { APP_BASE_HREF } from '@angular/common';
import { ApplicationConfig } from '@angular/core';
import { provideRouter } from '@angular/router';

import { routes } from './app.routes';

export const appConfig: ApplicationConfig = {
providers: [
{
provide: APP_BASE_HREF,
useValue: '/',
},

provideRouter(routes),
],
};
19 changes: 14 additions & 5 deletions apps/navbar/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { APP_BASE_HREF } from '@angular/common';
import { provideRouter, RouterOutlet } from '@angular/router';

import { AppRoutingModule } from './app-routing.module';
import { routes } from './app.routes';
import { AppComponent } from './app.component';
import { EmptyRouteComponent } from './components/empty-route/empty-route.component';
import { PrimaryNavComponent } from './components/primary-nav/primary-nav.component';
import { BrowserModule } from '@angular/platform-browser';

@NgModule({
imports: [BrowserModule, AppRoutingModule],
declarations: [AppComponent, EmptyRouteComponent, PrimaryNavComponent],
providers: [
{
provide: APP_BASE_HREF,
useValue: '/',
},

provideRouter(routes),
],
imports: [BrowserModule, RouterOutlet, PrimaryNavComponent],
declarations: [AppComponent],
bootstrap: [AppComponent],
})
export class AppModule {}
5 changes: 5 additions & 0 deletions apps/navbar/src/app/app.routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { Routes } from '@angular/router';

import { EmptyRouteComponent } from './components/empty-route/empty-route.component';

export const routes: Routes = [{ path: '**', component: EmptyRouteComponent }];
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ import { Component } from '@angular/core';
@Component({
selector: 'navbar-empty-route',
template: '',
standalone: false,
})
export class EmptyRouteComponent {}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Router } from '@angular/router';
selector: 'navbar-primary-nav',
templateUrl: './primary-nav.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: false,
})
export class PrimaryNavComponent {
links = [
Expand All @@ -17,10 +16,6 @@ export class PrimaryNavComponent {
label: 'Chat',
url: '/chat',
},
{
label: 'Noop zone application',
url: '/noop-zone',
},
{
label: 'Custom element',
url: '/elements',
Expand All @@ -29,10 +24,6 @@ export class PrimaryNavComponent {
label: 'Angular parcel',
url: '/parcel',
},
{
label: 'Angular standalone',
url: '/standalone',
},
];

constructor(private router: Router) {}
Expand Down
Loading
Loading