-
Notifications
You must be signed in to change notification settings - Fork 73
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
Enhanced TurboSnap: Trace dependency changes instead of bailing out #683
Conversation
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.
This is awesome @ghengeveld! 🚀
I just want to make sure we get the replacement builds thing right. Is it possible to get a test for those in? I'm not really seeing a full E2E test for this, is that too difficult?
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.
Nice work, thanks for taking this on. I assume we'll want to also (not in this PR) change the TurboSnap docs related to full rebuilds.
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.
Looks great to me, thanks for all the comments in the tests!
… checkout the same file multiple times
All tested ✅ Wow! |
Currently (as of v6.11.0), TurboSnap bails out if it finds a dependency-related change in
package.json
, or any change topackage-lock.json
oryarn.lock
. Although this is much better than bailing out on any change topackage.json
, this behavior is still lacking because it means we do a full rebuild even if the updated dependency isn't used in any or some of the stories (directly or indirectly).This update avoids bailing out of TurboSnap for changes to lock files. Instead it parses and compares lock files to their previous (baseline) version, to retrieve a set of changed dependency names. Those dependency names are then cross-referenced with the Webpack dependency tree to trace those changed dependencies to the story files that are affected by them. This essentially uses the existing "changed files" behavior of TurboSnap, but extends it to include files in
node_modules
(for dependencies we know have been added/updated/removed) in the set of changed files.If we fail to find or parse a lock file (or its previous version) then we fall back to the v6.11.0 behavior of bailing out on any dependency-related change to package.json.
How to test
Scenarios to test:
changedPackageFiles