87968: Upgrade to Angular 12

This commit is contained in:
Yura Bondarenko
2022-02-24 18:45:31 +01:00
parent 45887154b6
commit 22c5976095
14 changed files with 2869 additions and 5046 deletions

View File

@@ -2,10 +2,16 @@
# For additional information regarding the format and rule options, please see: # For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries # https://github.com/browserslist/browserslist#queries
# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support
# You can see what browsers were selected by your queries by running: # You can see what browsers were selected by your queries by running:
# npx browserslist # npx browserslist
> 0.5% last 1 Chrome version
last 2 versions last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR Firefox ESR
not IE 9-11 # For IE 9-11 support, remove 'not'. not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

View File

@@ -17,7 +17,6 @@
"build": { "build": {
"builder": "@angular-builders/custom-webpack:browser", "builder": "@angular-builders/custom-webpack:browser",
"options": { "options": {
"extractCss": true,
"preserveSymlinks": true, "preserveSymlinks": true,
"customWebpackConfig": { "customWebpackConfig": {
"path": "./webpack/webpack.browser.ts", "path": "./webpack/webpack.browser.ts",
@@ -76,7 +75,6 @@
], ],
"optimization": true, "optimization": true,
"outputHashing": "all", "outputHashing": "all",
"extractCss": true,
"namedChunks": false, "namedChunks": false,
"aot": true, "aot": true,
"extractLicenses": true, "extractLicenses": true,
@@ -261,4 +259,4 @@
"cli": { "cli": {
"analytics": false "analytics": false
} }
} }

View File

@@ -50,25 +50,25 @@
"webdriver-manager": "^12.1.8" "webdriver-manager": "^12.1.8"
}, },
"dependencies": { "dependencies": {
"@angular/animations": "~11.2.14", "@angular/animations": "~12.2.16",
"@angular/cdk": "^11.2.13", "@angular/cdk": "^12.2.13",
"@angular/common": "~11.2.14", "@angular/common": "~12.2.16",
"@angular/compiler": "~11.2.14", "@angular/compiler": "~12.2.16",
"@angular/core": "~11.2.14", "@angular/core": "~12.2.16",
"@angular/forms": "~11.2.14", "@angular/forms": "~12.2.16",
"@angular/localize": "11.2.14", "@angular/localize": "12.2.16",
"@angular/platform-browser": "~11.2.14", "@angular/platform-browser": "~12.2.16",
"@angular/platform-browser-dynamic": "~11.2.14", "@angular/platform-browser-dynamic": "~12.2.16",
"@angular/platform-server": "~11.2.14", "@angular/platform-server": "~12.2.16",
"@angular/router": "~11.2.14", "@angular/router": "~12.2.16",
"@kolkov/ngx-gallery": "^1.2.3", "@kolkov/ngx-gallery": "1.2.3",
"@ng-bootstrap/ng-bootstrap": "9.1.3", "@ng-bootstrap/ng-bootstrap": "9.1.3",
"@ng-dynamic-forms/core": "^13.0.0", "@ng-dynamic-forms/core": "^13.0.0",
"@ng-dynamic-forms/ui-ng-bootstrap": "^13.0.0", "@ng-dynamic-forms/ui-ng-bootstrap": "^13.0.0",
"@ngrx/effects": "^11.1.1", "@ngrx/effects": "^12.5.1",
"@ngrx/router-store": "^11.1.1", "@ngrx/router-store": "^12.5.1",
"@ngrx/store": "^11.1.1", "@ngrx/store": "^12.5.1",
"@nguniversal/express-engine": "11.2.1", "@nguniversal/express-engine": "^12.1.3",
"@ngx-translate/core": "^13.0.0", "@ngx-translate/core": "^13.0.0",
"@nicky-lenaers/ngx-scroll-to": "^9.0.0", "@nicky-lenaers/ngx-scroll-to": "^9.0.0",
"angular-idle-preload": "3.0.0", "angular-idle-preload": "3.0.0",
@@ -102,7 +102,7 @@
"mirador-share-plugin": "^0.11.0", "mirador-share-plugin": "^0.11.0",
"moment": "^2.29.1", "moment": "^2.29.1",
"morgan": "^1.10.0", "morgan": "^1.10.0",
"ng-mocks": "11.11.2", "ng-mocks": "^12.5.1",
"ng2-file-upload": "1.4.0", "ng2-file-upload": "1.4.0",
"ng2-nouislider": "^1.8.3", "ng2-nouislider": "^1.8.3",
"ngx-infinite-scroll": "^10.0.1", "ngx-infinite-scroll": "^10.0.1",
@@ -111,7 +111,7 @@
"ngx-sortablejs": "^11.1.0", "ngx-sortablejs": "^11.1.0",
"nouislider": "^14.6.3", "nouislider": "^14.6.3",
"pem": "1.14.4", "pem": "1.14.4",
"postcss-cli": "^8.3.0", "postcss-cli": "^9.1.0",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"rxjs": "^6.6.3", "rxjs": "^6.6.3",
"sortablejs": "1.13.0", "sortablejs": "1.13.0",
@@ -119,19 +119,19 @@
"url-parse": "^1.5.6", "url-parse": "^1.5.6",
"uuid": "^8.3.2", "uuid": "^8.3.2",
"webfontloader": "1.6.28", "webfontloader": "1.6.28",
"zone.js": "^0.10.3" "zone.js": "~0.11.4"
}, },
"devDependencies": { "devDependencies": {
"@angular-builders/custom-webpack": "10.0.1", "@angular-builders/custom-webpack": "~12.1.3",
"@angular-devkit/build-angular": "~0.1102.15", "@angular-devkit/build-angular": "~12.2.16",
"@angular/cli": "~11.2.15", "@angular/cli": "~12.2.16",
"@angular/compiler-cli": "~11.2.14", "@angular/compiler-cli": "~12.2.16",
"@angular/language-service": "~11.2.14", "@angular/language-service": "~12.2.16",
"@cypress/schematic": "^1.5.0", "@cypress/schematic": "^1.5.0",
"@fortawesome/fontawesome-free": "^5.5.0", "@fortawesome/fontawesome-free": "^5.5.0",
"@ngrx/store-devtools": "^11.1.1", "@ngrx/store-devtools": "^12.5.1",
"@ngtools/webpack": "10.2.3", "@ngtools/webpack": "~12.2.16",
"@nguniversal/builders": "~11.2.1", "@nguniversal/builders": "^12.1.3",
"@types/deep-freeze": "0.1.2", "@types/deep-freeze": "0.1.2",
"@types/express": "^4.17.9", "@types/express": "^4.17.9",
"@types/file-saver": "^2.0.1", "@types/file-saver": "^2.0.1",
@@ -145,8 +145,9 @@
"compression-webpack-plugin": "^3.0.1", "compression-webpack-plugin": "^3.0.1",
"copy-webpack-plugin": "^6.4.1", "copy-webpack-plugin": "^6.4.1",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"css-loader": "3.4.0", "css-loader": "^6.2.0",
"cssnano": "^4.1.10", "css-minimizer-webpack-plugin": "^3.4.1",
"cssnano": "^5.0.6",
"cypress": "9.5.1", "cypress": "9.5.1",
"cypress-axe": "^0.13.0", "cypress-axe": "^0.13.0",
"debug-loader": "^0.0.1", "debug-loader": "^0.0.1",
@@ -154,8 +155,8 @@
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"fork-ts-checker-webpack-plugin": "^6.0.3", "fork-ts-checker-webpack-plugin": "^6.0.3",
"html-loader": "^1.3.2", "html-loader": "^1.3.2",
"html-webpack-plugin": "^4.5.0", "html-webpack-plugin": "^5.5.0",
"jasmine-core": "~3.6.0", "jasmine-core": "^3.8.0",
"jasmine-marbles": "0.6.0", "jasmine-marbles": "0.6.0",
"jasmine-spec-reporter": "~5.0.0", "jasmine-spec-reporter": "~5.0.0",
"karma": "^6.3.14", "karma": "^6.3.14",
@@ -164,12 +165,12 @@
"karma-jasmine": "~4.0.0", "karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0", "karma-jasmine-html-reporter": "^1.5.0",
"karma-mocha-reporter": "2.2.5", "karma-mocha-reporter": "2.2.5",
"ngx-mask": "^12.0.0",
"nodemon": "^2.0.15", "nodemon": "^2.0.15",
"optimize-css-assets-webpack-plugin": "^5.0.4", "postcss": "^8.1",
"postcss-apply": "0.11.0", "postcss-apply": "0.12.0",
"postcss-import": "^12.0.1", "postcss-import": "^14.0.0",
"postcss-loader": "^3.0.0", "postcss-loader": "^4.0.3",
"postcss-preset-env": "6.7.0",
"postcss-responsive-type": "1.0.0", "postcss-responsive-type": "1.0.0",
"protractor": "^7.0.0", "protractor": "^7.0.0",
"protractor-istanbul-plugin": "2.0.0", "protractor-istanbul-plugin": "2.0.0",
@@ -178,15 +179,16 @@
"react-dom": "^16.14.0", "react-dom": "^16.14.0",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"rxjs-spy": "^7.5.3", "rxjs-spy": "^7.5.3",
"sass": "~1.32.6",
"sass-resources-loader": "^2.1.1", "sass-resources-loader": "^2.1.1",
"script-ext-html-webpack-plugin": "2.1.5", "script-ext-html-webpack-plugin": "2.1.5",
"string-replace-loader": "^2.3.0", "string-replace-loader": "^3.1.0",
"terser-webpack-plugin": "^2.3.1", "terser-webpack-plugin": "^2.3.1",
"ts-loader": "^5.2.0", "ts-loader": "^5.2.0",
"ts-node": "^8.10.2", "ts-node": "^8.10.2",
"tslint": "^6.1.3", "tslint": "^6.1.3",
"typescript": "~4.0.5", "typescript": "~4.3.5",
"webpack": "^4.44.2", "webpack": "^5.69.1",
"webpack-bundle-analyzer": "^4.4.0", "webpack-bundle-analyzer": "^4.4.0",
"webpack-cli": "^4.2.0", "webpack-cli": "^4.2.0",
"webpack-dev-server": "^4.5.0" "webpack-dev-server": "^4.5.0"

View File

@@ -15,7 +15,7 @@
* import for `ngExpressEngine`. * import for `ngExpressEngine`.
*/ */
import 'zone.js/dist/zone-node'; import 'zone.js/node';
import 'reflect-metadata'; import 'reflect-metadata';
import 'rxjs'; import 'rxjs';

View File

@@ -1,4 +1,4 @@
import 'zone.js/dist/zone'; import 'zone.js';
import 'reflect-metadata'; import 'reflect-metadata';
import 'core-js/es/reflect'; import 'core-js/es/reflect';
@@ -35,11 +35,9 @@ const main = () => {
if (hasValue(environment.universal) && environment.universal.preboot) { if (hasValue(environment.universal) && environment.universal.preboot) {
return bootstrap(); return bootstrap();
} else { } else {
return fetch('assets/config.json') return fetch('assets/config.json')
.then((response) => response.json()) .then((response) => response.json())
.then((appConfig: AppConfig) => { .then((appConfig: AppConfig) => {
// extend environment with app config for browser when not prerendered // extend environment with app config for browser when not prerendered
extendEnvironmentWithAppConfig(environment, appConfig); extendEnvironmentWithAppConfig(environment, appConfig);

View File

@@ -1,5 +1,5 @@
import 'core-js/es/reflect'; import 'core-js/es/reflect';
import 'zone.js/dist/zone'; import 'zone.js';
import 'reflect-metadata'; import 'reflect-metadata';
import { enableProdMode } from '@angular/core'; import { enableProdMode } from '@angular/core';

View File

@@ -59,8 +59,8 @@ export function createTranslateLoader() {
deps: [] deps: []
} }
}), }),
AppModule,
ServerModule, ServerModule,
AppModule
], ],
providers: [ providers: [
// Initialize app config and extend environment // Initialize app config and extend environment

View File

@@ -59,7 +59,7 @@
import 'core-js/es'; import 'core-js/es';
import 'core-js/features/reflect'; import 'core-js/features/reflect';
import 'zone.js/dist/zone'; // Included with Angular CLI. import 'zone.js'; // Included with Angular CLI.
import 'reflect-metadata'; import 'reflect-metadata';

View File

@@ -1,6 +1,6 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files // This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone-testing'; import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing'; import { getTestBed } from '@angular/core/testing';
import { import {
BrowserDynamicTestingModule, BrowserDynamicTestingModule,

1
src/typings.d.ts vendored
View File

@@ -39,7 +39,6 @@ interface SystemJS {
// Extra variables that live on Global that will be replaced by webpack DefinePlugin // Extra variables that live on Global that will be replaced by webpack DefinePlugin
declare var ENV: string; declare var ENV: string;
declare var HMR: boolean; declare var HMR: boolean;
declare var Zone: { current: any };
interface GlobalEnvironment { interface GlobalEnvironment {
ENV; ENV;
HMR; HMR;

View File

@@ -5,9 +5,6 @@ import { commonExports } from './webpack.common';
module.exports = Object.assign({}, commonExports, { module.exports = Object.assign({}, commonExports, {
target: 'web', target: 'web',
node: {
module: 'empty'
},
devServer: { devServer: {
before(app, server) { before(app, server) {
buildAppConfig(join(process.cwd(), 'src/assets/config.json')); buildAppConfig(join(process.cwd(), 'src/assets/config.json'));

View File

@@ -4,6 +4,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path'); const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
const ScriptExtPlugin = require('script-ext-html-webpack-plugin'); const ScriptExtPlugin = require('script-ext-html-webpack-plugin');
const sass = require('sass');
export const copyWebpackOptions = { export const copyWebpackOptions = {
patterns: [ patterns: [
@@ -40,16 +41,21 @@ export const copyWebpackOptions = {
] ]
}; };
const SCSS_LOADERS = [{ const SCSS_LOADERS = [
loader: 'postcss-loader', {
options: { loader: 'postcss-loader',
sourceMap: true options: {
} sourceMap: true
}, }
},
{ {
loader: 'sass-loader', loader: 'sass-loader',
options: { options: {
sourceMap: true, sourceMap: true,
// sass >1.33 complains about deprecation warnings in Bootstrap 4
// After upgrading to Angular 12 we need to explicitly use an older version here
// todo: remove after upgrading to Bootstrap 5
implementation: sass,
sassOptions: { sassOptions: {
includePaths: [projectRoot('./')] includePaths: [projectRoot('./')]
} }
@@ -99,5 +105,5 @@ export const commonExports = {
] ]
}, },
], ],
} },
}; };

View File

@@ -2,7 +2,4 @@ import { commonExports } from './webpack.common';
module.exports = Object.assign({}, commonExports, { module.exports = Object.assign({}, commonExports, {
target: 'web', target: 'web',
node: {
module: 'empty'
}
}); });

7778
yarn.lock

File diff suppressed because it is too large Load Diff