From e7e49b25f21d424e959a6b3ca74a10e218479209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E8=89=B2?= Date: Mon, 2 Jan 2023 15:54:45 +0800 Subject: [PATCH] build: bump angualr to `15` (#118) --- .browserslistrc | 17 ------------ angular.json | 15 ++++++++--- lib/package.json | 2 +- lib/test.ts | 19 ------------- package.json | 62 +++++++++++++++++++++---------------------- src/app/app.module.ts | 2 +- src/polyfills.ts | 62 ------------------------------------------- tsconfig.app.json | 2 +- tsconfig.json | 5 ++-- tsconfig.spec.json | 2 +- 10 files changed, 50 insertions(+), 138 deletions(-) delete mode 100644 .browserslistrc delete mode 100644 src/polyfills.ts diff --git a/.browserslistrc b/.browserslistrc deleted file mode 100644 index 427441d..0000000 --- a/.browserslistrc +++ /dev/null @@ -1,17 +0,0 @@ -# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. -# For additional information regarding the format and rule options, please see: -# 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: -# npx browserslist - -last 1 Chrome version -last 1 Firefox version -last 2 Edge major versions -last 2 Safari major versions -last 2 iOS major versions -Firefox ESR -not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. diff --git a/angular.json b/angular.json index 82c11bc..2168837 100644 --- a/angular.json +++ b/angular.json @@ -23,7 +23,9 @@ "outputPath": "dist", "index": "src/index.html", "main": "src/main.ts", - "polyfills": "src/polyfills.ts", + "polyfills": [ + "zone.js" + ], "tsConfig": "tsconfig.app.json", "assets": [ "src/favicon.ico", @@ -82,9 +84,16 @@ "builder": "@angular-devkit/build-angular:karma", "options": { "main": "lib/test.ts", - "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.spec.json", - "karmaConfig": "karma.conf.js" + "karmaConfig": "karma.conf.js", + "polyfills": [ + "zone.js", + "zone.js/testing" + ], + "include": [ + "../lib/test.ts", + "../lib/**/*.spec.ts" + ] } }, "lint": { diff --git a/lib/package.json b/lib/package.json index d14c7b1..8cac089 100644 --- a/lib/package.json +++ b/lib/package.json @@ -1,6 +1,6 @@ { "name": "ngx-countdown", - "version": "14.0.0", + "version": "15.0.0", "description": "Simple, easy and performance countdown for angular", "keywords": [ "ngx-countdown", diff --git a/lib/test.ts b/lib/test.ts index 91a6f62..089ddda 100644 --- a/lib/test.ts +++ b/lib/test.ts @@ -1,23 +1,4 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -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/package.json b/package.json index e893558..9150bf1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ngx-countdown", - "version": "14.0.0", + "version": "15.0.0", "description": "Simple, easy and performance countdown for angular", "keywords": [ "ngx-countdown", @@ -30,42 +30,42 @@ "release": "npm run build && cd publish && npm publish --access public" }, "dependencies": { - "@angular/animations": "^14.0.0", - "@angular/common": "^14.0.0", - "@angular/compiler": "^14.0.0", - "@angular/core": "^14.0.0", - "@angular/forms": "^14.0.0", - "@angular/platform-browser": "^14.0.0", - "@angular/platform-browser-dynamic": "^14.0.0", - "@angular/router": "^14.0.0", + "@angular/animations": "^15.0.0", + "@angular/common": "^15.0.0", + "@angular/compiler": "^15.0.0", + "@angular/core": "^15.0.0", + "@angular/forms": "^15.0.0", + "@angular/platform-browser": "^15.0.0", + "@angular/platform-browser-dynamic": "^15.0.0", + "@angular/router": "^15.0.0", "rxjs": "~7.5.0", "tslib": "^2.3.0", - "zone.js": "~0.11.4", - "bootstrap": "^5.1.3", - "ngx-highlight-js": "^14.0.0", - "date-fns": "^2.28.0" + "zone.js": "~0.12.0", + "bootstrap": "^5.2.3", + "ngx-highlight-js": "^15.0.0", + "date-fns": "^2.29.0" }, "devDependencies": { - "@angular-devkit/build-angular": "^14.0.3", - "@angular/cli": "~14.0.3", - "@angular/compiler-cli": "^14.0.0", - "@types/jasmine": "~4.0.0", - "jasmine-core": "~4.1.0", - "karma": "~6.3.0", - "karma-chrome-launcher": "~3.1.1", + "@angular-devkit/build-angular": "^15.0.4", + "@angular/cli": "~15.0.4", + "@angular/compiler-cli": "^15.0.0", + "@types/jasmine": "~4.3.0", + "jasmine-core": "~4.5.0", + "karma": "~6.4.0", + "karma-chrome-launcher": "~3.1.0", "karma-coverage": "~2.2.0", "karma-jasmine": "~5.1.0", - "karma-jasmine-html-reporter": "~1.7.0", - "typescript": "~4.7.4", - "@angular-eslint/builder": "^14.0.0", - "@angular-eslint/eslint-plugin": "^14.0.0", - "@angular-eslint/eslint-plugin-template": "^14.0.0", - "@angular-eslint/schematics": "^14.0.0", - "@angular-eslint/template-parser": "^14.0.0", - "@typescript-eslint/eslint-plugin": "^5.29.0", - "@typescript-eslint/parser": "^5.29.0", + "karma-jasmine-html-reporter": "~2.0.0", + "typescript": "~4.8.2", + "@angular-eslint/builder": "^15.1.0", + "@angular-eslint/eslint-plugin": "^15.1.0", + "@angular-eslint/eslint-plugin-template": "^15.1.0", + "@angular-eslint/schematics": "^15.1.0", + "@angular-eslint/template-parser": "^15.1.0", + "@typescript-eslint/eslint-plugin": "^5.47.1", + "@typescript-eslint/parser": "^5.47.1", "codecov": "^3.8.3", - "eslint": "^8.18.0", - "ng-packagr": "^14.0.2" + "eslint": "^8.31.0", + "ng-packagr": "^15.0.3" } } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index f8bc62a..f20927f 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -56,7 +56,7 @@ export function countdownConfigFactory(): CountdownConfig { component: TestComponent, }, ], - { useHash: true, relativeLinkResolution: 'legacy' }, + { useHash: true }, ), CountdownModule, ], diff --git a/src/polyfills.ts b/src/polyfills.ts deleted file mode 100644 index 3eb385e..0000000 --- a/src/polyfills.ts +++ /dev/null @@ -1,62 +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 - */ - -/** IE10 and IE11 requires the following for NgClass support on SVG elements */ -// import 'classlist.js'; // Run `npm install --save classlist.js`. - -/** - * 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). - */ -// import 'web-animations-js'; // Run `npm install --save web-animations-js`. - -/** - * 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.ts'; - * - * The flags allowed in zone-flags.ts are listed here. - * - * The following flags will work for all browsers. - * - * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame - * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick - * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames - * - * 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/tsconfig.app.json b/tsconfig.app.json index ff396d4..84f1f99 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -5,6 +5,6 @@ "outDir": "./out-tsc/app", "types": [] }, - "files": ["src/main.ts", "src/polyfills.ts"], + "files": ["src/main.ts"], "include": ["src/**/*.d.ts"] } diff --git a/tsconfig.json b/tsconfig.json index 71742d5..dce1d5b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,7 +16,7 @@ "experimentalDecorators": true, "moduleResolution": "node", "importHelpers": true, - "target": "es2020", + "target": "ES2022", "module": "es2020", "lib": [ "es2020", @@ -24,7 +24,8 @@ ], "paths": { "ngx-countdown": ["lib/src/index"] - } + }, + "useDefineForClassFields": false }, "angularCompilerOptions": { "enableI18nLegacyMessageIdFormat": false, diff --git a/tsconfig.spec.json b/tsconfig.spec.json index 4d74445..a0bad79 100644 --- a/tsconfig.spec.json +++ b/tsconfig.spec.json @@ -5,6 +5,6 @@ "outDir": "./out-tsc/spec", "types": ["jasmine"] }, - "files": ["lib/test.ts", "src/polyfills.ts"], + "files": ["lib/test.ts"], "include": ["lib/**/*.spec.ts", "lib/**/*.d.ts"] }