Skip to content

Commit

Permalink
deps: update polyfills.ts and .browserslistrc according to Angular 13…
Browse files Browse the repository at this point in the history
….0.2 defaults

- cleaned dependencies from no longer needed IE polyfills as Angular 13 no longer supports IE
- kept and added '@angular/localize/init' for tests as it is needed for ng-bootstrap

BREAKING CHANGE: Angular 13 removes support for IE 11 (see [Internet Explorer 11 support deprecation and removal](angular/angular#41840) for more details).
  • Loading branch information
shauke authored and Eisie96 committed Feb 1, 2022
1 parent 6f68e77 commit e18b0e3
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 68 deletions.
20 changes: 0 additions & 20 deletions .browserslistrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,9 @@
# You can see what browsers were selected by your queries by running:
# npx browserslist

# 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 9-10 # Angular support for IE 9-10 has been deprecated and will be removed as of Angular v11. To opt-in, remove the 'not' prefix on this line.
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.


## previous PWA configuration:
# > 0.5%
# last 2 versions
# Firefox ESR
# not dead
# IE 11
1 change: 1 addition & 0 deletions .vscode/intershop.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ unflatten
setuprequest
ruleset
rulesets
unpatched

foo
foos
Expand Down
6 changes: 4 additions & 2 deletions docs/concepts/localization.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ kb_sync_latest_only

# Localization

Intershop Progressive Web App uses a mix of Angular's internationalization tools (i18n) and the internationalization library ngx-translate for localization.
Intershop Progressive Web App uses the internationalization library ngx-translate for localization.
In addition the dependency to Angular's internationalization tools (i18n) is needed as a dependency for ng-bootstrap.

For more information refer to:

- [Angular - Internationalization (i18n)](https://angular.io/guide/i18n)
- [NGX-Translate: The internationalization (i18n) library for Angular](http://www.ngx-translate.com/)
- [Angular - Internationalization (i18n)](https://angular.io/guide/i18n)
- [ng-bootstrap Angular 9 support](https://github.com/ng-bootstrap/ng-bootstrap/issues/3537#issuecomment-586472803)

## Usage Examples

Expand Down
10 changes: 0 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
"angular2-uuid": "^1.1.1",
"angulartics2": "^12.0.0",
"bootstrap": "^4.6.1",
"core-js": "^3.19.2",
"express": "^4.17.2",
"express-http-proxy": "^1.6.3",
"express-robots-txt": "1.0.0",
Expand All @@ -98,7 +97,6 @@
"tslib": "^2.3.1",
"typeface-roboto": "1.1.13",
"typeface-roboto-condensed": "1.1.13",
"url-polyfill": "^1.1.12",
"xliff": "^6.0.0",
"zone.js": "~0.11.4"
},
Expand Down
39 changes: 5 additions & 34 deletions src/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Load `$localize` onto the global scope - used if i18n tags appear in Angular templates.
*/
import '@angular/localize/init';
// spell-checker: disable

/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
Expand All @@ -13,8 +13,8 @@ import '@angular/localize/init';
* 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.
* automatically update themselves. This includes recent versions of Safari, Chrome (including
* Opera), Edge on the desktop, and iOS and Chrome on mobile.
*
* Learn more in https://angular.io/guide/browser-support
*/
Expand All @@ -23,42 +23,14 @@ import '@angular/localize/init';
* BROWSER POLYFILLS
*/

/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es/symbol';
import 'core-js/es/object';
import 'core-js/es/function';
import 'core-js/es/parse-int';
import 'core-js/es/parse-float';
import 'core-js/es/number';
import 'core-js/es/math';
import 'core-js/es/string';
import 'core-js/es/date';
import 'core-js/es/array';
import 'core-js/es/regexp';
import 'core-js/es/map';
import 'core-js/es/weak-map';
import 'core-js/es/set';

import 'url-polyfill/url-polyfill.js';

/** 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';
* import './zone-flags';
*
* The flags allowed in zone-flags.ts are listed here.
*
Expand Down Expand Up @@ -87,8 +59,7 @@ import 'zone.js'; // Included with Angular CLI.
// MAGIC: https://stackoverflow.com/questions/50371593/angular-6-uncaught-referenceerror-buffer-is-not-defined
(window as any).global = window;

global.Buffer = global.Buffer || require('buffer').Buffer;

// version method for inspecting PWA version information
(global as any).version = () => ({
displayVersion: JSON.parse(document.querySelector('#intershop-pwa-state')?.textContent?.replace(/&q;/g, '"') || '{}')
.displayVersion,
Expand Down
1 change: 1 addition & 0 deletions src/setupJest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ require('jest-preset-angular/setup-jest');

import { CompilerOptions } from '@angular/core';
import { getTestBed } from '@angular/core/testing';
import '@angular/localize/init';
import * as matchers from 'jest-extended';

expect.extend(matchers);
Expand Down

0 comments on commit e18b0e3

Please sign in to comment.