-
-
Notifications
You must be signed in to change notification settings - Fork 180
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
Make brotli-size optional by styfle #220
base: master
Are you sure you want to change the base?
Conversation
Make brotli-size optional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff!
Eventually, we might even get brotli support in Node Core. |
@siddharthkp: I currently have downgraded bundlesize to 0.15. This should be squashed and merged ASAP. Node.js 10.0.0 is out for quite some time. |
@styfle Do you think the build should error out instead of passing if (Check out the result of the build) I have added you as a collaborator so you can commit directly to this branch (instead of a fork) |
@siddharthkp That's a good point since they specifically said they wanted to use brotli. Maybe the correct thing to do is fail fast and just throw instead of a warning:
Thoughts? |
I agree with you guys |
@siddharthkp Ok the build is failing as expected now that there is a throw. How should we fix the tests so that brotli-size is installed? Add to devDependencies? |
how about running it once and checking for failure and then running |
@eseliger That was my first thought but I don't see a test harness so I'm not sure how to assert that and error was thrown with the current test commands. |
hmm maybe some script like this will work
|
try { | ||
brotli = require('brotli-size') | ||
} catch (e) { | ||
throw new Error(`Missing optional dependency. Install it with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you should throw an error here. I would say, the travis build should pass because it only invokes bundlesize and the bundlesize build status should error out with the right message.
This should help: https://github.com/siddharthkp/bundlesize/blob/master/src/build.js#L32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand. Do you want to make the change on this branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, this branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think siddharthkp was saying that you can make bundlesize exit with non-zero, so travis doesn't fail, but report bundlesize failure status to GitHub
In an offshoot version of bundlesize, we've elected to fail the build
https://github.com/bundlewatch/bundlewatch/blob/master/src/app/getLocalFileDetails/getSize.js#L12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest the way to fail the bundlesize build would be the companion error method: https://github.com/siddharthkp/bundlesize/blob/master/src/build.js#L32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siddharthkp Would you like to implement this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind, it might take me some time to get to this though 😅
src/compressed-size.js
Outdated
@@ -1,5 +1,6 @@ | |||
const { warn } = require('prettycli') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a CI build error coming due to this line:
> eslint src store/*.js
/home/travis/build/siddharthkp/bundlesize/src/compressed-size.js
1:9 error 'warn' is assigned a value but never used no-unused-vars
✖ 1 problem (1 error, 0 warnings)
Please remove this line.
Hey, guys. Any news? I'm still using a downgraded version due to no node.js 10.x support. |
I think @siddharthkp still wanted to make a change here. Another related issue worth pursuing is to get brotli support in Node Core. |
@siddharthkp: friendly ping! |
Is the package abandoned @siddharthkp ? |
FYI, brotli support landed in Node core and should be in the next release. |
Description
brotli-size
fromdependencies
require('brotli-size')
brotli-size
Motivation and Context
It turns out the
brotli-size
(#194) is quite big and doesn't install very nicely on Windows.See the following issues:
Fixes #202
Fixes #213