turbo: Don't bust cache on new workspace packages
Describe the feature you’d like to request
With pnpm (and possibly other package managers too), every time a new workspace package is added, the lock file changes and the cache is busted for all tasks on all packages.
Many design systems manage every component as an individual package, both for versioning and for a better, more granular cache. In such repositories, adding a workspace package is a very common event, that needlessly makes the cache a lot less useful and defeats the purpose of a granular cache.
This is also not needed for correctness, since the cache of relevant tasks in dependent packages will be busted automatically either through changes/additions to package.json or the dependsOn field in turbo.json.
Describe the solution you’d like
If the only changes detected in the lock file are related to workspace packages, the cache should not be invalidated.
Describe alternatives you’ve considered
I can’t think of any alternative other than keeping things as they currently are with a very inefficient cache in such scenarios
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 6
- Comments: 21 (8 by maintainers)
It’s not just adding a new package. If you change version of any namespaces package, then package-lock.json in the root directory also changes to reflect that causing all packages to be rebuilt, even if nothing depends on it. We just stopped updating versions altogether because of this.