Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update core-js in group stark-apps to the latest version 🚀 #1206

Merged
merged 4 commits into from
Apr 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docs/POLYFILLS.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ The following polyfills are suitable for most of the cases, especially when targ
* IE11 requires all of the following polyfills.
*
* Polyfill: https://github.com/zloirock/core-js
* Add the specific lines below corresponding to the version of core-js you want to use: 2.x or 3.x
*/
/* tslint:disable:no-import-side-effect */

/******************** core-js 2.x ********************/
import "core-js/es6";
import "core-js/es7/reflect";
import "core-js/es7/string";
Expand All @@ -51,6 +54,21 @@ import "core-js/stage/4";
* More info: https://github.com/angular/angular/issues/27887
*/
import "core-js/modules/web.dom.iterable";
/*****************************************************/

/******************** core-js 3.x ********************
* Make sure you add the 'paths' workaround to the tsconfig.json to support core-js 3.x with Angular CLI 7.x
* See: https://github.com/angular/angular-cli/issues/13954#issuecomment-475452588
*/
import "core-js/es";
import "core-js/proposals/reflect-metadata";
/**
* IE11 does not support iteration on certain DOM collections (NodeList).
* This polyfill is specifically needed for the animation on mat-menu used in stark-table.
* More info: https://github.com/angular/angular/issues/27887
*/
import "core-js/modules/web.dom-collections.iterator";
/*****************************************************/

/**
* IE11 and Edge require this to support Server-sent events
Expand Down
30 changes: 25 additions & 5 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"codelyzer": "^4.5.0",
"commitizen": "^3.0.5",
"conventional-changelog-cli": "^2.0.11",
"core-js": "^3.0.0",
"cz-customizable": "^6.0.0",
"hammerjs": "^2.0.8",
"husky": "^1.3.1",
Expand Down
5 changes: 2 additions & 3 deletions packages/stark-core/base.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"use strict";

import "core-js/es6";
import "core-js/es7/reflect";
import "core-js/stage/4";
import "core-js/es";
import "core-js/proposals/reflect-metadata";

/* tslint:disable:no-import-side-effect */
// FIXME: change when https://github.com/monounity/karma-typescript/issues/320 is resolved
Expand Down
6 changes: 4 additions & 2 deletions packages/stark-core/tsconfig-build.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
"@angular/common": ["../../node_modules/@angular/common"],
"@angular/core": ["../../node_modules/@angular/core"],
"@angular/router": ["../../node_modules/@angular/router"],
"rxjs/*": ["../../node_modules/rxjs/*"],
"@nationalbankbelgium/stark-core": ["."],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, @nationalbankbelgium/stark-<package>": ["."], was always the last mentioned path, is not it important so ? 😊

Copy link
Collaborator

@christophercr christophercr Apr 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically speaking, no... it is not important. What could be important is a path like this: "*" : ["some-path"] which indeed should be at the end because the TS compiler checks these paths sequentially from top to bottom, so the more generic paths should be at the end to prevent overlapping with the rest of paths.

But that is not the case here 😉

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okido. Thanks for the explanation 😊
In this case, could we change the order like this ?

"paths": {
      "@angular/common": ["../../node_modules/@angular/common"],
      "@angular/core": ["../../node_modules/@angular/core"],
      "@angular/router": ["../../node_modules/@angular/router"],
      "@nationalbankbelgium/stark-core": ["."],
      "core-js/*" : ["../../node_modules/core-js/*"],
      "environments/environment": ["./src/common/environment"],
      "rxjs/*": ["../../node_modules/rxjs/*"],
      "zone.js/*": ["../../node_modules/zone.js/*"]
    },

Otherwise I find this a bit weird if it's not sorted in alphabetical order. What do you think ? 😊

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, I forgot to sort it... I'll do it ;)

"core-js/*": ["../../node_modules/core-js/*"],
"environments/environment": ["./src/common/environment"],
"@nationalbankbelgium/stark-core": ["."]
"rxjs/*": ["../../node_modules/rxjs/*"],
"zone.js/*": ["../../node_modules/zone.js/*"]
},
"outDir": "../../dist/packages/stark-core"
},
Expand Down
6 changes: 2 additions & 4 deletions packages/stark-rbac/base.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"use strict";

