Skip to content

docs: update to Angular 19 #4762

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
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
14 changes: 7 additions & 7 deletions projects/ngrx.io/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,26 @@
"next": {
"fileReplacements": [
{
"src": "src/environments/environment.ts",
"replaceWith": "src/environments/environment.next.ts"
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.next.ts"
}
],
"serviceWorker": true
},
"stable": {
"fileReplacements": [
{
"src": "src/environments/environment.ts",
"replaceWith": "src/environments/environment.stable.ts"
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.stable.ts"
}
],
"serviceWorker": true
},
"archive": {
"fileReplacements": [
{
"src": "src/environments/environment.ts",
"replaceWith": "src/environments/environment.archive.ts"
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.archive.ts"
}
],
"serviceWorker": true
Expand Down Expand Up @@ -203,4 +203,4 @@
"prefix": "aio"
}
}
}
}
48 changes: 24 additions & 24 deletions projects/ngrx.io/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,33 +76,33 @@
},
"private": true,
"dependencies": {
"@angular/animations": "17.2.2",
"@angular/cdk": "17.2.0",
"@angular/common": "17.2.2",
"@angular/core": "17.2.2",
"@angular/elements": "17.2.2",
"@angular/fire": "^7.6.1",
"@angular/forms": "17.2.2",
"@angular/material": "17.2.0",
"@angular/platform-browser": "17.2.2",
"@angular/platform-browser-dynamic": "17.2.2",
"@angular/router": "17.2.2",
"@angular/service-worker": "17.2.2",
"@getpolaris.ai/sdk": "0.0.17",
"@getpolaris.ai/sdk-angular": "0.0.17",
"@angular/animations": "19.2.7",
"@angular/cdk": "19.2.10",
"@angular/common": "19.2.7",
"@angular/core": "19.2.7",
"@angular/elements": "19.2.7",
"@angular/fire": "^19.1.0",
"@angular/forms": "19.2.7",
"@angular/material": "19.2.10",
"@angular/platform-browser": "19.2.7",
"@angular/platform-browser-dynamic": "19.2.7",
"@angular/router": "19.2.7",
"@angular/service-worker": "19.2.7",
"@getpolaris.ai/sdk": "0.0.42",
"@getpolaris.ai/sdk-angular": "0.0.42",
"@webcomponents/custom-elements": "^1.2.0",
"ajv-formats": "^2.1.1",
"rxjs": "~7.5.0",
"rxjs": "~7.8.2",
"tslib": "^2.3.0",
"webpack": "^4.0.0",
"zone.js": "~0.14.4"
"zone.js": "~0.15.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "17.2.0",
"@angular/cli": "17.2.0",
"@angular/compiler": "17.2.2",
"@angular/compiler-cli": "17.2.2",
"@angular/language-service": "17.2.2",
"@angular-devkit/build-angular": "19.2.8",
"@angular/cli": "19.2.8",
"@angular/compiler": "19.2.7",
"@angular/compiler-cli": "19.2.7",
"@angular/language-service": "19.2.7",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "^2.0.4",
"@types/node": "18.16.3",
Expand All @@ -117,7 +117,7 @@
"entities": "^1.1.1",
"eslint": "^3.19.0",
"eslint-plugin-jasmine": "^2.2.0",
"firebase-tools": "^12.7.0",
"firebase-tools": "^13.35.1",
"fs-extra": "^2.1.2",
"globby": "^6.1.0",
"hast-util-is-element": "^1.0.0",
Expand Down Expand Up @@ -154,7 +154,7 @@
"tree-kill": "^1.1.0",
"ts-node": "10.9.1",
"tslint": "~6.1.0",
"typescript": "~5.3.3",
"typescript": "~5.5.4",
"uglify-js": "^3.0.15",
"unist-util-filter": "^0.2.1",
"unist-util-source": "^1.0.1",
Expand All @@ -167,4 +167,4 @@
"xregexp": "^4.0.0",
"yargs": "^7.0.2"
}
}
}
8 changes: 4 additions & 4 deletions projects/ngrx.io/scripts/build-404-page.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env node

// Imports
const {readFileSync, writeFileSync} = require('fs');
const {join, resolve} = require('path');
const { readFileSync, writeFileSync } = require('fs');
const { join, resolve } = require('path');

