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

Combine rollup configs with multiconfig and add size snapshot #405

Merged
merged 8 commits into from
Apr 9, 2018
Merged

Combine rollup configs with multiconfig and add size snapshot #405

merged 8 commits into from
Apr 9, 2018

Conversation

TrySound
Copy link
Contributor

@TrySound TrySound commented Mar 24, 2018

  • combined both umd/min configs with rollup multiconfig
  • changed umd bundle to development env like react does
  • added my size-snapshot plugin to simplify size tracking and improving in some cases. Later we can probably bundle also cjs and esm to track their treeshakability.

@alexreardon
Copy link
Collaborator

Brilliant! I will take a closer look on monday

@alexreardon
Copy link
Collaborator

I am trying to think of what the development flow would be with this new plugin. Can you please elaborate on this? Also, how would we go about rebase lining?

@TrySound
Copy link
Contributor Author

Every new commit will show the difference of size. Some commits may add too heavy dependency, some can be better minified. Also I'm gonna propose in the next PR esm and cjs bundles for entry points instead of babeled files. For esm bundle size-snapshot is able to show treeshakability.

To protect from commits without snapshot update we may add environment for ci like

cross-env SNAPSHOT=check rollup -c
sizeSnapshot({
  updateSnapshot: process.env.SNAPSHOT !== 'check'
})

and size snapshot will fail if existing snapshot is not matched with computed one.

@alexreardon
Copy link
Collaborator

Okay, so you would need to run the command to generate the size snapshot. Would it be good to have a seperate test script which simply checks to see if the bundle size has grown? That way we could run it as a build check

@TrySound
Copy link
Contributor Author

@alexreardon Done.

package.json Outdated
@@ -25,15 +25,15 @@
"/src"
],
"scripts": {
"test": "jest --config ./jest.config.js",
"test": "cross-env SNAPSHOT=check yarn build:dist && jest --config ./jest.config.js",
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there any way we can run the test without generating the dist itself? hmm...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAIK there's no way to prevent rollup writing currently. Is this a problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea of the plugin was integration in bundler without additional configuration.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this create a scenario where a merge to master can break? Thinking out loud.. i suppose not if it it updating the snapshot too

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we run the check as the second step of the command? (After jest)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alexreardon It can if PR is not based on actual master. But I think it's not so critical.

@alexreardon
Copy link
Collaborator

alexreardon commented Mar 29, 2018 via email

@TrySound
Copy link
Contributor Author

TrySound commented Apr 8, 2018

@alexreardon Can we consider using bundles for cjs and esm before major 7 release. I'd like to open PR after this one get merged.

Copy link
Collaborator

@alexreardon alexreardon left a comment

Choose a reason for hiding this comment

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

Some minor changes requested. Otherwise I am good for this one to go in

package.json Outdated
@@ -25,15 +25,15 @@
"/src"
],
"scripts": {
"test": "jest --config ./jest.config.js",
"test": "cross-env SNAPSHOT=check yarn build:dist && jest --config ./jest.config.js",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this create a scenario where a merge to master can break? Thinking out loud.. i suppose not if it it updating the snapshot too

package.json Outdated
@@ -25,15 +25,15 @@
"/src"
],
"scripts": {
"test": "jest --config ./jest.config.js",
"test": "cross-env SNAPSHOT=check yarn build:dist && jest --config ./jest.config.js",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we run the check as the second step of the command? (After jest)

@TrySound
Copy link
Contributor Author

TrySound commented Apr 8, 2018

Done

@alexreardon
Copy link
Collaborator

Well done @TrySound!

We'll see how the snapshot watching goes. If it causes too much friction we might remove it at some point. However, for now I am keen to have more visibility around our bundle size changes

@alexreardon alexreardon merged commit 3222512 into atlassian:master Apr 9, 2018
@TrySound TrySound deleted the combine-configs-and-add-size-snapshot branch April 9, 2018 08:27
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.

2 participants