-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Make the local cache opt-in (rather than opt-out) #4252
Conversation
### 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 | ||
|
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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