// Constants
const CI_PREVIEW = process.env.CI_PREVIEW;
Expand All @@ -26,8 +26,8 @@ function _main() {

if (dst404PageContent === srcIndexContent) {
throw new Error(
'Failed to generate \'404.html\'. ' +
'The content of \'index.html\' does not match the expected pattern.');
'Failed to generate \'404.html\'. ' +
'The content of \'index.html\' does not match the expected pattern.');
}

writeFileSync(dst404PagePath, dst404PageContent);
Expand Down
12 changes: 12 additions & 0 deletions projects/ngrx.io/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ class MockScrollService {
// eslint-disable-next-line @angular-eslint/component-selector
selector: 'mat-icon',
template: '',
standalone: false
})
class MockMatIconComponent {
@Input() svgIcon;
Expand All @@ -585,6 +586,7 @@ class MockMatIconComponent {
@Component({
selector: 'aio-notification',
template: '',
standalone: false
})
class MockAioNotificationComponent {
@Input() dismissOnContentClick;
Expand All @@ -594,6 +596,7 @@ class MockAioNotificationComponent {
@Component({
selector: 'aio-top-menu',
template: '',
standalone: false
})
class MockAioTopMenuComponent {
@Input() nodes;
Expand All @@ -602,6 +605,7 @@ class MockAioTopMenuComponent {
@Component({
selector: 'aio-nav-menu',
template: '',
standalone: false
})
class MockAioNavMenuComponent {
@Input() nodes;
Expand All @@ -612,6 +616,7 @@ class MockAioNavMenuComponent {
@Component({
selector: 'aio-select',
template: '',
standalone: false
})
class MockAioSelectComponent {
@Input() options;
Expand All @@ -621,6 +626,7 @@ class MockAioSelectComponent {
@Component({
selector: 'aio-mode-banner',
template: '',
standalone: false
})
class MockAioModeBannerComponent {
@Input() mode;
Expand All @@ -630,6 +636,7 @@ class MockAioModeBannerComponent {
@Component({
selector: 'aio-doc-viewer',
template: '',
standalone: false
})
class MockAioDocViewerComponent {
@Input() doc;
Expand All @@ -638,6 +645,7 @@ class MockAioDocViewerComponent {
@Component({
selector: 'aio-dt',
template: '',
standalone: false
})
class MockAioDtComponent {
@Input() on;
Expand All @@ -647,12 +655,14 @@ class MockAioDtComponent {
@Component({
selector: 'aio-lazy-ce',
template: '',
standalone: false
})
class MockAioLazyCeComponent {}

@Component({
selector: 'aio-footer',
template: '',
standalone: false
})
class MockAioFooterComponent {
@Input() nodes;
Expand All @@ -662,11 +672,13 @@ class MockAioFooterComponent {
@Component({
selector: 'aio-search-box',
template: '',
standalone: false
})
class MockAioSearchBoxComponent {}

@Component({
selector: 'aio-theme-toggle',
template: '',
standalone: false
})
class MockAioThemeToggleComponent {}
1 change: 1 addition & 0 deletions projects/ngrx.io/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const sideNavView = 'SideNav';
@Component({
selector: 'aio-shell',
templateUrl: './app.component.html',
standalone: false
})
export class AppComponent implements OnInit {
currentDocument: DocumentContents;
Expand Down
69 changes: 31 additions & 38 deletions projects/ngrx.io/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ServiceWorkerModule } from '@angular/service-worker';

Expand All @@ -15,7 +15,7 @@ import { MatIconModule, MatIconRegistry } from '@angular/material/icon';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatToolbarModule } from '@angular/material/toolbar';
import { PolarisModule } from '@getpolaris.ai/sdk-angular';
// import { PolarisModule } from '@getpolaris.ai/sdk-angular';

import { AppComponent } from 'app/app.component';
import { CustomIconRegistry, SVG_ICONS } from 'app/shared/custom-icon-registry';
Expand Down Expand Up @@ -105,12 +105,21 @@ export const svgIconProviders = [

/* eslint-enable max-len */

@NgModule({
imports: [
BrowserModule,
@NgModule({ declarations: [
AppComponent,
DocViewerComponent,
DtComponent,
FooterComponent,
ModeBannerComponent,
NavMenuComponent,
NavItemComponent,
SearchBoxComponent,
NotificationComponent,
TopMenuComponent,
],
bootstrap: [AppComponent], imports: [BrowserModule,
BrowserAnimationsModule,
CustomElementsModule,
HttpClientModule,
MatButtonModule,
MatIconModule,
MatProgressBarModule,
Expand All @@ -121,36 +130,11 @@ export const svgIconProviders = [
ServiceWorkerModule.register('/ngsw-worker.js', {
enabled: environment.production,
}),
provideFirebaseApp(() =>
initializeApp({
apiKey: 'AIzaSyBmTz0vGq-QIadpp1piHs7nA_ID8uRAxGI',
authDomain: 'ngrx-io-dev.firebaseapp.com',
databaseURL: 'https://ngrx-io-dev.firebaseio.com',
projectId: 'ngrx-io-dev',
storageBucket: 'ngrx-io-dev.appspot.com',
messagingSenderId: '670550641358',
appId: '1:670550641358:web:cd7543509875b279a71e9f',
})
),
provideFirestore(() => getFirestore()),
ThemeToggleComponent,
PolarisModule.forRoot({
apiKey: 'api:2YGmNa2ATCiq4CWviBVgTHxXJ6F'
}),
],
declarations: [
AppComponent,
DocViewerComponent,
DtComponent,
FooterComponent,
ModeBannerComponent,
NavMenuComponent,
NavItemComponent,
SearchBoxComponent,
NotificationComponent,
TopMenuComponent,
],
providers: [
// PolarisModule.forRoot({
// apiKey: 'api:2YGmNa2ATCiq4CWviBVgTHxXJ6F'
// })
], providers: [
Deployment,
DocumentService,
{ provide: ErrorHandler, useClass: ReportingErrorHandler },
Expand All @@ -168,7 +152,16 @@ export const svgIconProviders = [
TocService,
{ provide: CurrentDateToken, useFactory: currentDateProvider },
{ provide: WindowToken, useFactory: windowProvider },
],
bootstrap: [AppComponent],
})
provideHttpClient(withInterceptorsFromDi()),
provideFirebaseApp(() => initializeApp({
apiKey: 'AIzaSyBmTz0vGq-QIadpp1piHs7nA_ID8uRAxGI',
authDomain: 'ngrx-io-dev.firebaseapp.com',
databaseURL: 'https://ngrx-io-dev.firebaseio.com',
projectId: 'ngrx-io-dev',
storageBucket: 'ngrx-io-dev.appspot.com',
messagingSenderId: '670550641358',
appId: '1:670550641358:web:cd7543509875b279a71e9f',
})),
provideFirestore(() => getFirestore()),
] })
export class AppModule {}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Logger } from 'app/shared/logger.service';
import { MockLogger } from 'testing/logger.service';
import { AnnouncementBarComponent } from './announcement-bar.component';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';

const today = new Date();
const lastWeek = changeDays(today, -7);
Expand All @@ -20,10 +21,10 @@ describe('AnnouncementBarComponent', () => {

beforeEach(() => {
const injector = TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
declarations: [AnnouncementBarComponent],
providers: [{ provide: Logger, useClass: MockLogger }]
});
declarations: [AnnouncementBarComponent],
imports: [],
providers: [{ provide: Logger, useClass: MockLogger }, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
});

httpMock = injector.get(HttpTestingController);
mockLogger = injector.get(Logger);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ export interface Announcement {
<p [innerHTML]="announcement.message"></p>
<a class="button" [href]="announcement.linkUrl">Learn More</a>
</div>
</div>`
</div>`,
standalone: false
})
export class AnnouncementBarComponent implements OnInit {
announcement: Announcement;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { NgModule, Type } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HttpClientModule } from '@angular/common/http';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { SharedModule } from '../../shared/shared.module';
import { AnnouncementBarComponent } from './announcement-bar.component';
import { WithCustomElementComponent } from '../element-registry';

@NgModule({
imports: [CommonModule, SharedModule, HttpClientModule],
declarations: [AnnouncementBarComponent],
})
@NgModule({ declarations: [AnnouncementBarComponent], imports: [CommonModule, SharedModule], providers: [provideHttpClient(withInterceptorsFromDi())] })
export class AnnouncementBarModule implements WithCustomElementComponent {
customElementComponent: Type<any> = AnnouncementBarComponent;
}
Loading