The issues yarn has with updating the node_modules to support massive dependency tree changes within our workspace (usually caused by switching between minor branches of Kibana) has led to a ton of people adopting the strategy of running yarn kbn clean before yarn kbn bootstrap. I've spent the last several months trying to combat this but it is still pervasive best I can tell.
I think we should adapt to the state of things by moving the full cache clearing powers of yarn kbn clean to a new command, maybe yarn kbn destroy-caches, and update yarn kbn clean to only delete the node_modules/.yarn-integrity file and then run yarn kbn bootstrap automatically.
We could also support a --force flag that recursively deletes node_modules directories before running yarn kbn bootstrap, but unless you ran yarn kbn destroy-caches would you delete the caches which actually make things better and shouldn't be removed constantly.
Additionally, the --no-cache flag could be passed to yarn kbn clean (just like we support with yarn kbn bootstrap today) to bypass the bootstrap cache when it is automatically run.
Pinging @elastic/kibana-operations (Team:Operations)
@spalger I like the idea but why not just use --full flag for yarn kbn clean instead of using a different command? yarn kbn clean could now by default only delete the .yarn-integrety and when provided with --full flag will follow the current behaviour and delete everything.
Mostly because I don't think that most people think of clean as "make my repository harder to work with", they think of is as "make it better", and --full communicates "make it even better than better" to me.
yarn kbn destroy-caches intends to communicate that the result of that action will make things uncached, slower, and as such people shouldn't do it unless they're out of options.
I like it, updating the name to current state should help a lot. clean dist clean node_modules clean all. Not suggestions, mostly how I view the it when I run the command.
@spalger I was not seeing this by that point of view. For me yarn kbn clean will always clean something that is cached by our tools on the repo. It can be a smaller clean task or a wipe all task. But in the end either approaches are functional equivalent. I'm fine with your approach, I'm just not sure if destroy-caches is the best name for it 馃槃
How about yarn kbn please-dont-use-this-unless-you-are-asked-to-by-operations
@spalger don't know how but you've got it again! 馃槃
Most helpful comment
How about
yarn kbn please-dont-use-this-unless-you-are-asked-to-by-operations