Skip to content

Commit

Permalink
feat!: update to angular 18 (#3243)
Browse files Browse the repository at this point in the history
This upgrades the following packages to Angular 18:
- '@swisspost/design-system-intranet-header': major
- '@swisspost/design-system-components-angular': major
- '@swisspost/design-system-styles': major
- '@swisspost/design-system-demo': major

- [x] Update compat table in the docs

---------

Co-authored-by: Oliver Schürch <[email protected]>
Co-authored-by: Alizé Debray <[email protected]>
  • Loading branch information
3 people authored Jul 22, 2024
1 parent 3879aa0 commit 4f6491a
Show file tree
Hide file tree
Showing 25 changed files with 4,547 additions and 2,105 deletions.
8 changes: 8 additions & 0 deletions .changeset/loud-boxes-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@swisspost/design-system-intranet-header': major
'@swisspost/design-system-components-angular': major
'@swisspost/design-system-styles': major
'@swisspost/design-system-demo': major
---

Upgraded to Angular 18
5 changes: 5 additions & 0 deletions .changeset/slow-buttons-provide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-documentation': patch
---

Added a migration section that explains how to go from 7 to 8.
15 changes: 10 additions & 5 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Please contact [[email protected]](mailto:[email protected]).

| Version | Supported | Supported Dependencies |
| ------- | ------------------ | ------------------------------------------ |
| 7 | :white_check_mark: | Bootstrap 5.3, Angular 17, ng-bootstrap 16 |
| 8 | :white_check_mark: | Bootstrap 5.3, Angular 18, ng-bootstrap 17 |
| 7 | until June 2025 | Bootstrap 5.3, Angular 17, ng-bootstrap 16 |
| 6.4 | until end of 2024 | Bootstrap 5.2, Angular 16, ng-bootstrap 15 |
| 6 | until end of 2024 | Bootstrap 5.2, Angular 15, ng-bootstrap 14 |
| 5 | until end of 2023 | Bootstrap 5.1, Angular 14, ng-bootstrap 12 |
Expand All @@ -23,7 +24,8 @@ Please contact [[email protected]](mailto:[email protected]).

| Version | Supported | Supported Dependencies |
| ------- | ------------------ | --------------------------------------- |
| 7[^1] | :white_check_mark: | Angular, Vue JS, React, Vanilla JS, ... |
| 8 | :white_check_mark: | Angular, Vue JS, React, Vanilla JS, ... |
| 7[^1] | until June 2025 | Angular, Vue JS, React, Vanilla JS, ... |
| 1 | July 2024 | Angular, Vue JS, React, Vanilla JS, ... |

### Components Angular
Expand All @@ -32,7 +34,8 @@ Please contact [[email protected]](mailto:[email protected]).

| Version | Supported | Supported Dependencies |
| ------- | ------------------ | ---------------------- |
| 7[^1] | :white_check_mark: | Angular 17 |
| 8 | :white_check_mark: | Angular 18 |
| 7[^1] | until June 2025 | Angular 17 |

### Internet Header

Expand All @@ -48,7 +51,8 @@ Please contact [[email protected]](mailto:[email protected]).

| Version | Supported | Supported Dependencies |
| ------- | ------------------ | ------------------------------------------ |
| 7[^1] | :white_check_mark: | Bootstrap 5.3, Angular 17, ng-bootstrap 16 |
| 8 | :white_check_mark: | Bootstrap 5.3, Angular 18, ng-bootstrap 17 |
| 7[^1] | until June 2025 | Bootstrap 5.3, Angular 17, ng-bootstrap 16 |
| 4 | :white_check_mark: | Bootstrap 5.2, Angular 15, ng-bootstrap 14 |
| 3 | until end of 2023 | Bootstrap 5.1, Angular 14, ng-bootstrap 12 |

Expand All @@ -58,6 +62,7 @@ Please contact [[email protected]](mailto:[email protected]).

| Version | Supported | Supported Dependencies |
| ------- | ------------------ | -------------------------- |
| 7[^1] | :white_check_mark: | Exports SVG files and JSON |
| 8 | :white_check_mark: | Exports SVG files and JSON |
| 7[^1] | until June 2025 | Exports SVG files and JSON |

[^1]: Synced version with @swisspost/design-system-styles package
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"demo:build": "pnpm --filter design-system-demo build",
"demo:lint": "pnpm --filter design-system-demo lint",
"docs": "pnpm docs:start",
"docs:only": "pnpm --filter design-system-documentation start",
"docs:start": "pnpm --filter design-system-documentation... --parallel --stream start",
"docs:build": "pnpm --filter design-system-documentation build",
"docs:headless": "pnpm --filter design-system-documentation start:headless",
Expand Down
11 changes: 3 additions & 8 deletions packages/components-angular/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,13 @@
"builder": "@angular-devkit/build-angular:karma",
"options": {
"tsConfig": "projects/components/tsconfig.spec.json",
"polyfills": [
"zone.js",
"zone.js/testing"
]
"polyfills": ["zone.js", "zone.js/testing"]
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"projects/components/**/*.ts",
"projects/components/**/*.html"
]
"lintFilePatterns": ["projects/components/**/*.ts", "projects/components/**/*.html"]
}
}
}
Expand Down Expand Up @@ -177,6 +171,7 @@
}
},
"cli": {
"packageManager": "pnpm",
"schematicCollections": ["@cypress/schematic", "@schematics/angular"]
}
}
34 changes: 17 additions & 17 deletions packages/components-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@
},
"private": true,
"dependencies": {
"@angular/animations": "17.3.11",
"@angular/common": "17.3.11",
"@angular/compiler": "17.3.11",
"@angular/core": "17.3.11",
"@angular/forms": "17.3.11",
"@angular/platform-browser": "17.3.11",
"@angular/platform-browser-dynamic": "17.3.11",
"@angular/router": "17.3.11",
"@angular/animations": "18.1.0",
"@angular/common": "18.1.0",
"@angular/compiler": "18.1.0",
"@angular/core": "18.1.0",
"@angular/forms": "18.1.0",
"@angular/platform-browser": "18.1.0",
"@angular/platform-browser-dynamic": "18.1.0",
"@angular/router": "18.1.0",
"@swisspost/design-system-components": "workspace:7.4.0",
"@swisspost/design-system-styles": "workspace:7.4.0",
"rxjs": "7.8.1",
"tslib": "2.6.3",
"zone.js": "0.14.7"
},
"devDependencies": {
"@angular-devkit/build-angular": "17.3.8",
"@angular-eslint/builder": "17.5.2",
"@angular-eslint/eslint-plugin": "17.5.2",
"@angular-eslint/eslint-plugin-template": "17.5.2",
"@angular-eslint/template-parser": "17.5.2",
"@angular/cli": "17.3.8",
"@angular/compiler-cli": "17.3.11",
"@angular-devkit/build-angular": "18.0.7",
"@angular-eslint/builder": "18.1.0",
"@angular-eslint/eslint-plugin": "18.1.0",
"@angular-eslint/eslint-plugin-template": "18.1.0",
"@angular-eslint/template-parser": "18.1.0",
"@angular/cli": "18.0.7",
"@angular/compiler-cli": "18.1.0",
"@cypress/schematic": "2.5.2",
"@typescript-eslint/eslint-plugin": "7.15.0",
"@typescript-eslint/parser": "7.15.0",
Expand All @@ -42,7 +42,7 @@
"karma-coverage": "2.2.1",
"karma-jasmine": "5.1.0",
"karma-jasmine-html-reporter": "2.1.0",
"ng-packagr": "17.3.0",
"typescript": "5.3.3"
"ng-packagr": "18.1.0",
"typescript": "5.4.5"
}
}
31 changes: 9 additions & 22 deletions packages/demo/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"allowedCommonJsDependencies": [
"bootstrap/js/dist/collapse",
"prettier"
],
"allowedCommonJsDependencies": ["bootstrap/js/dist/collapse", "prettier"],
"outputPath": "dist/demo",
"index": "src/index.html",
"main": "src/main.ts",
Expand All @@ -32,14 +29,9 @@
"src/assets",
"src/netlify.toml"
],
"styles": [
"src/styles.scss",
"./node_modules/highlight.js/styles/vs2015.css"
],
"styles": ["src/styles.scss", "./node_modules/highlight.js/styles/vs2015.css"],
"stylePreprocessorOptions": {
"includePaths": [
"node_modules"
]
"includePaths": ["node_modules"]
},
"vendorChunk": true,
"extractLicenses": false,
Expand Down Expand Up @@ -97,23 +89,15 @@
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.scss"
],
"styles": ["src/styles.scss"],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
]
"assets": ["src/favicon.ico", "src/assets"]
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"]
}
}
}
Expand All @@ -126,5 +110,8 @@
"@angular-eslint/schematics:library": {
"setParserOptionsProject": true
}
},
"cli": {
"packageManager": "pnpm"
}
}
40 changes: 20 additions & 20 deletions packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
"lint": "ng lint"
},
"dependencies": {
"@angular/animations": "17.3.11",
"@angular/animations": "18.1.0",
"@angular/cdk": "17.3.10",
"@angular/common": "17.3.11",
"@angular/compiler": "17.3.11",
"@angular/core": "17.3.11",
"@angular/forms": "17.3.11",
"@angular/localize": "17.3.11",
"@angular/platform-browser": "17.3.11",
"@angular/platform-browser-dynamic": "17.3.11",
"@angular/router": "17.3.11",
"@ng-bootstrap/ng-bootstrap": "16.0.0",
"@angular/common": "18.1.0",
"@angular/compiler": "18.1.0",
"@angular/core": "18.1.0",
"@angular/forms": "18.1.0",
"@angular/localize": "18.1.0",
"@angular/platform-browser": "18.1.0",
"@angular/platform-browser-dynamic": "18.1.0",
"@angular/router": "18.1.0",
"@ng-bootstrap/ng-bootstrap": "17.0.0",
"@popperjs/core": "2.11.8",
"@swimlane/ngx-datatable": "20.1.0",
"@swisspost/design-system-intranet-header": "workspace:7.4.0",
Expand All @@ -39,15 +39,15 @@
"zone.js": "0.14.7"
},
"devDependencies": {
"@angular-devkit/build-angular": "17.3.8",
"@angular-eslint/builder": "17.5.2",
"@angular-eslint/eslint-plugin": "17.5.2",
"@angular-eslint/eslint-plugin-template": "17.5.2",
"@angular-eslint/template-parser": "17.5.2",
"@angular/cli": "17.3.8",
"@angular/compiler-cli": "17.3.11",
"@angular/elements": "17.3.11",
"@angular/language-service": "17.3.11",
"@angular-devkit/build-angular": "18.0.7",
"@angular-eslint/builder": "18.1.0",
"@angular-eslint/eslint-plugin": "18.1.0",
"@angular-eslint/eslint-plugin-template": "18.1.0",
"@angular-eslint/template-parser": "18.1.0",
"@angular/cli": "18.0.7",
"@angular/compiler-cli": "18.1.0",
"@angular/elements": "18.1.0",
"@angular/language-service": "18.1.0",
"@types/jasmine": "5.1.4",
"@types/jasminewd2": "2.0.13",
"@types/node": "20.12.7",
Expand All @@ -68,7 +68,7 @@
"sass": "1.77.6",
"sockjs": "0.3.24",
"ts-node": "10.9.2",
"typescript": "5.3.3",
"typescript": "5.4.5",
"undici-types": "6.19.2",
"webpack": "5.92.1"
}
Expand Down
59 changes: 26 additions & 33 deletions packages/demo/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,44 +26,37 @@ import { PostSampleComponentsModule } from './post-sample/post-sample-components
import { SwissPostIntranetHeaderModule } from '@swisspost/design-system-intranet-header';
import { HomeComponent } from './home/home.component';
import { PostCommonModule } from './common/post-common.module';
import { HttpClientModule } from '@angular/common/http';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { LayoutContainerComponent } from './layout-container/layout-container.component';

