Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Moved failed build logic from webpack into respective callers. #404

Merged
merged 8 commits into from
May 10, 2018

Conversation

Blackbaud-BobbyEarl
Copy link

@codecov-io
Copy link

codecov-io commented May 2, 2018

Codecov Report

Merging #404 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #404      +/-   ##
=========================================
- Coverage    99.3%   99.3%   -0.01%     
=========================================
  Files          73      73              
  Lines        1873    1869       -4     
  Branches      294     293       -1     
=========================================
- Hits         1860    1856       -4     
  Misses         13      13
Flag Coverage Δ
#builder 100% <100%> (ø) ⬆️
#runtime 95.42% <ø> (ø) ⬆️
#srcapp 100% <ø> (ø) ⬆️
Impacted Files Coverage Δ
...fig/webpack/build-public-library.webpack.config.js 100% <ø> (ø) ⬆️
config/webpack/test.webpack.config.js 100% <ø> (ø) ⬆️
config/webpack/common.webpack.config.js 100% <ø> (ø) ⬆️
cli/e2e.js 100% <100%> (ø) ⬆️
cli/build.js 100% <100%> (ø) ⬆️
cli/build-public-library.js 100% <100%> (ø) ⬆️
cli/utils/run-compiler.js 100% <100%> (ø) ⬆️
cli/utils/run-build.js 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b038bec...1fe8685. Read the comment docs.

cli/build.js Outdated
.catch(err => {

// Conditionally calling process.exit so it can bubble up if being called from e2e
if (!imported) {

Choose a reason for hiding this comment

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

@Blackbaud-BobbyEarl Most of the changes look great. I'm confused what "imported" means in this context?

Copy link
Author

@Blackbaud-BobbyEarl Blackbaud-BobbyEarl May 4, 2018

Choose a reason for hiding this comment

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

Valid question. I use that so that I could conditionally handle logging errors / calling process.exit.

When skyux build command is called that imported param is falsy. That's b/c we want the errors shown and, more importantly, the process to exit and return a non-zero exit code.

When running skyux e2e, that file will require('./build'), and pass in true for that parameter as seen at https://github.com/blackbaud/skyux-builder/pull/404/files#diff-27e8eb2b645e7d3144b02020922373aaR140. This allows the e2e command to not only log the errors, but most importantly, lets it's catch handler run. If not, the e2e wouldn't have an opportunity to perform cleanup when something in build fails.

Choose a reason for hiding this comment

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

That makes sense.

I'm curious if both build and e2e should consume the same "bundler", so that we wouldn't have to deal with yet another function argument that's specific only to e2e. The bundler could return a promise that's either resolved or rejected.

Would build's linting errors also get rejected properly during e2e?
https://github.com/blackbaud/skyux-builder/blob/master/cli/build.js#L179

Copy link
Author

Choose a reason for hiding this comment

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

I like that suggestion, and good catch about my current implementation not handling the linting errors. Let me see what I can work up. May do some work w/o updating the unit tests first.

Choose a reason for hiding this comment

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

Cool! No worries if it's a major refactor

@Blackbaud-BobbyEarl
Copy link
Author

Took some refactoring, but I liked your suggestion @Blackbaud-SteveBrush. This is ready for another look.

Copy link
Member

@Blackbaud-SteveBrush Blackbaud-SteveBrush left a comment

Choose a reason for hiding this comment

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

LGTM! (Tested locally as well)

@Blackbaud-BobbyEarl Blackbaud-BobbyEarl merged commit d3d8e68 into master May 10, 2018
@Blackbaud-BobbyEarl Blackbaud-BobbyEarl deleted the build-fail-e2e branch May 10, 2018 12:40
Blackbaud-MikitaYankouski pushed a commit to Blackbaud-MikitaYankouski/skyux-builder that referenced this pull request May 3, 2019
…baud#404)

* Moved failed build logic from webpack into respective callers (needed for e2e).

* Fixed linting error

* Fixed errors.  Making logs more quiet.

* Refactored build into run-build.  Having cli/build + cli/e2e call it.

* Fixed linting errors.

* Converting build stats to chunks for e2e
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants