Make the local cache opt-in (rather than opt-out)#4252
Merged
Conversation
merceyz
reviewed
Mar 22, 2022
Comment on lines
+70
to
+77
| ### Local Cache | ||
|
|
||
| The local cache is a way to protect against registries going down by keeping a cache of your packages within your very project (often checked-in within the repository). While not always practical (it causes the repository size to grow, although we have ways to mitigate it significantly), it presents various interesting properties: | ||
|
|
||
| - It doesn't require additional infrastructure, such as a [Verdaccio proxy](https://verdaccio.org/) | ||
| - The install fetch step is as fast as it can be, with no data transfer at all | ||
| - It lets you reach [zero-installs](https://yarnpkg.com/features/zero-installs) if you also use the PnP linker | ||
|
|
Member
There was a problem hiding this comment.
Another use case for the local cache, without committing it, is that you can use it to avoid dealing with credentials in your Dockerfile.
There was a problem hiding this comment.
Another use case unrelated to offline mode:
github actions cache: actions/setup-node#325.
As yarn is able to prune the cache, I don't have to invalidate on yarn.lock changes. That gives a little extra speed / reliability when deps changes often
13 tasks
2 tasks
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.
What's the problem this PR addresses?
The local cache was enabled in Yarn 2 in large part because people weren't aware that it existed. However, it adds a significant friction around new project creation, and I suspect it might not be as necessary as before (our users have been confronted to it for a while now, so discovery should have improved).
How did you fix it?
Local cache is now disabled by default. Tests aren't updated yet.
Checklist