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

feat(core): integrated bootstrap #486

Merged

Conversation

dsebastien
Copy link
Contributor

Closes #112 #412

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[x] Build related changes
[ ] CI related changes
[x] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: #112 and #412

What is the new behavior?

Bootstrap supported and HMR integrated in stark-core

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@dsebastien dsebastien added this to the 10.0.0-alpha.4 milestone Jul 6, 2018
@coveralls
Copy link

coveralls commented Jul 6, 2018

Coverage Status

Coverage decreased (-0.9%) to 94.604% when pulling 97ca29e on dsebastien:feature/bootstrap2 into 0dfd69d on NationalBankBelgium:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.8%) to 94.604% when pulling b2ef7b2 on dsebastien:feature/bootstrap2 into c8c5112 on NationalBankBelgium:master.

*/
public abstract main: () => Promise<any>;

public mainWrapper = (): void => {
Copy link
Member

@SuperITMan SuperITMan Jul 6, 2018

Choose a reason for hiding this comment

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

You use different ways to define methods in this file, I think we should keep only one.
Could we have

public mainWrapper(): void { ... }

instead of

public mainWrapper = (): void => { ... }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed to a lambda to capture "this", otherwise all calls to this would fail because they're made through a callback

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But I have in mind that there was another way to do it, just can't remember it though :p

/**
* Initialize by configuring HMR if it is enabled or normally instead.
*/
protected initialize = (): void => {
Copy link
Member

Choose a reason for hiding this comment

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

same here about the definition of the method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same reply

* Reference: https://github.com/gdi2290/angular-hmr
* @ignore
*/
protected bootstrapHmr: Function = (module: any, bootstrap: () => Promise<NgModuleRef<any>>) => {
Copy link
Member

Choose a reason for hiding this comment

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

same here about the definition of the method

* @ignore
*/
protected bootstrapHmr: Function = (module: any, bootstrap: () => Promise<NgModuleRef<any>>) => {
if(ENV === "development") {
Copy link
Member

Choose a reason for hiding this comment

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

This is already checked at line 51. Maybe could we remove this check ? 😊

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Depends on how intelligent Webpack is for dead code removal. I didn't check the generated code though, I've added the check in the function just be be sure that the code would be dropped in production builds

Copy link
Collaborator

@christophercr christophercr Jul 6, 2018

Choose a reason for hiding this comment

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

Indeed, as @dsebastien said, this is needed so that webpack can remove the code inside this function.

The other check (in line 51) makes sure that this function will not be called, but yet the function will still be there and so code that calls the angularclass/hmr module. Therefore the check here is important so webpack can remove the call to angularclass/hmr and also the import ;)

* Adapt the configuration based on the current environment
* @param moduleRef - NgModule instance created by Angular for a given platform.
*/
public decorateModule = (moduleRef: NgModuleRef<any>): NgModuleRef<any> => {
Copy link
Member

Choose a reason for hiding this comment

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

same here about the definition of the method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

core: bootstrap
4 participants