import "core-js/es6";
import "core-js/es7/reflect";
import "core-js/es7/string";
import "core-js/stage/4";
import "core-js/es";
import "core-js/proposals/reflect-metadata";

// IE polyfills

Expand Down
12 changes: 7 additions & 5 deletions packages/stark-rbac/tsconfig-build.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@
"@angular/common": ["../../node_modules/@angular/common"],
"@angular/core": ["../../node_modules/@angular/core"],
"@angular/router": ["../../node_modules/@angular/router"],
"@nationalbankbelgium/stark-core": ["../../dist/packages/stark-core"],
"@nationalbankbelgium/stark-rbac": ["."],
"@ng-idle/*": ["../stark-core/node_modules/@ng-idle/*"],
"@ngrx/*": ["../stark-core/node_modules/@ngrx/*"],
"@ngx-translate/*": ["../stark-core/node_modules/@ngx-translate/*"],
"@uirouter/*": ["../stark-core/node_modules/@uirouter/*"],
"cerialize": ["../stark-core/node_modules/cerialize"],
"class-validator": ["../stark-core/node_modules/class-validator"],
"moment": ["../stark-core/node_modules/moment"],
"core-js/*": ["../../node_modules/core-js/*"],
"environments/environment": ["../../dist/packages/stark-core/src/common/environment"],
"ibantools": ["../stark-core/node_modules/ibantools"],
"lodash": ["../stark-core/node_modules/lodash"],
"lodash-es/*": ["../stark-core/node_modules/lodash-es/*"],
"moment": ["../stark-core/node_modules/moment"],
"rxjs/*": ["../../node_modules/rxjs/*"],
"environments/environment": ["../../dist/packages/stark-core/src/common/environment"],
"@nationalbankbelgium/stark-core": ["../../dist/packages/stark-core"],
"@nationalbankbelgium/stark-rbac": ["."]
"zone.js/*": ["../../node_modules/zone.js/*"]
},
"outDir": "../../dist/packages/stark-rbac"
},
Expand Down
6 changes: 2 additions & 4 deletions packages/stark-ui/base.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"use strict";

import "core-js/es6";
import "core-js/es7/reflect";
import "core-js/es7/string";
import "core-js/stage/4";
import "core-js/es";
import "core-js/proposals/reflect-metadata";

// IE polyfills

Expand Down
16 changes: 7 additions & 9 deletions packages/stark-ui/tsconfig-build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
"compilerOptions": {
"baseUrl": ".",
"rootDir": ".",
"typeRoots": [
"./node_modules/@types",
"../stark-build/typings",
"./typings"
],
"typeRoots": ["./node_modules/@types", "../stark-build/typings", "./typings"],
"lib": ["dom", "dom.iterable", "es2017"],
"paths": {
"@angularclass/hmr": ["../stark-core/node_modules/@angularclass/hmr"],
Expand All @@ -17,19 +13,21 @@
"@angular/core": ["../../node_modules/@angular/core"],
"@angular/material": ["../../node_modules/@angular/material"],
"@angular/router": ["../../node_modules/@angular/router"],
"@nationalbankbelgium/stark-core": ["../../dist/packages/stark-core"],
"@nationalbankbelgium/stark-ui": ["."],
"@ng-idle/*": ["../stark-core/node_modules/@ng-idle/*"],
"@ngrx/*": ["../stark-core/node_modules/@ngrx/*"],
"@ngx-translate/*": ["../stark-core/node_modules/@ngx-translate/*"],
"@uirouter/*": ["../stark-core/node_modules/@uirouter/*"],
"cerialize": ["../stark-core/node_modules/cerialize"],
"class-validator": ["../stark-core/node_modules/class-validator"],
"moment": ["../stark-core/node_modules/moment"],
"core-js/*": ["../../node_modules/core-js/*"],
"environments/environment": ["../../dist/packages/stark-core/src/common/environment"],
"ibantools": ["../stark-core/node_modules/ibantools"],
"lodash-es/*": ["../stark-core/node_modules/lodash-es/*"],
"moment": ["../stark-core/node_modules/moment"],
"rxjs/*": ["../../node_modules/rxjs/*"],
"environments/environment": ["../../dist/packages/stark-core/src/common/environment"],
"@nationalbankbelgium/stark-core": ["../../dist/packages/stark-core"],
"@nationalbankbelgium/stark-ui": ["."]
"zone.js/*": ["../../node_modules/zone.js/*"]
},
"outDir": "../../dist/packages/stark-ui"
},
Expand Down
6 changes: 2 additions & 4 deletions showcase/base.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"use strict";

