yarnpkg / berry

📦🐈 Active development trunk for Yarn ⚒
https://yarnpkg.com
BSD 2-Clause "Simplified" License
7.47k stars 1.12k forks source link

add a config option to disallow the cache clean command #6610

Open elbywan opened 1 week ago

elbywan commented 1 week ago

What's the problem this PR addresses?

At Datadog we are using yarn inside a huge monorepository using the PnP linker and Zero-Installs with all the dependencies versioned through git.

The issue we have is that people frequently have the tendency to think that this kind of environment works like others, and that cleaning the cache is the way to go whenever they encounter an install issue (like deleting node_modules).

This is obviously not the case and we have to tell them to restore their packages from the git remote when that happens, which is a bit cumbersome.

see also: https://github.com/yarnpkg/berry/discussions/6518

How did you fix it?

This PR adds a non-breaking option inside the .yarnrc file to disallow running yarn clean cache.

cc @arcanis

Checklist