diff --git a/lib/clean/project.sh b/lib/clean/project.sh index 51c09c5..762be9d 100644 --- a/lib/clean/project.sh +++ b/lib/clean/project.sh @@ -42,7 +42,7 @@ readonly PURGE_TARGETS=( "coverage" # Code coverage reports "DerivedData" # Xcode "Pods" # CocoaPods - ".cxx" # Android + ".cxx" # React Native Android NDK build cache ".expo" # Expo ) # Minimum age in days before considering for cleanup. @@ -328,6 +328,12 @@ is_protected_purge_artifact() { is_protected_vendor_dir "$path" return $? ;; + DerivedData) + # Protect Xcode global DerivedData in ~/Library/Developer/Xcode/ + # Only allow purging DerivedData within project directories + [[ "$path" == *"/Library/Developer/Xcode/DerivedData"* ]] && return 0 + return 1 + ;; esac return 1