Feature/upgrade to angular 14 (#1019)

* Upgrade to angular 14

* Migrate UntypedFormControl to FormControl

* Update changelog
pull/1020/head
Thomas Kaul 2 years ago committed by GitHub
parent 0b06823893
commit 002b883668
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Changed
- Upgraded `angular` from version `13.3.6` to `14.0.2`
- Upgraded `Nx` from version `14.1.4` to `14.3.5`
- Upgraded `storybook` from version `6.4.22` to `6.5.9`
## 1.160.0 - 15.06.2022 ## 1.160.0 - 15.06.2022
### Fixed ### Fixed

@ -2,6 +2,7 @@
"version": 1, "version": 1,
"projects": { "projects": {
"api": { "api": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"root": "apps/api", "root": "apps/api",
"sourceRoot": "apps/api/src", "sourceRoot": "apps/api/src",
"projectType": "application", "projectType": "application",
@ -56,6 +57,7 @@
"tags": [] "tags": []
}, },
"client": { "client": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application", "projectType": "application",
"schematics": { "schematics": {
"@schematics/angular:component": { "@schematics/angular:component": {
@ -189,6 +191,7 @@
"tags": [] "tags": []
}, },
"client-e2e": { "client-e2e": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"root": "apps/client-e2e", "root": "apps/client-e2e",
"sourceRoot": "apps/client-e2e/src", "sourceRoot": "apps/client-e2e/src",
"projectType": "application", "projectType": "application",
@ -211,6 +214,7 @@
"implicitDependencies": ["client"] "implicitDependencies": ["client"]
}, },
"common": { "common": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"root": "libs/common", "root": "libs/common",
"sourceRoot": "libs/common/src", "sourceRoot": "libs/common/src",
"projectType": "library", "projectType": "library",
@ -233,6 +237,7 @@
"tags": [] "tags": []
}, },
"ui": { "ui": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library", "projectType": "library",
"schematics": { "schematics": {
"@schematics/angular:component": { "@schematics/angular:component": {
@ -258,14 +263,12 @@
} }
}, },
"storybook": { "storybook": {
"builder": "@nrwl/storybook:storybook", "builder": "@storybook/angular:start-storybook",
"options": { "options": {
"uiFramework": "@storybook/angular",
"port": 4400, "port": 4400,
"config": { "configDir": "libs/ui/.storybook",
"configFolder": "libs/ui/.storybook" "browserTarget": "ui:build-storybook",
}, "compodoc": false
"projectBuildConfig": "ui:build-storybook"
}, },
"configurations": { "configurations": {
"ci": { "ci": {
@ -274,15 +277,13 @@
} }
}, },
"build-storybook": { "build-storybook": {
"builder": "@nrwl/storybook:build", "builder": "@storybook/angular:build-storybook",
"outputs": ["{options.outputPath}"], "outputs": ["{options.outputPath}"],
"options": { "options": {
"uiFramework": "@storybook/angular", "outputDir": "dist/storybook/ui",
"outputPath": "dist/storybook/ui", "configDir": "libs/ui/.storybook",
"config": { "browserTarget": "ui:build-storybook",
"configFolder": "libs/ui/.storybook" "compodoc": false
},
"projectBuildConfig": "ui:build-storybook"
}, },
"configurations": { "configurations": {
"ci": { "ci": {
@ -294,6 +295,7 @@
"tags": [] "tags": []
}, },
"ui-e2e": { "ui-e2e": {
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"root": "apps/ui-e2e", "root": "apps/ui-e2e",
"sourceRoot": "apps/ui-e2e/src", "sourceRoot": "apps/ui-e2e/src",
"projectType": "application", "projectType": "application",

@ -1,4 +1,4 @@
module.exports = { export default {
displayName: 'api', displayName: 'api',
globals: { globals: {
@ -13,5 +13,5 @@ module.exports = {
coverageDirectory: '../../coverage/apps/api', coverageDirectory: '../../coverage/apps/api',
testTimeout: 10000, testTimeout: 10000,
testEnvironment: 'node', testEnvironment: 'node',
preset: '../../jest.preset.ts' preset: '../../jest.preset.js'
}; };

@ -1,4 +1,4 @@
module.exports = { export default {
displayName: 'client', displayName: 'client',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'], setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
@ -18,5 +18,5 @@ module.exports = {
'^.+.(ts|mjs|js|html)$': 'jest-preset-angular' '^.+.(ts|mjs|js|html)$': 'jest-preset-angular'
}, },
transformIgnorePatterns: ['node_modules/(?!.*.mjs$)'], transformIgnorePatterns: ['node_modules/(?!.*.mjs$)'],
preset: '../../jest.preset.ts' preset: '../../jest.preset.js'
}; };

@ -23,7 +23,7 @@ export class ToggleComponent implements OnChanges, OnInit {
@Output() change = new EventEmitter<Pick<ToggleOption, 'value'>>(); @Output() change = new EventEmitter<Pick<ToggleOption, 'value'>>();
public option = new FormControl(); public option = new FormControl<string>(undefined);
public constructor() {} public constructor() {}

@ -16,5 +16,8 @@
"angularCompilerOptions": { "angularCompilerOptions": {
"strictInjectionParameters": true, "strictInjectionParameters": true,
"strictTemplates": false "strictTemplates": false
},
"compilerOptions": {
"target": "es2020"
} }
} }

@ -1,3 +1,3 @@
const { getJestProjects } = require('@nrwl/jest'); const { getJestProjects } = require('@nrwl/jest');
module.exports = { projects: getJestProjects() }; export default { projects: getJestProjects() };

@ -0,0 +1,3 @@
const nxPreset = require('@nrwl/jest/preset').default;
module.exports = { ...nxPreset };

@ -1,3 +0,0 @@
const nxPreset = require('@nrwl/jest/preset');
module.exports = { ...nxPreset };

@ -1,4 +1,4 @@
module.exports = { export default {
displayName: 'common', displayName: 'common',
globals: { globals: {
@ -9,5 +9,5 @@ module.exports = {
}, },
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/libs/common', coverageDirectory: '../../coverage/libs/common',
preset: '../../jest.preset.ts' preset: '../../jest.preset.js'
}; };

@ -1,4 +1,4 @@
module.exports = { export default {
displayName: 'ui', displayName: 'ui',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'], setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
@ -18,5 +18,5 @@ module.exports = {
'jest-preset-angular/build/serializers/ng-snapshot', 'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment' 'jest-preset-angular/build/serializers/html-comment'
], ],
preset: '../../jest.preset.ts' preset: '../../jest.preset.js'
}; };

@ -41,7 +41,7 @@ export class ActivitiesFilterComponent implements OnChanges, OnDestroy {
public filterGroups$: Subject<FilterGroup[]> = new BehaviorSubject([]); public filterGroups$: Subject<FilterGroup[]> = new BehaviorSubject([]);
public filters$: Subject<Filter[]> = new BehaviorSubject([]); public filters$: Subject<Filter[]> = new BehaviorSubject([]);
public filters: Observable<Filter[]> = this.filters$.asObservable(); public filters: Observable<Filter[]> = this.filters$.asObservable();
public searchControl = new FormControl(); public searchControl = new FormControl<Filter | string>(undefined);
public selectedFilters: Filter[] = []; public selectedFilters: Filter[] = [];
public separatorKeysCodes: number[] = [ENTER, COMMA]; public separatorKeysCodes: number[] = [ENTER, COMMA];
@ -50,7 +50,7 @@ export class ActivitiesFilterComponent implements OnChanges, OnDestroy {
public constructor() { public constructor() {
this.searchControl.valueChanges this.searchControl.valueChanges
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe((filterOrSearchTerm: Filter | string) => { .subscribe((filterOrSearchTerm) => {
if (filterOrSearchTerm) { if (filterOrSearchTerm) {
const searchTerm = const searchTerm =
typeof filterOrSearchTerm === 'string' typeof filterOrSearchTerm === 'string'
@ -80,7 +80,7 @@ export class ActivitiesFilterComponent implements OnChanges, OnDestroy {
input.value = ''; input.value = '';
} }
this.searchControl.setValue(null); this.searchControl.setValue(undefined);
} }
public onRemoveFilter(aFilter: Filter): void { public onRemoveFilter(aFilter: Filter): void {
@ -99,7 +99,7 @@ export class ActivitiesFilterComponent implements OnChanges, OnDestroy {
); );
this.updateFilters(); this.updateFilters();
this.searchInput.nativeElement.value = ''; this.searchInput.nativeElement.value = '';
this.searchControl.setValue(null); this.searchControl.setValue(undefined);
} }
public ngOnDestroy() { public ngOnDestroy() {

@ -8,7 +8,6 @@ import {
Output, Output,
ViewChild ViewChild
} from '@angular/core'; } from '@angular/core';
import { FormControl } from '@angular/forms';
import { MatSort } from '@angular/material/sort'; import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table'; import { MatTableDataSource } from '@angular/material/table';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
@ -62,7 +61,6 @@ export class ActivitiesTableComponent implements OnChanges, OnDestroy {
public isUUID = isUUID; public isUUID = isUUID;
public placeholder = ''; public placeholder = '';
public routeQueryParams: Subscription; public routeQueryParams: Subscription;
public searchControl = new FormControl();
public searchKeywords: string[] = []; public searchKeywords: string[] = [];
public totalFees: number; public totalFees: number;
public totalValue: number; public totalValue: number;

@ -4,7 +4,7 @@ import { MatButtonModule } from '@angular/material/button';
import { MatFormFieldModule } from '@angular/material/form-field'; import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input'; import { MatInputModule } from '@angular/material/input';
import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { baseCurrency, locale } from '@ghostfolio/common/config'; import { locale } from '@ghostfolio/common/config';
import { Meta, Story, moduleMetadata } from '@storybook/angular'; import { Meta, Story, moduleMetadata } from '@storybook/angular';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
@ -42,7 +42,7 @@ const Template: Story<FireCalculatorComponent> = (
export const Simple = Template.bind({}); export const Simple = Template.bind({});
Simple.args = { Simple.args = {
currency: baseCurrency, currency: 'USD',
fireWealth: 0, fireWealth: 0,
locale: locale locale: locale
}; };

@ -51,10 +51,10 @@ export class FireCalculatorComponent
@ViewChild('chartCanvas') chartCanvas; @ViewChild('chartCanvas') chartCanvas;
public calculatorForm = this.formBuilder.group({ public calculatorForm = this.formBuilder.group({
annualInterestRate: new FormControl(), annualInterestRate: new FormControl<number>(undefined),
paymentPerPeriod: new FormControl(), paymentPerPeriod: new FormControl<number>(undefined),
principalInvestmentAmount: new FormControl(), principalInvestmentAmount: new FormControl<number>(undefined),
time: new FormControl() time: new FormControl<number>(undefined)
}); });
public chart: Chart; public chart: Chart;
public isLoading = true; public isLoading = true;
@ -261,15 +261,13 @@ export class FireCalculatorComponent
this.calculatorForm.get('principalInvestmentAmount').value || 0; this.calculatorForm.get('principalInvestmentAmount').value || 0;
// Payment per period // Payment per period
const PMT: number = parseFloat( const PMT = this.calculatorForm.get('paymentPerPeriod').value;
this.calculatorForm.get('paymentPerPeriod').value
);
// Annual interest rate // Annual interest rate
const r: number = this.calculatorForm.get('annualInterestRate').value / 100; const r: number = this.calculatorForm.get('annualInterestRate').value / 100;
// Time // Time
const t: number = parseFloat(this.calculatorForm.get('time').value); const t = this.calculatorForm.get('time').value;
for (let year = currentYear; year < currentYear + t; year++) { for (let year = currentYear; year < currentYear + t; year++) {
labels.push(year); labels.push(year);

@ -17,7 +17,8 @@
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"strict": false, "strict": false,
"noImplicitReturns": true, "noImplicitReturns": true,
"noFallthroughCasesInSwitch": true "noFallthroughCasesInSwitch": true,
"target": "es2020"
}, },
"angularCompilerOptions": { "angularCompilerOptions": {
"strictInjectionParameters": true, "strictInjectionParameters": true,

@ -29,17 +29,6 @@
} }
} }
}, },
"targetDependencies": {
"build": [
{
"target": "build",
"projects": "dependencies"
}
]
},
"cli": {
"defaultCollection": "@nrwl/nest"
},
"defaultProject": "api", "defaultProject": "api",
"generators": { "generators": {
"@nrwl/angular:application": { "@nrwl/angular:application": {
@ -53,5 +42,11 @@
}, },
"@nrwl/nest": {}, "@nrwl/nest": {},
"@nrwl/angular:component": {} "@nrwl/angular:component": {}
},
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"targetDefaults": {
"build": {
"dependsOn": ["^build"]
}
} }
} }

@ -34,7 +34,7 @@
"lint": "nx workspace-lint && ng lint", "lint": "nx workspace-lint && ng lint",
"ng": "nx", "ng": "nx",
"nx": "nx", "nx": "nx",
"postinstall": "prisma generate && ngcc --properties es2015 browser module main", "postinstall": "prisma generate && ngcc --properties es2020 browser module main",
"replace-placeholders-in-build": "node ./replace.build.js", "replace-placeholders-in-build": "node ./replace.build.js",
"start": "node dist/apps/api/main", "start": "node dist/apps/api/main",
"start:client": "ng serve client --hmr -o", "start:client": "ng serve client --hmr -o",
@ -50,16 +50,16 @@
"workspace-generator": "nx workspace-generator" "workspace-generator": "nx workspace-generator"
}, },
"dependencies": { "dependencies": {
"@angular/animations": "13.3.6", "@angular/animations": "14.0.2",
"@angular/cdk": "13.3.6", "@angular/cdk": "14.0.1",
"@angular/common": "13.3.6", "@angular/common": "14.0.2",
"@angular/compiler": "13.3.6", "@angular/compiler": "14.0.2",
"@angular/core": "13.3.6", "@angular/core": "14.0.2",
"@angular/forms": "13.3.6", "@angular/forms": "14.0.2",
"@angular/material": "13.3.6", "@angular/material": "14.0.1",
"@angular/platform-browser": "13.3.6", "@angular/platform-browser": "14.0.2",
"@angular/platform-browser-dynamic": "13.3.6", "@angular/platform-browser-dynamic": "14.0.2",
"@angular/router": "13.3.6", "@angular/router": "14.0.2",
"@codewithdan/observable-store": "2.2.11", "@codewithdan/observable-store": "2.2.11",
"@dinero.js/currencies": "2.0.0-alpha.8", "@dinero.js/currencies": "2.0.0-alpha.8",
"@nestjs/bull": "0.5.5", "@nestjs/bull": "0.5.5",
@ -71,7 +71,7 @@
"@nestjs/platform-express": "8.2.3", "@nestjs/platform-express": "8.2.3",
"@nestjs/schedule": "1.0.2", "@nestjs/schedule": "1.0.2",
"@nestjs/serve-static": "2.2.2", "@nestjs/serve-static": "2.2.2",
"@nrwl/angular": "14.1.4", "@nrwl/angular": "14.3.5",
"@prisma/client": "3.14.0", "@prisma/client": "3.14.0",
"@simplewebauthn/browser": "5.2.1", "@simplewebauthn/browser": "5.2.1",
"@simplewebauthn/server": "5.2.1", "@simplewebauthn/server": "5.2.1",
@ -119,31 +119,31 @@
"zone.js": "0.11.4" "zone.js": "0.11.4"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "13.3.5", "@angular-devkit/build-angular": "14.0.2",
"@angular-eslint/eslint-plugin": "13.0.1", "@angular-eslint/eslint-plugin": "13.2.1",
"@angular-eslint/eslint-plugin-template": "13.0.1", "@angular-eslint/eslint-plugin-template": "13.2.1",
"@angular-eslint/template-parser": "13.0.1", "@angular-eslint/template-parser": "13.2.1",
"@angular/cli": "13.3.5", "@angular/cli": "~14.0.0",
"@angular/compiler-cli": "13.3.6", "@angular/compiler-cli": "14.0.2",
"@angular/language-service": "13.3.6", "@angular/language-service": "14.0.2",
"@angular/localize": "13.3.6", "@angular/localize": "14.0.2",
"@nestjs/schematics": "8.0.5", "@nestjs/schematics": "8.0.5",
"@nestjs/testing": "8.2.3", "@nestjs/testing": "8.2.3",
"@nrwl/cli": "14.1.4", "@nrwl/cli": "14.3.5",
"@nrwl/cypress": "14.1.4", "@nrwl/cypress": "14.3.5",
"@nrwl/eslint-plugin-nx": "14.1.4", "@nrwl/eslint-plugin-nx": "14.3.5",
"@nrwl/jest": "14.1.4", "@nrwl/jest": "14.3.5",
"@nrwl/nest": "14.1.4", "@nrwl/nest": "14.3.5",
"@nrwl/node": "14.1.4", "@nrwl/node": "14.3.5",
"@nrwl/nx-cloud": "14.0.3", "@nrwl/nx-cloud": "14.1.1",
"@nrwl/storybook": "14.1.4", "@nrwl/storybook": "14.3.5",
"@nrwl/workspace": "14.1.4", "@nrwl/workspace": "14.3.5",
"@simplewebauthn/typescript-types": "5.2.1", "@simplewebauthn/typescript-types": "5.2.1",
"@storybook/addon-essentials": "6.4.22", "@storybook/addon-essentials": "6.5.9",
"@storybook/angular": "6.4.22", "@storybook/angular": "6.5.9",
"@storybook/builder-webpack5": "6.4.22", "@storybook/builder-webpack5": "6.5.9",
"@storybook/core-server": "6.4.22", "@storybook/core-server": "6.5.9",
"@storybook/manager-webpack5": "6.4.22", "@storybook/manager-webpack5": "6.5.9",
"@types/big.js": "6.1.2", "@types/big.js": "6.1.2",
"@types/bull": "3.15.8", "@types/bull": "3.15.8",
"@types/cache-manager": "3.4.2", "@types/cache-manager": "3.4.2",
@ -166,15 +166,15 @@
"import-sort-parser-typescript": "6.0.0", "import-sort-parser-typescript": "6.0.0",
"import-sort-style-module": "6.0.0", "import-sort-style-module": "6.0.0",
"jest": "27.5.1", "jest": "27.5.1",
"jest-preset-angular": "11.1.1", "jest-preset-angular": "11.1.2",
"nx": "14.1.4", "nx": "14.3.5",
"prettier": "2.5.1", "prettier": "2.7.1",
"replace-in-file": "6.2.0", "replace-in-file": "6.2.0",
"rimraf": "3.0.2", "rimraf": "3.0.2",
"tslib": "2.0.0", "tslib": "2.0.0",
"ts-jest": "27.1.4", "ts-jest": "27.1.4",
"ts-node": "9.1.1", "ts-node": "10.8.1",
"typescript": "4.6.4" "typescript": "4.7.3"
}, },
"engines": { "engines": {
"node": ">=14" "node": ">=14"

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save