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

Assert size increase #147

Open
btd opened this issue Dec 30, 2022 · 4 comments
Open

Assert size increase #147

btd opened this issue Dec 30, 2022 · 4 comments

Comments

@btd
Copy link
Owner

btd commented Dec 30, 2022

Something to think about. I already have list template that can be used to track sizes and commited to repo. I can add some property that will not allow to override this file in case size increased for example to some percent.

@jycouet
Copy link

jycouet commented Oct 14, 2023

👋 Hi, I just came across this library and found it perfect for diagnosing what's going on – well done!

Actually, I started something a few months back, https://github.com/jycouet/vite-plugin-lib-reporter, to track increases over builds. I use it in my projects to keep track of things, and it's working well. I would be happy to kill my repository if we/i add something similar here 👍
Do you have a specific API in mind?

@btd
Copy link
Owner Author

btd commented Nov 30, 2023

Hi, sorry i missed you message. Somehow i messed github notification settings.

I do not have any specific API in mind. What i am trying to follow in this plugin:

  1. Reasonable opinionated way
  2. Minimum settings, ideally 0

Currently plugin allows to add different types of reporters/templates. So most likely we can add one more that will read previous data and compare to provided settings.
So i see to new options added - diffLevel to assert, and where to store state. Technically this can be attached to list reporter as it is literally previous state and we only need diffLevel

@jycouet
Copy link

jycouet commented Dec 1, 2023

I would like also to configure as less as possible.

diffLevel, I guess that you have in mind a % (So a number? Maybe defaulting to 0?)
The first time, since there is no previous data, you would allow the thing? And later, you would accept x increase? (Failing the build?)

I'm not sure how/where to store the previous build? (or the target branch build?)

@btd
Copy link
Owner Author

btd commented Dec 2, 2023

Yes sounds right what you wrote.
I created this issue when i added list template (which is just yml content with bundle/file/size entries). Basically this is actual state of bundles reported by rollup/plugin.

  1. On initial build there is no state, pass always.
  2. When file on the same path found, it is possible to start asserting if it is enabled
  3. If assertion enabled we take size of previous builld, new build get diff in % or kb (this need to think) and assert when threshold exceeds

There are moments that i think of:

  1. Assertion should be opt-in, backward compatible - not enabled, not reported
  2. Not sure if we need fail build or warn or any other action. I understand purpose of failing build, warnings are useless
  3. Size difference, % makes sense, does kb difference makes sense?
  4. I was thinking to use specifically list template because it contains what exactly changed - so that we can report this back, like file1, file2 added, file3 increased in size etc.

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

No branches or pull requests

2 participants