Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clean command #387

Closed
lucasbento opened this issue May 14, 2019 · 11 comments · Fixed by pmadruga/react-native-clean-project#12
Closed

Add clean command #387

lucasbento opened this issue May 14, 2019 · 11 comments · Fixed by pmadruga/react-native-clean-project#12

Comments

@lucasbento
Copy link
Member

lucasbento commented May 14, 2019

Describe the Feature

I catch myself quite often recommending react-native-surrender to technical but mostly non-technical people to get to a clean state when working with react-native. It would be nice to have an official clean command that cleans up dependencies such as from yarn or cocoapods as well as Xcode, Android and watchman cache.

In this idea it would automatically get what is used without the need to specify it (e.g. check for yarn.lock file, ios/Podfile, etc).

Possible Implementations

react-native clean
react-native clean --ios # only to clean iOS-related stuff
react-native clean --android # only for Android

# Maybe these ❓
react-native clean --no-pods # clean everything except pods
react-native clean --no-yarn
@mikehardy
Copy link
Contributor

I am okay with almost any slicing (by layer - ios/android/react-native modules, by system - metro/node_modules/watchman/etc) so long as there is at least one simple version (perhaps the default? or something that sounds thorough like 'deep-clean") that eradicates absolutely every single bit of state it is possible to eradicate, ideally leaving you with what you would have if you just finished installing base system / dev installers and had done a git clone on a repo

@mikehardy
Copy link
Contributor

So I thought a plugin might be just as good, maybe? and I saw this existing project that was close to working as a plugin, so I did a thing: pmadruga/react-native-clean-project#12

@lucasbento
Copy link
Member Author

@mikehardy: IMO a plugin should be fine as long as we can recommend it in official channels.

@mikehardy
Copy link
Contributor

Yeah - agreed about that ability to recommend or not. I'd leave it to the repo author, and if not, it will form the basis for a possible internal implementation, sort of an incubator of the idea

@mikehardy
Copy link
Contributor

Just cross-posting status for anyone following along: I have some good feedback to respond to on the PR, but it appears the repo maintainer likes it, so leaving the discussion of "recommandable in official channels" aside, that repo will have a nice clean plugin within a couple days

@mikehardy
Copy link
Contributor

Final cross-post on this, but worth mentioning that the react-native-clean-project with my PR to do react-native clean-project-auto was accepted, merged, and has been published as version 3.2.1 on npmjs.com.

I believe a 3rd party plugin is good enough to be recommended through official channels so this issue might be resolved by that PR.

I'm already recommending it to anyone for obvious state issues (haste map stuff, weird type errors after package upgrades etc) and it seems to work fine.

@lucasbento
Copy link
Member Author

@cpojer @kelset: what do you think about recommending @mikehardy's solution on the documentation in a troubleshooting section?

@george-lamperis
Copy link

Is there a desire to move functionality like this to react-native-cli?

I have some semi-finished work for a "clean" command. I hadn't seen @mikehardy 's plugin before, but that does look promising. I'll look into it more.

However, I really like the idea of a clean script that has official blessing from react-native.

@mikehardy
Copy link
Contributor

Just a note to say that react-native-clean-project isn't my plugin, I just found @pmadruga's work when I was looking for a clean function, and simply PR things there any time I find some new nook or cranny that isn't cleaned yet. So far seems thorough to me

@george-lamperis
Copy link

I was considering doing the same, PR-ing to an existing project. There are other similar projects, such as rn-game-over: https://github.com/taboulot/rn-game-over

If we think an official implementation of this should be part of react-native-cli then I'm happy to move forward and PR it.

@adamTrz
Copy link
Collaborator

adamTrz commented Nov 18, 2022

Fixed by #1582

@adamTrz adamTrz closed this as completed Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants