Skip to content
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

Merged
merged 3 commits into from Mar 24, 2022

Conversation

arcanis
Copy link
Member

@arcanis arcanis commented Mar 22, 2022

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

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@arcanis arcanis marked this pull request as draft March 22, 2022 16:50
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

Copy link
Member

@merceyz merceyz Mar 22, 2022

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.

Copy link

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

@merceyz merceyz added the major label Mar 22, 2022
@arcanis arcanis marked this pull request as ready for review March 23, 2022 09:44
@arcanis arcanis changed the title Disables the local cache by default Make the local cache opt-in (rather than opt-out) Mar 23, 2022
@arcanis arcanis mentioned this pull request Mar 23, 2022
13 tasks
@arcanis arcanis merged commit ea699bc into master Mar 24, 2022
@arcanis arcanis deleted the mael/disable-local-cache-default branch March 24, 2022 12:32
@merceyz merceyz added this to the 4.0.0 milestone May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants