chore(build): optimize turborepo caching by scoping globalEnv variables#28728
Open
TanmayChaurasia24 wants to merge 2 commits intocalcom:mainfrom
Open
chore(build): optimize turborepo caching by scoping globalEnv variables#28728TanmayChaurasia24 wants to merge 2 commits intocalcom:mainfrom
TanmayChaurasia24 wants to merge 2 commits intocalcom:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR audits and optimizes Turborepo's
globalEnvlist to dramatically improve cache hit rates across the monorepo for self-hosted operators, CI environments, and local developers.Previously,
globalEnvcontained nearly 300 variables, including highly specific application secrets (e.g.TWILIO_SID,STRIPE_PRIVATE_KEY, etc.). This approach meant changing a single specific app variable unrestrictedly busted the entire monorepo cache across all 114 packages, forcing slow rebuilds from scratch for loosely-coupled packages like@calcom/prismaand@calcom/ui.We reduced
globalEnvdown to 14 core essential variables (e.g.NODE_ENV,DATABASE_URL,CI) and scoped the remaining ~297 environmental variables directly downstream into the.envdependencies of the task definitions (namely@calcom/web#build,@calcom/website#build, and@calcom/api-v2#build) where they are actually used.Changes:
turbo.jsonglobalEnv.envarrays that bundle them./appsor/packagescodebase workspaces.Type of change
Checklist
feat(scope): descriptionorchore(deps): descriptionyarn lint:fixfixes #28633