[eas-build] - lockfile preflight checks to eas build command#3434
[eas-build] - lockfile preflight checks to eas build command#3434AbbanMustafa wants to merge 7 commits intomainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3434 +/- ##
==========================================
+ Coverage 52.78% 52.98% +0.20%
==========================================
Files 809 810 +1
Lines 34048 34260 +212
Branches 7075 7139 +64
==========================================
+ Hits 17969 18148 +179
- Misses 15998 16031 +33
Partials 81 81 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
✅ Thank you for adding the changelog entry! |
|
Subscribed to pull request
Generated by CodeMention |
| env, | ||
| }); | ||
|
|
||
| if (!lockfileChecked) { |
There was a problem hiding this comment.
@AbbanMustafa this is a great PR! I do think that we should provide a way for customers to opt out of this check, in case they have an unusual configuration that is really valid for them, but might not pass these checks. Maybe something like EAS_BUILD_SKIP_LOCKFILE_CHECK.
There was a problem hiding this comment.
thank you! yes I agree an opt out would be nice
|
|
||
| const LOCKFILE_BY_MANAGER: Record<string, LockfileInfo> = { | ||
| npm: { filename: NPM_LOCK_FILE, managerName: 'npm' }, | ||
| yarn: { filename: YARN_LOCK_FILE, managerName: 'Yarn' }, |
There was a problem hiding this comment.
Curious as to why managerName is capitalized for yarn and bun....
There was a problem hiding this comment.
Also, in reading through this, it occurred to me that it might be good to package all this code for reuse, in case it's needed elsewhere. I also noticed that there are open source packages for this, e.g. https://github.com/snyk/nodejs-lockfile-parser
Why
Our new build error logging has highlighted that nearly ~3k builds fail every week on the
install_dependenciesphase. These are typically from out of sync lockfiles or peer dependency conflicts. These can be avoided by providing a set of preflight checks that ensure the dependency installation is valid before queueing up to build. Quicker feedback is a much better experience for the user, and helps us from running wasteful builds.How
install_dependenciesfailures instantly on the clientlockfileChecked) so the validation only runs once, even when building for both iOS and Android in the same command. Samepattern as the existing sdkVersionChecked and metroConfigValidated flags.
The set of checks to be made:
Test Plan
Example of how a build would fail before: https://expo.dev/accounts/mustafaexpo/projects/wander/builds/c596e1ac-f8ba-4af4-9840-fe1492837ef7
After:

Validated each scenario fails locally without queueing a build and with a helpful error log to provide the resolution step to the user.