From 635b5fb6ce43305e6e218f24170d8e37eeb25296 Mon Sep 17 00:00:00 2001 From: LE GARREC Vincent Date: Sun, 18 Dec 2022 22:49:56 +0100 Subject: [PATCH] Fix Angular 15 --- src/angular/angular.json | 12 ++-- .../src/app/ui/main/main.component.ts | 2 +- .../projects/app-main/src/polyfills.ts | 66 ------------------- .../projects/app-main/tsconfig.app.json | 2 +- .../projects/app-main/tsconfig.spec.json | 1 - src/angular/projects/jessica/src/test.ts | 31 --------- .../projects/jessica/tsconfig.lib.json | 2 +- .../projects/jessica/tsconfig.spec.json | 2 +- src/angular/projects/toolbox/src/test.ts | 31 --------- .../projects/toolbox/tsconfig.lib.json | 2 +- .../projects/toolbox/tsconfig.spec.json | 2 +- src/javascript/wasm/CMakeLists.txt | 2 +- 12 files changed, 13 insertions(+), 142 deletions(-) delete mode 100644 src/angular/projects/app-main/src/polyfills.ts delete mode 100644 src/angular/projects/jessica/src/test.ts delete mode 100644 src/angular/projects/toolbox/src/test.ts diff --git a/src/angular/angular.json b/src/angular/angular.json index f701509..ed7b096 100644 --- a/src/angular/angular.json +++ b/src/angular/angular.json @@ -27,7 +27,6 @@ "test": { "builder": "@angular-devkit/build-angular:karma", "options": { - "main": "projects/toolbox/src/test.ts", "tsConfig": "projects/toolbox/tsconfig.spec.json", "karmaConfig": "projects/toolbox/karma.conf.js" } @@ -58,7 +57,6 @@ "test": { "builder": "@angular-devkit/build-angular:karma", "options": { - "main": "projects/jessica/src/test.ts", "tsConfig": "projects/jessica/tsconfig.spec.json", "karmaConfig": "projects/jessica/karma.conf.js" } @@ -82,7 +80,7 @@ "outputPath": "projects/app-main/dist", "index": "projects/app-main/src/index.html", "main": "projects/app-main/src/main.ts", - "polyfills": "projects/app-main/src/polyfills.ts", + "polyfills": "zone.js", "tsConfig": "projects/app-main/tsconfig.app.json", "assets": [ "projects/app-main/src/favicon.ico", @@ -151,8 +149,7 @@ "test": { "builder": "@angular-devkit/build-angular:karma", "options": { - "main": "projects/app-main/src/test.ts", - "polyfills": "projects/app-main/src/polyfills.ts", + "polyfills": ["zone.js", "zone.js/testing"], "tsConfig": "projects/app-main/tsconfig.spec.json", "karmaConfig": "projects/app-main/karma.conf.js", "assets": [ @@ -166,5 +163,8 @@ } } }, - "defaultProject": "app-main" + "defaultProject": "app-main", + "cli": { + "analytics": "4153d04a-e76f-4106-aef5-5479d2538134" + } } diff --git a/src/angular/projects/app-main/src/app/ui/main/main.component.ts b/src/angular/projects/app-main/src/app/ui/main/main.component.ts index 8215876..4445b70 100644 --- a/src/angular/projects/app-main/src/app/ui/main/main.component.ts +++ b/src/angular/projects/app-main/src/app/ui/main/main.component.ts @@ -18,7 +18,7 @@ import { FormBuilder, FormGroup } from '@angular/forms'; styleUrls: ['./main.component.css'] }) export class MainComponent { - result!: MeyerhofResult; + result!: MeyerhofResult | undefined; form: FormGroup; private _lang?: string; diff --git a/src/angular/projects/app-main/src/polyfills.ts b/src/angular/projects/app-main/src/polyfills.ts deleted file mode 100644 index d6d8364..0000000 --- a/src/angular/projects/app-main/src/polyfills.ts +++ /dev/null @@ -1,66 +0,0 @@ -/** - * This file includes polyfills needed by Angular and is loaded before the app. - * You can add your own extra polyfills to this file. - * - * This file is divided into 2 sections: - * 1. Browser polyfills. These are applied before loading ZoneJS and are - * sorted by browsers. - * 2. Application imports. Files imported after ZoneJS that should be loaded - * before your main file. - * - * The current setup is for so-called "evergreen" browsers; the last versions - * of browsers that automatically update themselves. This includes - * Safari >= 10, Chrome >= 55 (including Opera), Edge >= 13 on the desktop, and - * iOS 10 and Chrome on mobile. - * - * Learn more in https://angular.io/guide/browser-support - */ - -/****************************************************************************** - * BROWSER POLYFILLS - */ - -/** - * Web Animations `@angular/platform-browser/animations` - * Only required if AnimationBuilder is used within the application and using - * IE/Edge or Safari. - * Standard animation support in Angular DOES NOT require any polyfills - * (as of Angular 6.0). - */ - -/** - * By default, zone.js will patch all possible macroTask and DomEvents - * user can disable parts of macroTask/DomEvents patch by setting following - * flags because those flags need to be set before `zone.js` being loaded, and - * webpack will put import in the top of bundle, so user need to create a - * separate file in this directory (for example: zone-flags.ts), and put the - * following flags into that file, and then add the following code before - * importing zone.js. - * import './zone-flags'; - * - * The flags allowed in zone-flags.ts are listed here. - * - * The following flags will work for all browsers. - * - * // disable patch requestAnimationFrame - * (window as any).__Zone_disable_requestAnimationFrame = true; - * // disable patch onProperty such as onclick - * (window as any).__Zone_disable_on_property = true; - * // disable patch specified eventNames - * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; - * - * in IE/Edge developer tools, the addEventListener will also be wrapped by - * zone.js with the following flag, it will bypass `zone.js` patch for IE/Edge - * - * (window as any).__Zone_enable_cross_context_check = true; - * - */ - -/****************************************************************************** - * Zone JS is required by default for Angular itself. - */ -import 'zone.js'; // Included with Angular CLI. - -/****************************************************************************** - * APPLICATION IMPORTS - */ diff --git a/src/angular/projects/app-main/tsconfig.app.json b/src/angular/projects/app-main/tsconfig.app.json index edbe4f1..9553d3c 100644 --- a/src/angular/projects/app-main/tsconfig.app.json +++ b/src/angular/projects/app-main/tsconfig.app.json @@ -16,7 +16,7 @@ "toolbox": ["./projects/toolbox/dist"] } }, - "files": ["src/main.ts", "src/polyfills.ts"], + "files": ["src/main.ts"], "include": [ "src/**/*.d.ts", "./projects/app-main/node_modules/@angular/common/locales/*.d.ts", diff --git a/src/angular/projects/app-main/tsconfig.spec.json b/src/angular/projects/app-main/tsconfig.spec.json index 429527d..ed0db26 100644 --- a/src/angular/projects/app-main/tsconfig.spec.json +++ b/src/angular/projects/app-main/tsconfig.spec.json @@ -15,6 +15,5 @@ "toolbox": ["./projects/toolbox/dist"] } }, - "files": ["src/test.ts", "src/polyfills.ts"], "include": ["src/**/*.spec.ts", "src/**/*.d.ts"] } diff --git a/src/angular/projects/jessica/src/test.ts b/src/angular/projects/jessica/src/test.ts deleted file mode 100644 index 68d8595..0000000 --- a/src/angular/projects/jessica/src/test.ts +++ /dev/null @@ -1,31 +0,0 @@ -// This file is required by karma.conf.js and -// loads recursively all the .spec and framework files - -import 'zone.js'; -import 'zone.js/testing'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -declare const require: { - context( - path: string, - deep?: boolean, - filter?: RegExp - ): { - keys(): string[]; - (id: string): T; - }; -}; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); diff --git a/src/angular/projects/jessica/tsconfig.lib.json b/src/angular/projects/jessica/tsconfig.lib.json index c19a1ec..701ee77 100644 --- a/src/angular/projects/jessica/tsconfig.lib.json +++ b/src/angular/projects/jessica/tsconfig.lib.json @@ -13,5 +13,5 @@ }, "esModuleInterop": true }, - "exclude": ["src/test.ts", "**/*.spec.ts"] + "exclude": ["**/*.spec.ts"] } diff --git a/src/angular/projects/jessica/tsconfig.spec.json b/src/angular/projects/jessica/tsconfig.spec.json index 6b06f98..49eb876 100644 --- a/src/angular/projects/jessica/tsconfig.spec.json +++ b/src/angular/projects/jessica/tsconfig.spec.json @@ -14,6 +14,6 @@ }, "esModuleInterop": true }, - "files": ["src/test.ts"], + "files": [], "include": ["**/*.spec.ts", "**/*.d.ts"] } diff --git a/src/angular/projects/toolbox/src/test.ts b/src/angular/projects/toolbox/src/test.ts deleted file mode 100644 index eb303e0..0000000 --- a/src/angular/projects/toolbox/src/test.ts +++ /dev/null @@ -1,31 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec -// and framework files - -import 'zone.js'; -import 'zone.js/testing'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -declare const require: { - context( - path: string, - deep?: boolean, - filter?: RegExp - ): { - keys(): string[]; - (id: string): T; - }; -}; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); diff --git a/src/angular/projects/toolbox/tsconfig.lib.json b/src/angular/projects/toolbox/tsconfig.lib.json index 52da276..b473888 100644 --- a/src/angular/projects/toolbox/tsconfig.lib.json +++ b/src/angular/projects/toolbox/tsconfig.lib.json @@ -8,5 +8,5 @@ "inlineSources": true, "types": [] }, - "exclude": ["src/test.ts", "**/*.spec.ts"] + "exclude": ["**/*.spec.ts"] } diff --git a/src/angular/projects/toolbox/tsconfig.spec.json b/src/angular/projects/toolbox/tsconfig.spec.json index aa5e650..5424fb8 100644 --- a/src/angular/projects/toolbox/tsconfig.spec.json +++ b/src/angular/projects/toolbox/tsconfig.spec.json @@ -12,6 +12,6 @@ ] } }, - "files": ["src/test.ts"], + "files": [], "include": ["**/*.spec.ts", "**/*.d.ts"] } diff --git a/src/javascript/wasm/CMakeLists.txt b/src/javascript/wasm/CMakeLists.txt index 93c7cac..6595f35 100644 --- a/src/javascript/wasm/CMakeLists.txt +++ b/src/javascript/wasm/CMakeLists.txt @@ -34,7 +34,7 @@ add_custom_target( sed -i "s#[\\'\\\"]jessica-web.wasm[\\'\\\"]#\\'assets/jessica-web.wasm\\'#g" "${CMAKE_CURRENT_BINARY_DIR}/jessica-web.js" - COMMAND sed -i "s#var jessica#export var jessica#g" + COMMAND sed -i "s#^var jessica#export var jessica#g" "${CMAKE_CURRENT_BINARY_DIR}/jessica-web.js" COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/jessica-web.*" "${CMAKE_SOURCE_DIR}/src/angular/projects/jessica/src/assets/")