Skip to content

ios clean task does not gracefully fail on linux #92

@mikehardy

Description

@mikehardy

Hey @pmadruga 👋 long time no traffic from me here :-)

Today I used patch-package to patch react-native-clean-project@4.0.0 for the project I'm working on.

I'm wondering how you would feel about a PR here so that I can use one deep-clean target in package.json with a set of flags that cleans iOS build artifacts, but fails gracefully on non-Darwin machines?

Here is the diff that solved my problem (It is just wrapping the ios task in an if [ \'uname\' == "Darwin" ] really)

diff --git a/node_modules/react-native-clean-project/source/internals/tasks.js b/node_modules/react-native-clean-project/source/internals/tasks.js
index 2d71458..ed53531 100644
--- a/node_modules/react-native-clean-project/source/internals/tasks.js
+++ b/node_modules/react-native-clean-project/source/internals/tasks.js
@@ -2,7 +2,7 @@ const tasks = {
   wipeiOSBuildFolder: {
     name: 'wipe iOS build artifacts',
     command:
-      'rm -rf ios/build && (killall Xcode || true) && xcrun -k && cd ios && xcodebuild -alltargets clean && cd .. && rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache" && rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache" && rm -fr ~/Library/Developer/Xcode/DerivedData/ && rm -fr ~/Library/Caches/com.apple.dt.Xcode/',
+      'if [ `uname` == \'Darwin\' ]; then rm -rf ios/build && (killall Xcode || true) && xcrun -k && cd ios && xcodebuild -alltargets clean && cd .. && rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache" && rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache" && rm -fr ~/Library/Developer/Xcode/DerivedData/ && rm -fr ~/Library/Caches/com.apple.dt.Xcode/; fi',
     args: []
   },
   wipeiOSPodsFolder: {

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions