pmadruga / react-native-clean-project

Automating the clean up of a React Native project
MIT License
1.17k stars 52 forks source link

Enhancement - ability to clean user-level pod cache #42

Closed mikehardy closed 3 years ago

mikehardy commented 4 years ago

We just ran into an issue on react-native-firebase that was resolved by deleting the local cocoapods cache in the user's directory like so:

rm -fr ~/.cocoapods/repos/trunk

https://github.com/invertase/react-native-firebase/issues/3305#issuecomment-600459982

Might be nice to have an option to '--wipe-pods-user-cache' or similar?

mikehardy commented 4 years ago

Here's the basis for the fix: https://github.com/CocoaPods/CocoaPods/issues/9260#issuecomment-542586026

pmadruga commented 3 years ago

Wouldn't it make more sense to just wipe the entire ~/.cocoapods folder?

mikehardy commented 3 years ago

I just wasted a fair bit of time yesterday with cocoapods cache corruption in ~/Library/Cache/CocoaPods (delete possible via pod cache clean --all) as well. Lost hours really, quite painful.

I think purging ~/.cocoapods and pod cache clean --all would be good additions, and I'd do a PR if you'd accept it @pmadruga ?

Deleting these will result in a great deal of network traffic to rebuild state so I would have them default to off in the "auto" scheme and only available via toggles or interactive response, personally, but open to suggestion on that.

pmadruga commented 3 years ago

A PR is more than welcome, thanks.

I believe the "auto" mode should induce the cleanest state, and the toggles to make it less clean. But I'm flexible on that one 👍🏼

mikehardy commented 3 years ago

I will defer to your taste in your module (and I am sympathetic to that anyway - clean should be clean :-) ). Okay I'll post up a PR for a truly clean cocoapods situation. If there is a convenient place to mention to the user that it implies a large network transfer cost in the future to rebuild the cache (like, in docs or if there is already CLI messaging) I'll do that so it's not a shock, or at least not an unknown one :)

pmadruga commented 3 years ago

Sounds like a great idea @mikehardy . Happy to review that PR.

mikehardy commented 3 years ago

I am still planning on doing this, just collecting ideas here from user reports of what worked for them as they fixed pod errors,

here's another possibly-needed command: pod repo remove trunk, c.f. https://github.com/invertase/react-native-firebase/issues/4710#issuecomment-752683760

mikehardy commented 3 years ago

Just noting that @gilbertl confirmed pod cache clean --all is a valid command to clean the directory that bit me, thanks Gilbert

mikehardy commented 3 years ago

Out of the 3 ideas, I researched and learned that if we purge ~/.cocoapods it means pod repo remove trunk is unnecessary, as that would just be affecting state within ~/.cocoapods - it is a subset.

So I posted a PR that just did rm -rf ~/.cocoapods and pod cache clean --all

pmadruga commented 3 years ago

Thanks @mikehardy - PR approved with one comment.