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

Fix early exit when enableBuild is true #61

Merged
merged 5 commits into from
Jul 31, 2021
Merged

Fix early exit when enableBuild is true #61

merged 5 commits into from
Jul 31, 2021

Conversation

fgblomqvist
Copy link
Contributor

Fixes #60.

@codecov-commenter
Copy link

codecov-commenter commented Jul 28, 2021

Codecov Report

Merging #61 (323076f) into main (1403f6f) will increase coverage by 4.37%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #61      +/-   ##
==========================================
+ Coverage   30.03%   34.41%   +4.37%     
==========================================
  Files          13       13              
  Lines         576      587      +11     
  Branches      118      114       -4     
==========================================
+ Hits          173      202      +29     
+ Misses        403      384      -19     
- Partials        0        1       +1     
Impacted Files Coverage Δ
packages/vite-plugin-checker/src/main.ts 67.27% <66.66%> (+1.81%) ⬆️
packages/vite-plugin-checker/src/Checker.ts 89.28% <0.00%> (ø)
...es/vite-plugin-checker/src/checkers/eslint/main.ts 0.00% <0.00%> (ø)
packages/vite-plugin-checker/src/logger.ts 45.94% <0.00%> (+25.59%) ⬆️

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 1403f6f...323076f. Read the comment docs.

@fgblomqvist
Copy link
Contributor Author

fgblomqvist commented Jul 28, 2021

It's better to throw an error instead of silently killing the process. This is what it would look like with this MR:

vite v2.3.8 building for production...
✓ 0 modules transformed.
[vite-plugin-checker] one of the checkers failed with exit code 1
error during build:
Error: one of the checkers failed with exit code 1
    at Object.buildStart (/app/node_modules/vite-plugin-checker/lib/main.js:74:19)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

process.exit(exitCode)
}
)
const exitCodes = await Promise.all(checkers.map((checker) => spawnChecker(checker, userConfig, localEnv)));
Copy link
Owner

Choose a reason for hiding this comment

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

if we await here. The checker and the rollup build will run sequentially. Is it better to run parallelly? 🤔

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 what the purpose of running the checker on build is? I can see both being valid perhaps? Even if you wanted to run it in parallel, you could still utilize async/await (just spawn a new async function at the end). But yeah, I guess the current behavior should perhaps remain for now.

Copy link
Owner

Choose a reason for hiding this comment

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

Maybe we can add an option in the future to set whether run check sequentially. We can keep the parallel behaviour for now. 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good. I can make the changes to this branch tomorrow, unless you want to make them yourself sooner than that, up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good. I can make the changes to this branch tomorrow, unless you want to make them yourself sooner than that, up to you.

Copy link
Owner

Choose a reason for hiding this comment

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

CI failed at build step 👀

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, thanks for the write-up! Very odd that the build is failing though, it's not even on a line that I touched 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oooh it was because of a missing semicolon. I can strongly recommend you to add some stricter linting to this project. Semi-colons should be mandatory on all the lines 😅

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'd suggest you to take a look at https://www.npmjs.com/package/eslint-config-airbnb-base. But either way, this MR should be good now.

Copy link
Owner

@fi3ework fi3ework Jul 31, 2021

Choose a reason for hiding this comment

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

Yeah, this PR can be merged now. I'll do some more work and then release a version. (still haven't use semantic-release now 😅)

It's because in this line

      })

      // spawn an async runner that we don't wait for in order to avoid blocking the build from continuing in parallel
      (async () => {

There should be a semicolon before (async because it's a new line that starts with ). Non-semi is also acceptable (such as Vite). I'll do some style clean in the following commits and release a new version.

Thanks for your PR! 🤗

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.

enableBuild causes no files to be outputted
3 participants