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
chore: use hoisted yarn install in build binary #17132
Conversation
Thanks for taking the time to open a PR!
|
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
abe7e01
to
091582b
Compare
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.
I do not 100% comprehend everything that's going on here, but I gave it a test - ran the commands - and the size is indeed smaller, like Tim says in the description.
Probably good to get a second set of eyes on the code, but it looks like there's been a decent amount of internal discussion already.
LGTM except I have reservations with build script being TypeScript, i.e. to do the build you need to first build the scripts doing that (or at least on the fly). I've been just adding You could go even further with that and add type annotations which are actually checked as well. See this example: https://github.com/thlorenz/cypress/blob/snapshot-8.0-release/packages/snapshot/snapconfig.js#L33-L65 This provides sufficient warnings IMHO to not waste time discovering mistakes at runtime while keeping the build requirement to just having Node.js installed and ready. |
@thlorenz yeah it does build on the fly here with
Potentially, though you'd also need all of the dependencies it references installed, meaning you'd still need the I could go either way though, I sort of think if we're trying to move more things to use |
@tgriesser I'm not concerned about the transpile cost, merely that now you need to have It's more opinion than anything same reason why people should limit bash scripts to bash features instead of requiring zsh or similar. If you feel |
As per discussion in Slack we agreed that TS for build scripts is fine and we should keep writing scripts in TypeScript going forward. The only exceptions are when scripts somehow execute at runtime or for our users or are very performance sensitive. |
091582b
to
ce28486
Compare
Additional details
Runs the "yarn install" from the root of the packages to de-duplicate node requires via hoisting. Reduces the overall bundle size by a considerable margin >100mb, and the compressed app by ~50mb.
Main changes:
path.join(os.tmpdir(), 'cypress-build', PLATFORM)
with a symlink tobuild
in the root for convenience (per @brian-mann request)^
for better deduplication of dependenciesyarn.lock
from the root beforeyarn --production
to ensure we are building with the same dependencies we have in the lockfile for develop/testing (allows us to use the^
rather than pinned versions with more confidence)demo
/test
that are taking up space, primarily in image librariesHow has the user experience changed?
Before:
After:
PR Tasks