pmadruga / react-native-clean-project

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

Refactor for plugin capability, add pods and npm clean commands #12

Closed mikehardy closed 5 years ago

mikehardy commented 5 years ago

Hi there!

A few of us in the react-native-community were discussing how we could never escape the need to completely wipe out state and start clean, and the react-native command line should just have a command for it.

The CLI maintainers mentioned we could probably do it as a plugin pretty quickly, and I found this project, and thought you might be okay with refactoring it so it could be used as a plugin?

So I did that, and I also added a couple extra possible commands - pod delete, pod update, and npm cache clean

It should work with both CLI 1.x and the upcoming 2.x for react-native 0.60, and you just need to do react-native clean-project or react-native clean-project-auto to have it either take you through the questions, or just purge everything respectively

If it's merge-worthy, it fixes https://github.com/react-native-community/cli/issues/387

pmadruga commented 5 years ago

Thanks for this and yes, it can totally be used as a plugin. I will only ask for retroactive compatibility and any changes requested that may have come from the review. Jumping to the review now.

mikehardy commented 5 years ago

Oh great - I'm sure we can get this in a shape you like then. I'm pretty agnostic on everything except that things should work and be easy to maintain :-). I'll go through your review now

mikehardy commented 5 years ago

Worth mentioning that I agree 100% on backwards compatibility, I see no reason this should be a breaking change in any way, it's really just making the code so it can be wrapped, then doing so. I think the community will really like this - they were excited when I showed them this package, since the UI and feedback is really cool for users

mikehardy commented 5 years ago

Okay @pmadruga (and @thymikee if you have interest) - I think this one is an actual Pull Request as opposed to a quick-and-dirty Proposal Request like it was originally. Please take a fresh look and let me know what think?

mikehardy commented 5 years ago

Thanks so much for the quick review, great comments and I'll fix what's obviously wrong while waiting for your reply on the rest.

mikehardy commented 5 years ago

Okay - I've addressed all the comments, even if for the 2 more substantial ones I was essentially pleading to keep them separate. Let me know what you think - thanks!

pmadruga commented 5 years ago

Thanks for the replies, @mikehardy . The PR looks great and exposed some of the issues that I need to address. Thumbs up from me. I'll merge as soon as possible - would just like @thymikee 's thumbs up.

And overall, thanks for this PR.

mikehardy commented 5 years ago

Fantastic! I'm not part of the CLI team (I just run around making changes on things that drive me crazy personally) but I am going to use the heck out of this thing now. If the CLI folks want to keep this out of core I could see this plugin being the de facto standard at which point you and your module will be #InternetFamous, which is fun :-). Cheers

mikehardy commented 5 years ago

@thymikee I'm so glad you looked at this, I would have never known that helped the CLI, not knowing the internals. I committed your suggestion exactly as is

mikehardy commented 5 years ago

@pmadruga Any chance of a release with this soon :pray: :smiley: - would love to recommend this as a simple npm install vs using a git master dependency

pmadruga commented 5 years ago

Done :)