Skip to content
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

Migrate to Angular 16 #56

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
1 change: 0 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@
}
}
},
"defaultProject": "budget",
"schematics": {
"@schematics/angular:component": {
"prefix": "",
Expand Down
45,509 changes: 14,962 additions & 30,547 deletions package-lock.json

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,39 +25,39 @@
},
"private": true,
"dependencies": {
"@angular/cli": "^13.2.4",
"@angular/compiler-cli": "^13.2.3",
"@angular-devkit/core": "^13.2.4",
"@angular/animations": "^13.2.3",
"@angular/cdk": "^13.2.3",
"@angular/common": "^13.2.3",
"@angular/compiler": "^13.2.3",
"@angular/core": "^13.2.3",
"@angular/forms": "^13.2.3",
"@angular/material": "^13.2.3",
"@angular/platform-browser": "^13.2.3",
"@angular/platform-browser-dynamic": "^13.2.3",
"@angular/router": "^13.2.3",
"@angular/cli": "^16.0.0",
"@angular/compiler-cli": "^16.0.0",
"@angular-devkit/core": "^16.0.0",
"@angular/animations": "^16.0.0",
"@angular/cdk": "^16.0.0",
"@angular/common": "^16.0.0",
"@angular/compiler": "^16.0.0",
"@angular/core": "^16.0.0",
"@angular/forms": "^16.0.0",
"@angular/material": "^16.0.0",
"@angular/platform-browser": "^16.0.0",
"@angular/platform-browser-dynamic": "^16.0.0",
"@angular/router": "^16.0.0",
"@briebug/jest-schematic": "^4.0.0",
"angular-in-memory-web-api": "^0.13.0",
"angular-in-memory-web-api": "^0.15.0",
"core-js": "^3.19.0",
"express": "^4.17.3",
"jest-preset-angular": "^11.1.1",
"ng-qrcode": "^6.0.0",
"ng-qrcode": "^16.0.0",
"path": "^0.12.7",
"rxjs": "^6.6.7",
"webpack-bundle-analyzer": "^4.0.0",
"zone.js": "~0.11.4"
"zone.js": "~0.13.0"
},
"devDependencies": {
"@angular-builders/jest": "latest",
"@angular-devkit/build-angular": "^13.2.4",
"@angular-eslint/builder": "13.1.0",
"@angular-eslint/eslint-plugin": "13.1.0",
"@angular-eslint/eslint-plugin-template": "13.1.0",
"@angular-eslint/schematics": "13.1.0",
"@angular-eslint/template-parser": "13.1.0",
"@angular/language-service": "^13.2.3",
"@angular-devkit/build-angular": "^16.0.0",
"@angular-eslint/builder": "16.0.0",
"@angular-eslint/eslint-plugin": "16.0.0",
"@angular-eslint/eslint-plugin-template": "16.0.0",
"@angular-eslint/schematics": "16.0.0",
"@angular-eslint/template-parser": "16.0.0",
"@angular/language-service": "^16.0.0",
"@pact-foundation/pact": "^9.16.5",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "^2.0.10",
Expand All @@ -73,7 +73,7 @@
"eslint-plugin-prettier": "^4.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"jest": "^27.3.1",
"jest": "^29.5.0",
"json-server": "^0.17.0",
"karma-cli": "~2.0.0",
"lint-staged": "^12.3.4",
Expand All @@ -89,7 +89,7 @@
"stylelint-scss": "^4.1.0",
"ts-node": "~8.6.2",
"tslint": "^6.1.3",
"typescript": "^4.5.5"
"typescript": "^5.0.4"
},
"lint-staged": {
"*.{js,ts}": [
Expand Down
2 changes: 1 addition & 1 deletion src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const routes: Routes = [
];

@NgModule({
imports: [RouterModule.forRoot(routes, { relativeLinkResolution: "legacy" })],
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
})
export class AppRoutingModule {}
6 changes: 3 additions & 3 deletions src/app/auth/containers/login/login.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from "@angular/core";
import { FormGroup, FormBuilder, Validators } from "@angular/forms";
import { UntypedFormGroup, UntypedFormBuilder, Validators } from "@angular/forms";
import { Router, ActivatedRoute } from "@angular/router";
import { MatSnackBar } from "@angular/material/snack-bar";
import { MatDialog } from "@angular/material/dialog";
Expand All @@ -19,14 +19,14 @@ import { HttpErrorResponse } from "@angular/common/http";
styleUrls: ["./../auth.scss"],
})
export class LoginComponent implements OnInit {
loginForm: FormGroup;
loginForm: UntypedFormGroup;
githubLogin = "Login with GitHub";
googleLogin = "Login with Google";

constructor(
private authService: AuthService,
private oauthService: OAuthService,
private formBuilder: FormBuilder,
private formBuilder: UntypedFormBuilder,
private snackBar: MatSnackBar,
private dialog: MatDialog,
private route: ActivatedRoute,
Expand Down
6 changes: 3 additions & 3 deletions src/app/auth/containers/password/password.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
import { FormGroup, FormBuilder, Validators } from "@angular/forms";
import { UntypedFormGroup, UntypedFormBuilder, Validators } from "@angular/forms";
import { PasswordService } from "../../services/password.service";
import { Observable } from "rxjs";

Expand All @@ -12,14 +12,14 @@ import { Observable } from "rxjs";
export class PasswordComponent implements OnInit {
public isFinished: boolean;
public email: string;
public passwordForm: FormGroup;
public passwordForm: UntypedFormGroup;
public recovery: boolean;
public task: string;
private code: string;

constructor(
private activeRoute: ActivatedRoute,
private formBuilder: FormBuilder,
private formBuilder: UntypedFormBuilder,
private passwordService: PasswordService
) {}

Expand Down
6 changes: 3 additions & 3 deletions src/app/auth/containers/recover/recover.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from "@angular/core";
import { FormGroup, FormBuilder, Validators } from "@angular/forms";
import { UntypedFormGroup, UntypedFormBuilder, Validators } from "@angular/forms";
import { PasswordService } from "../../services/password.service";

@Component({
Expand All @@ -9,10 +9,10 @@ import { PasswordService } from "../../services/password.service";
})
export class RecoverComponent implements OnInit {
isRequestSent: boolean;
public recoveryForm: FormGroup;
public recoveryForm: UntypedFormGroup;

constructor(
private formBuilder: FormBuilder,
private formBuilder: UntypedFormBuilder,
private passwordService: PasswordService
) {}

Expand Down
6 changes: 3 additions & 3 deletions src/app/auth/containers/signup/signup.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from "@angular/core";
import { FormGroup, FormBuilder, Validators } from "@angular/forms";
import { UntypedFormGroup, UntypedFormBuilder, Validators } from "@angular/forms";
import { Router } from "@angular/router";
import { AuthService } from "../../services/auth.service";

Expand All @@ -9,13 +9,13 @@ import { AuthService } from "../../services/auth.service";
styleUrls: ["./../auth.scss"],
})
export class SignupComponent implements OnInit {
signupForm: FormGroup;
signupForm: UntypedFormGroup;
githubSignup = "Signup with GitHub";
googleSignup = "Signup with Google";

constructor(
private authService: AuthService,
private formBuilder: FormBuilder,
private formBuilder: UntypedFormBuilder,
private router: Router
) {}

Expand Down
4 changes: 2 additions & 2 deletions src/app/auth/guards/app.guard.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Injectable } from "@angular/core";
import { Observable } from "rxjs";
import { tap } from "rxjs/operators";
import { CanActivate, CanLoad, Router } from "@angular/router";
import { Router } from "@angular/router";
import { AuthService } from "../services/auth.service";

@Injectable({
providedIn: "root",
})
export class AppGuard implements CanActivate, CanLoad {
export class AppGuard {
constructor(private authService: AuthService, private router: Router) {}

canActivate(): Observable<boolean> {
Expand Down
4 changes: 2 additions & 2 deletions src/app/auth/guards/auth.guard.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Injectable } from "@angular/core";
import { CanActivate, Router } from "@angular/router";
import { Router } from "@angular/router";
import { Observable } from "rxjs";
import { map, tap } from "rxjs/operators";
import { AuthService } from "../services/auth.service";

@Injectable({
providedIn: "root",
})
export class AuthGuard implements CanActivate {
export class AuthGuard {
constructor(private authService: AuthService, private router: Router) {}

canActivate(): Observable<boolean> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, Inject, ViewEncapsulation, OnInit } from "@angular/core";
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material/dialog";
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { UntypedFormBuilder, UntypedFormGroup, Validators } from "@angular/forms";
import { Observable } from "rxjs";

import { Expense } from "@models/expense";
Expand All @@ -21,15 +21,15 @@ export type SubmitExpenseCallback = (expense: Expense) => Observable<void>;
encapsulation: ViewEncapsulation.None,
})
export class ExpenseDialogComponent implements OnInit {
expenseForm: FormGroup;
expenseForm: UntypedFormGroup;
expense: Expense;
newCategory = new ExpenseCategory();
categories: ExpenseCategory[] = [];
submitText: string;
inProgress: boolean;

constructor(
private fb: FormBuilder,
private fb: UntypedFormBuilder,
public dialogRef: MatDialogRef<ExpenseDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: ExpenseDialogData
) {}
Expand Down
19 changes: 9 additions & 10 deletions src/app/expenses/expenses.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ import { ExpensesTableComponent } from "./components/expenses-table/expenses-tab
import { ConfirmDeleteComponent } from "./components/confirm-delete/confirm-delete.component";
import { ExpenseDialogComponent } from "./components/expense-dialog/expense-dialog-component";

@NgModule({
imports: [SharedModule, ReactiveFormsModule, ExpensesRoutingModule],
declarations: [
ExpensesComponent,
ExpensesTableComponent,
ConfirmDeleteComponent,
ExpenseDialogComponent,
],
entryComponents: [ExpenseDialogComponent, ConfirmDeleteComponent],
providers: [ExpensesService, ExpenseApi],
@NgModule({
imports: [SharedModule, ReactiveFormsModule, ExpensesRoutingModule],
declarations: [
ExpensesComponent,
ExpensesTableComponent,
ConfirmDeleteComponent,
ExpenseDialogComponent,
],
providers: [ExpensesService, ExpenseApi]
})
export class ExpensesModule {}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, Inject, ViewEncapsulation, OnInit } from "@angular/core";
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material/dialog";
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { UntypedFormBuilder, UntypedFormGroup, Validators } from "@angular/forms";
import { User } from "@models/user";
import { Role } from "@models/types";

Expand All @@ -13,12 +13,12 @@ import { Role } from "@models/types";
export class UserDialogComponent implements OnInit {
user: User;
roles: Role[];
userForm: FormGroup;
userForm: UntypedFormGroup;
inProgress: boolean;
submitText: string;

constructor(
private fb: FormBuilder,
private fb: UntypedFormBuilder,
public dialogRef: MatDialogRef<UserDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) {}
Expand Down
29 changes: 14 additions & 15 deletions src/app/settings/categories/categories.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,19 @@ import { CategoriesFacade } from "./categories.facade";
import { CategoriesState } from "./categories.state";
import { EditingGuard } from "./guards/editing.guard";

@NgModule({
imports: [SharedModule, CategoriesRoutingModule, ReactiveFormsModule],
declarations: [
CategoriesComponent,
CategoryFormComponent,
CategoryListComponent,
EditingDialogComponent,
],
providers: [
ExpenseCategoryResolver,
CategoriesFacade,
CategoriesState,
EditingGuard,
],
entryComponents: [EditingDialogComponent],
@NgModule({
imports: [SharedModule, CategoriesRoutingModule, ReactiveFormsModule],
declarations: [
CategoriesComponent,
CategoryFormComponent,
CategoryListComponent,
EditingDialogComponent,
],
providers: [
ExpenseCategoryResolver,
CategoriesFacade,
CategoriesState,
EditingGuard,
]
})
export class CategoriesModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import {
EventEmitter,
} from "@angular/core";
import {
FormBuilder,
UntypedFormBuilder,
Validators,
FormGroup,
FormArray,
FormControl,
UntypedFormGroup,
UntypedFormArray,
UntypedFormControl,
} from "@angular/forms";

import { ExpenseCategory } from "@models/expenseCategory";
Expand All @@ -27,9 +27,9 @@ export class CategoryFormComponent implements OnInit {
@Input() category: ExpenseCategory;
@Output() categoryAdded: EventEmitter<ExpenseCategory> = new EventEmitter();
@Output() categoryUpdated: EventEmitter<ExpenseCategory> = new EventEmitter();
categoryForm: FormGroup;
categoryForm: UntypedFormGroup;

constructor(private fb: FormBuilder) {}
constructor(private fb: UntypedFormBuilder) {}

ngOnInit() {
const patternsInitial = this.category.counterpartyPatterns.map((pattern) =>
Expand Down Expand Up @@ -61,11 +61,11 @@ export class CategoryFormComponent implements OnInit {
this.categoryForm.markAsPristine();
}

get patterns(): FormArray {
return this.categoryForm.get("counterpartyPatterns") as FormArray;
get patterns(): UntypedFormArray {
return this.categoryForm.get("counterpartyPatterns") as UntypedFormArray;
}

private createPatternInput(value: string) {
return new FormControl(value, [Validators.required]);
return new UntypedFormControl(value, [Validators.required]);
}
}
4 changes: 2 additions & 2 deletions src/app/settings/categories/guards/editing.guard.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Injectable } from "@angular/core";
import { CanDeactivate } from "@angular/router";

import { MatDialog } from "@angular/material/dialog";
import { Observable, of } from "rxjs";

import { CategoriesComponent } from "../container/categories.component";
import { EditingDialogComponent } from "../components/editing-dialog/editing-dialog.component";

@Injectable()
export class EditingGuard implements CanDeactivate<CategoriesComponent> {
export class EditingGuard {
constructor(private dialog: MatDialog) {}

canDeactivate(categoriesComponent: CategoriesComponent): Observable<boolean> {
Expand Down
Loading