From 685aa8b970641bd4de6435d9166d8a79d0febb5f Mon Sep 17 00:00:00 2001 From: tw93 Date: Mon, 16 Feb 2026 15:39:00 +0800 Subject: [PATCH] refactor(purge): improve React Native targets safety and clarity - Clarify .cxx comment to indicate React Native NDK build cache - Add protection for Xcode global DerivedData in ~/Library/Developer/Xcode/ to prevent accidental deletion of shared build artifacts Refs: #461 --- lib/clean/project.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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