registerLocaleData(localeDe);
registerLocaleData(localeFr);
registerLocaleData(localeIt);
registerLocaleData(localeEn);

@NgModule({
declarations: [
AppComponent,
IntranetLayoutComponent,
LayoutContainerComponent,
HomeComponent,
CopyToClipboardDirective,
],
imports: [
BrowserModule,
AppRoutingModule,
FormsModule,
ReactiveFormsModule,
NgbModule,
HttpClientModule,
BootstrapComponentsModule,
NgBootstrapComponentsModule,
IntranetComponentsModule,
PostCommonModule,
PostSampleComponentsModule,
SwissPostIntranetHeaderModule,
ToastrModule.forRoot({
extendedTimeOut: 0,
closeButton: true,
toastClass: 'toast',
}),
HighlightModule,
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
providers: [ErrorService, HighlightProvider.Config],
bootstrap: [AppComponent],
})
@NgModule({ declarations: [
AppComponent,
IntranetLayoutComponent,
LayoutContainerComponent,
HomeComponent,
CopyToClipboardDirective,
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
bootstrap: [AppComponent], imports: [BrowserModule,
AppRoutingModule,
FormsModule,
ReactiveFormsModule,
NgbModule,
BootstrapComponentsModule,
NgBootstrapComponentsModule,
IntranetComponentsModule,
PostCommonModule,
PostSampleComponentsModule,
SwissPostIntranetHeaderModule,
ToastrModule.forRoot({
extendedTimeOut: 0,
closeButton: true,
toastClass: 'toast',
}),
HighlightModule], providers: [ErrorService, HighlightProvider.Config, provideHttpClient(withInterceptorsFromDi())] })
export class AppModule {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { formatDate, TranslationWidth } from '@angular/common';
import { formatDate } from '@angular/common';
import { NgbDatepickerI18n, NgbDateStruct } from '@ng-bootstrap/ng-bootstrap';

const I18N_VALUES = {
Expand Down Expand Up @@ -93,7 +93,7 @@ export class SwissPostDatepickerI18n extends NgbDatepickerI18n {
super();
}

getWeekdayLabel(weekday: number, _width?: TranslationWidth): string {
getWeekdayLabel(weekday: number): string {
return I18N_VALUES[this._i18n.language].weekdays[weekday - 1];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<ngb-progressbar
ariaLabel="Example of progress."
type="danger"
type="error"
[showValue]="true"
[value]="50"
></ngb-progressbar>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Inject, Injectable, LOCALE_ID } from '@angular/core';
import { formatDate, TranslationWidth } from '@angular/common';
import { formatDate } from '@angular/common';
import { NgbDatepickerI18n, NgbDateStruct } from '@ng-bootstrap/ng-bootstrap';

const I18N_VALUES = {
Expand Down Expand Up @@ -82,7 +82,7 @@ export class SwissPostDatepickerI18n extends NgbDatepickerI18n {
constructor(@Inject(LOCALE_ID) private locale: string) {
super();
}
getWeekdayLabel(weekday: number, _width?: TranslationWidth): string {
getWeekdayLabel(weekday: number): string {
return I18N_VALUES[this.locale].weekdays[weekday - 1];
}

Expand Down
Loading

0 comments on commit 4f6491a

Please sign in to comment.