Open MatsG23 opened 1 year ago
One drawback for this would be CI situations that grab the .yarn/cache
folder from CI caching, and then only link the necessary dependencies for that run using focus.
This is a pretty useful setup, as it allows keeping a single cache across all workflows, while retaining the link-time speed benefits of focus. Otherwise a CI cache for every possible workspace permutation would be required.
I have the same observation. For several reasons I try to clean up dev dependencies:
I understand the interest of the cache for the development process and CI. But the goal is production. Isn't there a way to export only the production dependencies.
Describe the user story
To host my Node.js app on my personal server in production, I want to remove all development dependencies. This is what I use
yarn workspaces focus --production
for. I am using the Yarn Plug'n'Play feature which requires to have the.pnp.*
files and.yarn/cache
folder on the server as a replacement tonode_modules
. I noticed that, even tho I ran theyarn workspaces focus --production
command, the development packages are still cached in.yarn/cache
.Describe the solution you'd like
It would make sense if
yarn workspaces focus --production
would cleanup the.yarn/cache
folder by deleting all ZIP files (caches) of the omitted development packages.Describe the drawbacks of your solution
I cannot think of a drawback of my solution. The
yarn install
command already has the logic for cleaning unneeded cache files built-in.Describe alternatives you've considered
I do not think there is an alternative because what I am describing is an essential feature imo. I do not see a use case where you would like to have the cache files of the development packages on the production server because you do not use any development package on there. Under normal circumstances, I as a developer, would not run the
yarn workspaces focus --production
command on the computer I develop on because there is no need to. This would have been the only case I could come up with where you would like to switch back to using the development packages and where you would benefit from still having them cached.