Skip to content

Support Configurable Settings File #212

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

Closed
wants to merge 6 commits into from
Closed

Support Configurable Settings File #212

wants to merge 6 commits into from

Conversation

ssulivan11
Copy link

@ssulivan11 ssulivan11 commented Apr 11, 2018

Description

When --config is passed in cli and there is a valid bundlesize.json file present in the project, then the bundlesize settings will be pulled from this file, and not from package.json

Motivation and Context

In a project with a lot of code chunks that are all validated with this bundlesize checker tool, it bloats the package.json. Wanted an external config to bring all that into a common area. Didnt expand too much into things like yaml file or anything overly complex, just a good place to start for the people who need smaller package.json files 😄

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

@ssulivan11 ssulivan11 changed the title Support Configurable Support Configurable Settings File Apr 11, 2018
@ssulivan11 ssulivan11 changed the title Support Configurable Settings File WIP: Support Configurable Settings File Apr 12, 2018
@ssulivan11
Copy link
Author

  • Changing config from boolean to a path for the desired config file
  • Also adding some tests for this

@debugme
Copy link

debugme commented Apr 12, 2018

This is long overdue. Thank you for taking the time to try and address it.

@ssulivan11 ssulivan11 changed the title WIP: Support Configurable Settings File Support Configurable Settings File Apr 12, 2018
@@ -0,0 +1,8 @@
{
"bundlesize": [
Copy link

@alexparish alexparish Apr 12, 2018

Choose a reason for hiding this comment

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

Do you need to nest the options in a bundlesize property? I thought it would be assumed that all options in this file would relate to the bundlesize library.

eg. this .jestconfig file is not nested: https://github.com/yangshun/commitbait/blob/master/.jestconfig

Choose a reason for hiding this comment

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

Just spotted it's an array. May be tricky then.

Copy link
Author

Choose a reason for hiding this comment

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

Yea I questioned that as well. Thought you could maybe build on this in the future and maybe do things like define your compression in here. Or add other setting values above that, while keeping the bundlesize an array of objects for your checks.

Copy link
Contributor

Choose a reason for hiding this comment

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

As @ssulivan11 mentioned. Naming this files would be good to allow other configuration options in the future here too

Copy link
Author

Choose a reason for hiding this comment

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

@siddharthkp what is your opinion on this one?

Copy link
Owner

Choose a reason for hiding this comment

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

Agree with all of the comments

bundlesize key is redundant, you can replace it with files

Copy link
Author

Choose a reason for hiding this comment

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

Great! Have updated the tests and docs for this.

@alexparish
Copy link

@siddharthkp any thoughts on this? Would love to have this functionality in bundlesize.

@siddharthkp
Copy link
Owner

Sorry, I was on a laptopless vacation 😄

This is a great feature, I'll get around to testing it soon, I promise

@welll
Copy link

welll commented Jul 17, 2018

@debugme , the code was updated. Can you please take a look again?

Would love to have this functionality in bundlesize. 🙏

@ssulivan11
Copy link
Author

Hello @siddharthkp, any update on publishing this into your package?

@Jdtanacredi
Copy link

Was just looking into building this myself, any updates? 👀

@ssulivan11
Copy link
Author

ssulivan11 commented Nov 8, 2018

In my fork have added the ability to export module instead of only having JSON file support. This is to fit inline with all the other packages at the moment moving towards this, eg: babel7, eslint...

Could add that too if anyone is interested.

@siddharthkp
Copy link
Owner

Implemented in #316 and published in 0.18.0 🎉

Check out README for details

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.

7 participants