import "core-js/es6";
import "core-js/es7/reflect";
import "core-js/es7/string";
import "core-js/stage/4";
import "core-js/es";
import "core-js/proposals/reflect-metadata";

// IE polyfills

Expand Down
30 changes: 27 additions & 3 deletions showcase/package-lock.json

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

2 changes: 1 addition & 1 deletion showcase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"@uirouter/visualizer": "~7.0.0",
"angular-in-memory-web-api": "~0.8.0",
"basscss": "~8.0.10",
"core-js": "~2.6.3",
"core-js": "~3.0.0",
"eligrey-classlist-js-polyfill": "~1.2.20180112",
"event-source-polyfill": "~1.0.5",
"http-server": "~0.11.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export const starkStylesCss = `
@import "~@nationalbankbelgium/stark-ui/src/modules/session-ui/pages/login/login-page.component";
@import "~@nationalbankbelgium/stark-ui/src/modules/session-ui/pages/preloading/preloading-page.component";
`;

export const polyfillsBrowsersContent = `
/**
* This file includes polyfills needed by Angular and is loaded before the app.
Expand All @@ -199,28 +200,56 @@ export const polyfillsBrowsersContent = `
*
* Learn more in https://angular.io/guide/browser-support
*/

/***************************************************************************************************
* BROWSER POLYFILLS
*
* See: https://angular.io/guide/browser-support#optional-browser-features-to-polyfill
*/

/**
* IE11 requires all of the following polyfills.
*
* Polyfill: https://github.com/zloirock/core-js
* Add the specific lines below corresponding to the version of core-js you want to use: 2.x or 3.x
*/
/* tslint:disable:no-import-side-effect */

/******************** core-js 2.x ********************/
import "core-js/es6";
import "core-js/es7/reflect";
import "core-js/es7/string";
import "core-js/stage/4";
/**
* IE11 does not support iteration on certain DOM collections (NodeList).
* This polyfill is specifically needed for the animation on mat-menu used in stark-table.
* More info: https://github.com/angular/angular/issues/27887
*/
import "core-js/modules/web.dom.iterable";
/*****************************************************/

/******************** core-js 3.x ********************
* Make sure you add the 'paths' workaround to the tsconfig.json to support core-js 3.x with Angular CLI 7.x
* See: https://github.com/angular/angular-cli/issues/13954#issuecomment-475452588
*/
import "core-js/es";
import "core-js/proposals/reflect-metadata";
/**
* IE11 does not support iteration on certain DOM collections (NodeList).
* This polyfill is specifically needed for the animation on mat-menu used in stark-table.
* More info: https://github.com/angular/angular/issues/27887
*/
import "core-js/modules/web.dom-collections.iterator";
/*****************************************************/

/**
* IE11 and Edge require this to support Server-sent events
* https://caniuse.com/#feat=eventsource
*
* Polyfill: https://github.com/Yaffle/EventSource
*/
import "event-source-polyfill";

/**
* IE11 requires Element.classList for NgClass support on SVG elements
* See: https://caniuse.com/#feat=classlist
Expand All @@ -230,6 +259,7 @@ import "event-source-polyfill";
* Polyfill: https://github.com/eligrey/classList.js
*/
import "eligrey-classlist-js-polyfill";

/**
* Web Animations polyfill is no longer needed for standard animation support as of Angular 6
* IMPORTANT: It is only needed in case you use the AnimationBuilder from '@angular/animations' in the application
Expand All @@ -239,6 +269,7 @@ import "eligrey-classlist-js-polyfill";
* Polyfill: https://github.com/web-animations/web-animations-js
*/
// import "web-animations-js";

/***************************************************************************************************
* Zone JS is required by Angular itself.
*/
Expand Down
Loading