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

Share core functionality with size-plugin? #1

Closed
developit opened this issue Feb 17, 2019 · 6 comments · Fixed by #4
Closed

Share core functionality with size-plugin? #1

developit opened this issue Feb 17, 2019 · 6 comments · Fixed by #4
Labels
enhancement New feature or request

Comments

@developit
Copy link

Hi @luwes!

I'm wondering if we should figure out a way to share the core size calculation and display logic between the two plugins so they can receive the same updates (in particular, GoogleChromeLabs/size-plugin#15). Thoughts?

@luwes
Copy link
Owner

luwes commented Feb 17, 2019

That would be super neat! I'm all for that.

I mostly used the outputSizes and getSizes functions, removed reverseTemplate I thought this was specific to Webpack, though the hash logic might have to be put back. I didn't try this yet with code splitting only with multiple bundles builds.

For this the default columnWidth was added because multiple bundles wouldn't know about each other beforehand I think.

One bit in outputSizes changed from assets[name].source() to assets[name].code.

Let me know if I can be of help for the core functionality.
Would they be exposed from size-plugin or another isolated pkg?

@luwes luwes added the enhancement New feature or request label Feb 17, 2019
@luwes
Copy link
Owner

luwes commented Feb 17, 2019

Would love that history functionality 😃
We actually NEED that at work, take my size graph to meetings haha

@developit
Copy link
Author

Just an update from me, I still want this but haven't had time to hack on anything.

@kuldeepkeshwar
Copy link
Contributor

@developit
Copy link
Author

Might be nice to expose a method that lets folks populate sizesBefore before calling outputSizes. Also maybe make it a class?

@kuldeepkeshwar
Copy link
Contributor

@developit / @luwes I have updated the code.
Added option to override any step performed by size-plugin-core.

e.g

const sizesBefore = await getPreviousSizes(outputPath) ;
const sizes = await getSizes(assets); 
const files = await getDiff(sizesBefore,sizes); // calculate the diff
const output = await printSizes(files); // template output message
await uploadSizes(files); // upload stats
return output;

@luwes luwes closed this as completed in #4 Oct 5, 2019
luwes pushed a commit that referenced this issue Oct 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants