From 9f9ce07f5d41057623634518d03a0d90d93786da Mon Sep 17 00:00:00 2001 From: sinedied Date: Wed, 7 Dec 2022 15:33:49 +0100 Subject: [PATCH] Update to Angular 14 --- angular.json | 6 +- jest.conf.js | 8 +- package.json | 50 +- .../finish/password-reset-finish.component.ts | 4 +- .../init/password-reset-init.component.ts | 4 +- .../account/password/password.component.ts | 4 +- .../account/register/register.component.ts | 4 +- .../account/settings/settings.component.ts | 4 +- src/main/webapp/app/admin/docs/docs.scss | 4 +- ...er-management-delete-dialog.component.html | 2 +- .../user-management-update.component.ts | 4 +- src/main/webapp/app/core/core.module.ts | 2 +- .../entities/statistics/statistics.options.ts | 2 +- .../webapp/app/layouts/navbar/navbar.scss | 4 +- .../app/shared/login/login.component.ts | 4 +- .../app/shared/util/datepicker-adapter.ts | 2 +- src/main/webapp/content/scss/global.scss | 4 +- src/main/webapp/content/scss/vendor.scss | 2 +- src/test/javascript/jest-global-mocks.ts | 3 - src/test/javascript/jest.ts | 2 - src/test/javascript/spec/test.module.ts | 3 +- tsconfig.json | 3 +- yarn.lock | 4378 ++++++++--------- 23 files changed, 2201 insertions(+), 2302 deletions(-) delete mode 100644 src/test/javascript/jest-global-mocks.ts delete mode 100644 src/test/javascript/jest.ts diff --git a/angular.json b/angular.json index 3cf577fc..b46099c2 100644 --- a/angular.json +++ b/angular.json @@ -106,8 +106,12 @@ } } }, - "defaultProject": "jhonline", "cli": { + "cache": { + "enabled": true, + "path": "./target/angular/", + "environment": "all" + }, "packageManager": "yarn" } } diff --git a/jest.conf.js b/jest.conf.js index e742cb87..7218716d 100644 --- a/jest.conf.js +++ b/jest.conf.js @@ -6,10 +6,9 @@ const { const environment = require('./webpack/environment'); module.exports = { + transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$|dayjs/esm)'], testRunner: 'jest-jasmine2', - preset: 'jest-preset-angular', setupFiles: ['jest-date-mock'], - setupFilesAfterEnv: ['/src/test/javascript/jest.ts'], cacheDirectory: '/target/jest-cache', coverageDirectory: '/target/test-results/', globals: { @@ -23,8 +22,9 @@ module.exports = { moduleNameMapper: pathsToModuleNameMapper(paths, { prefix: `/${baseUrl}/` }), reporters: ['default', ['jest-junit', { outputDirectory: './target/test-results/', outputName: 'TESTS-results-jest.xml' }]], testResultsProcessor: 'jest-sonar-reporter', - transformIgnorePatterns: ['node_modules/'], testMatch: ['/src/test/javascript/spec/**/@(*.)@(spec.ts)'], - testURL: 'http://localhost/', + testEnvironmentOptions: { + url: 'http://localhost/' + }, roots: ['', `/${baseUrl}`] }; diff --git a/package.json b/package.json index ee2f29aa..c387731f 100644 --- a/package.json +++ b/package.json @@ -12,30 +12,30 @@ "node_modules" ], "dependencies": { - "@angular/common": "13.3.12", - "@angular/compiler": "13.3.12", - "@angular/core": "13.3.12", - "@angular/forms": "13.3.12", - "@angular/localize": "13.3.12", - "@angular/platform-browser": "13.3.12", - "@angular/platform-browser-dynamic": "13.3.12", - "@angular/router": "13.3.12", - "@fortawesome/angular-fontawesome": "0.10.2", + "@angular/common": "14.2.12", + "@angular/compiler": "14.2.12", + "@angular/core": "14.2.12", + "@angular/forms": "14.2.12", + "@angular/localize": "14.2.12", + "@angular/platform-browser": "14.2.12", + "@angular/platform-browser-dynamic": "14.2.12", + "@angular/router": "14.2.12", + "@fortawesome/angular-fontawesome": "0.11.1", "@fortawesome/fontawesome-svg-core": "1.2.27", "@fortawesome/free-brands-svg-icons": "5.12.0", "@fortawesome/free-solid-svg-icons": "5.12.0", "@ng-bootstrap/ng-bootstrap": "11.0.1", - "@ngx-translate/core": "13.0.0", - "@ngx-translate/http-loader": "6.0.0", + "@ngx-translate/core": "14.0.0", + "@ngx-translate/http-loader": "7.0.0", "@scarf/scarf": "^1.1.1", "bootstrap": "4.5.3", "echarts": "5.4.0", "jquery": "3.6.1", "moment": "2.24.0", "ng-jhipster": "0.16.0", - "ngx-cookie": "5.0.2", - "ngx-echarts": "8.0.1", - "ngx-infinite-scroll": "13.1.0", + "ngx-cookie": "6.0.1", + "ngx-echarts": "14.0.0", + "ngx-infinite-scroll": "14.0.1", "ngx-webstorage": "8.0.0", "popper.js": "1.16.1", "resize-observer-polyfill": "1.5.1", @@ -45,16 +45,17 @@ "zone.js": "~0.11.4" }, "devDependencies": { - "@angular-builders/custom-webpack": "13.1.0", - "@angular-builders/jest": "13.0.4", - "@angular-devkit/build-angular": "~13.3.10", - "@angular-eslint/eslint-plugin": "13.5.0", - "@angular/cli": "13.3.10", - "@angular/compiler-cli": "13.3.12", + "@angular-builders/custom-webpack": "14.1.0", + "@angular-builders/jest": "14.1.0", + "@angular-devkit/build-angular": "^14.2.10", + "@angular-eslint/eslint-plugin": "14.4.0", + "@angular/cli": "14.2.10", + "@angular/compiler-cli": "14.2.12", "@openapitools/openapi-generator-cli": "1.0.10-4.2.3", "@types/echarts": "^4.6.0", "@types/google.analytics": "0.0.40", "@types/jest": "27.5.2", + "@types/moment": "^2.13.0", "@types/node": "12.12.17", "@typescript-eslint/eslint-plugin": "5.15.0", "@typescript-eslint/parser": "5.15.0", @@ -67,18 +68,19 @@ "eslint-webpack-plugin": "3.2.0", "generator-jhipster": "7.2.0", "husky": "3.1.0", - "jest": "27.5.1", + "jest": "28.1.3", "jest-date-mock": "1.0.7", + "jest-environment-jsdom": "28.1.3", + "jest-jasmine2": "28.1.3", "jest-junit": "15.0.0", - "jest-preset-angular": "11.1.2", + "jest-preset-angular": "12.2.3", "jest-sonar-reporter": "2.0.0", "lint-staged": "8.2.1", "moment-locales-webpack-plugin": "^1.2.0", "prettier": "1.19.1", "prettier-plugin-java": "0.8.3", - "reflect-metadata": "0.1.13", "rimraf": "3.0.0", - "ts-jest": "^29.0.3", + "ts-jest": "28.0.8", "typescript": "4.6.4", "webpack": "5.75.0", "webpack-bundle-analyzer": "4.7.0", diff --git a/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.ts b/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.ts index ce926ea7..d69d54ce 100644 --- a/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.ts +++ b/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.ts @@ -17,7 +17,7 @@ * limitations under the License. */ import { Component, OnInit, AfterViewInit, ElementRef, ViewChild } from '@angular/core'; -import { FormBuilder, Validators } from '@angular/forms'; +import { UntypedFormBuilder, Validators } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; import { LoginModalService } from 'app/core/login/login-modal.service'; @@ -46,7 +46,7 @@ export class PasswordResetFinishComponent implements OnInit, AfterViewInit { private passwordResetFinishService: PasswordResetFinishService, private loginModalService: LoginModalService, private route: ActivatedRoute, - private fb: FormBuilder + private fb: UntypedFormBuilder ) {} ngOnInit(): void { diff --git a/src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts b/src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts index fae82ed7..330c98d3 100644 --- a/src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts +++ b/src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts @@ -17,7 +17,7 @@ * limitations under the License. */ import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core'; -import { FormBuilder, Validators } from '@angular/forms'; +import { UntypedFormBuilder, Validators } from '@angular/forms'; import { PasswordResetInitService } from './password-reset-init.service'; @@ -34,7 +34,7 @@ export class PasswordResetInitComponent implements AfterViewInit { email: ['', [Validators.required, Validators.minLength(5), Validators.maxLength(254), Validators.email]] }); - constructor(private passwordResetInitService: PasswordResetInitService, private fb: FormBuilder) {} + constructor(private passwordResetInitService: PasswordResetInitService, private fb: UntypedFormBuilder) {} ngAfterViewInit(): void { if (this.email) { diff --git a/src/main/webapp/app/account/password/password.component.ts b/src/main/webapp/app/account/password/password.component.ts index 5ddc0f92..4552e2f4 100644 --- a/src/main/webapp/app/account/password/password.component.ts +++ b/src/main/webapp/app/account/password/password.component.ts @@ -17,7 +17,7 @@ * limitations under the License. */ import { Component, OnInit } from '@angular/core'; -import { FormBuilder, Validators } from '@angular/forms'; +import { UntypedFormBuilder, Validators } from '@angular/forms'; import { Observable } from 'rxjs'; import { AccountService } from 'app/core/auth/account.service'; @@ -39,7 +39,7 @@ export class PasswordComponent implements OnInit { confirmPassword: ['', [Validators.required, Validators.minLength(4), Validators.maxLength(50)]] }); - constructor(private passwordService: PasswordService, private accountService: AccountService, private fb: FormBuilder) {} + constructor(private passwordService: PasswordService, private accountService: AccountService, private fb: UntypedFormBuilder) {} ngOnInit(): void { this.account$ = this.accountService.identity(); diff --git a/src/main/webapp/app/account/register/register.component.ts b/src/main/webapp/app/account/register/register.component.ts index 19e75c2f..7820c40f 100644 --- a/src/main/webapp/app/account/register/register.component.ts +++ b/src/main/webapp/app/account/register/register.component.ts @@ -18,7 +18,7 @@ */ import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core'; import { HttpErrorResponse } from '@angular/common/http'; -import { FormBuilder, Validators } from '@angular/forms'; +import { UntypedFormBuilder, Validators } from '@angular/forms'; import { EMAIL_ALREADY_USED_TYPE, LOGIN_ALREADY_USED_TYPE } from 'app/shared/constants/error.constants'; import { LoginModalService } from 'app/core/login/login-modal.service'; @@ -49,7 +49,7 @@ export class RegisterComponent implements AfterViewInit { constructor( private loginModalService: LoginModalService, private registerService: RegisterService, - private fb: FormBuilder, + private fb: UntypedFormBuilder, private passwordResetService: PasswordResetService ) {} diff --git a/src/main/webapp/app/account/settings/settings.component.ts b/src/main/webapp/app/account/settings/settings.component.ts index bef0aabc..4d856602 100644 --- a/src/main/webapp/app/account/settings/settings.component.ts +++ b/src/main/webapp/app/account/settings/settings.component.ts @@ -17,7 +17,7 @@ * limitations under the License. */ import { Component, OnInit } from '@angular/core'; -import { FormBuilder, Validators } from '@angular/forms'; +import { UntypedFormBuilder, Validators } from '@angular/forms'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { AccountService } from 'app/core/auth/account.service'; import { Account } from 'app/core/user/account.model'; @@ -36,7 +36,7 @@ export class SettingsComponent implements OnInit { email: [undefined, [Validators.required, Validators.minLength(5), Validators.maxLength(254), Validators.email]] }); - constructor(private accountService: AccountService, private fb: FormBuilder, private modalService: NgbModal) {} + constructor(private accountService: AccountService, private fb: UntypedFormBuilder, private modalService: NgbModal) {} ngOnInit(): void { this.accountService.identity().subscribe(account => { diff --git a/src/main/webapp/app/admin/docs/docs.scss b/src/main/webapp/app/admin/docs/docs.scss index 541c3d79..bb9a6cc8 100644 --- a/src/main/webapp/app/admin/docs/docs.scss +++ b/src/main/webapp/app/admin/docs/docs.scss @@ -1,5 +1,5 @@ -@import '~bootstrap/scss/functions'; -@import '~bootstrap/scss/variables'; +@import 'bootstrap/scss/functions'; +@import 'bootstrap/scss/variables'; iframe { background: white; diff --git a/src/main/webapp/app/admin/user-management/user-management-delete-dialog.component.html b/src/main/webapp/app/admin/user-management/user-management-delete-dialog.component.html index d6f82135..4307e763 100644 --- a/src/main/webapp/app/admin/user-management/user-management-delete-dialog.component.html +++ b/src/main/webapp/app/admin/user-management/user-management-delete-dialog.component.html @@ -1,4 +1,4 @@ -
+