Chore/update clear script
This commit is contained in:
@@ -127,7 +127,7 @@ If you would like to clear project cache and/or re-install project libraries, yo
|
||||
npm run clear
|
||||
|
||||
Script accepts the following options:
|
||||
"none" - script will delete all caches and re-install project libraries,
|
||||
"all" - script will delete all caches and re-install project libraries,
|
||||
"ios" - script will delete ios-related cache
|
||||
"android" - script will delete android-related cache
|
||||
"cache" - script will purge Watchman, Metrobundler, Pachager and React caches
|
||||
|
||||
@@ -8,4 +8,4 @@ cd android && ./gradlew clean && cd ..
|
||||
echo "Remove Android build..."
|
||||
rm -rf android/app/build
|
||||
|
||||
echo "\x1b[35;01m""Done!""\x1b[39;49;00m"
|
||||
echo "\x1b[35;01m""Done clearing android cache!""\x1b[39;49;00m"
|
||||
|
||||
@@ -14,4 +14,4 @@ rm -rf $TMPDIR/haste-map-react-native-packager-*
|
||||
echo "Remove Metro bundler temp data..."
|
||||
rm -rf $TMPDIR/metro-*
|
||||
|
||||
echo "\x1b[35;01m""Done!""\x1b[39;49;00m"
|
||||
echo "\x1b[35;01m""Done clearing general cache!""\x1b[39;49;00m"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "\x1b[35;01m""Start clearing ios cache...""\x1b[39;49;00m"
|
||||
echo "\x1b[35;01m""Start clearing iOS cache...""\x1b[39;49;00m"
|
||||
|
||||
echo "Remove all Xcode derived data..."
|
||||
rm -rf ~/Library/Developer/Xcode/DerivedData
|
||||
@@ -14,8 +14,8 @@ rm -rf ios/Pods/*
|
||||
echo "Remove Podfile.lock..."
|
||||
rm Podfile.lock
|
||||
|
||||
echo "Wipe iOS build artifacts..."
|
||||
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/
|
||||
echo "Close XCode and wipe iOS build artifacts..."
|
||||
(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/
|
||||
|
||||
echo "Wipe system iOS Pods cache..."
|
||||
pod cache clean --all
|
||||
@@ -23,4 +23,7 @@ pod cache clean --all
|
||||
echo "Wipe user iOS Pods cocoapods cache..."
|
||||
rm -rf ~/.cocoapods
|
||||
|
||||
echo "\x1b[35;01m""Done!""\x1b[39;49;00m"
|
||||
echo "Pods install..."
|
||||
cd ios && pod install && cd ..
|
||||
|
||||
echo "\x1b[35;01m""Done clearing iOS cache!""\x1b[39;49;00m"
|
||||
|
||||
+32
-23
@@ -10,22 +10,31 @@ then
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "\x1b[35;01m""Do you want to clear general cache(y/n)?""\x1b[39;49;00m"
|
||||
read cache
|
||||
|
||||
echo "\x1b[35;01m""Do you want to re-install project libraries(y/n)?""\x1b[39;49;00m"
|
||||
read libraries
|
||||
|
||||
echo "\x1b[35;01m""Do you want to clear ios project(y/n)?""\x1b[39;49;00m"
|
||||
read ios
|
||||
|
||||
echo "\x1b[35;01m""Do you want to clear android project(y/n)?""\x1b[39;49;00m"
|
||||
read android
|
||||
|
||||
echo "\x1b[35;01m""Do you want to clear general cache(y/n)?""\x1b[39;49;00m"
|
||||
read cache
|
||||
|
||||
echo "\x1b[35;01m""Do you want to re-install project libraries?""\x1b[39;49;00m"
|
||||
read libraries
|
||||
else
|
||||
while [[ $# -gt 0 ]]; do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
cache)
|
||||
cache="y"
|
||||
shift
|
||||
;;
|
||||
npm)
|
||||
libraries="y"
|
||||
shift
|
||||
;;
|
||||
ios)
|
||||
ios="y"
|
||||
shift
|
||||
@@ -34,11 +43,10 @@ else
|
||||
android="y"
|
||||
shift
|
||||
;;
|
||||
cache)
|
||||
all)
|
||||
ios="y"
|
||||
android="y"
|
||||
cache="y"
|
||||
shift
|
||||
;;
|
||||
npm)
|
||||
libraries="y"
|
||||
shift
|
||||
;;
|
||||
@@ -49,29 +57,30 @@ else
|
||||
done
|
||||
fi
|
||||
|
||||
echo "ios " $ios
|
||||
echo "android " $android
|
||||
echo "\x1b[35;01m""Clearing of the following components is starting...""\x1b[39;49;00m"
|
||||
echo "cache " $cache
|
||||
echo "npm " $libraries
|
||||
|
||||
if [[ $ios == "y" ]] || [[ $1 == "all" ]];
|
||||
then
|
||||
. scripts/clear-ios.sh
|
||||
fi
|
||||
|
||||
if [[ $android == "y" ]] || [[ $1 == "all" ]];
|
||||
then
|
||||
. scripts/clear-android.sh
|
||||
fi
|
||||
echo "ios " $ios
|
||||
echo "android " $android
|
||||
|
||||
if [[ $cache == "y" ]] || [[ $1 == "all" ]];
|
||||
then
|
||||
. scripts/clear-cache.sh
|
||||
. scripts/clear-cache.sh || true
|
||||
fi
|
||||
|
||||
if [[ $libraries == "y" ]] || [[ $1 == "all" ]];
|
||||
then
|
||||
. scripts/reinstall-project.sh
|
||||
. scripts/reinstall-project.sh || true
|
||||
fi
|
||||
|
||||
if [[ $ios == "y" ]] || [[ $1 == "all" ]];
|
||||
then
|
||||
. scripts/clear-ios.sh || true
|
||||
fi
|
||||
|
||||
if [[ $android == "y" ]] || [[ $1 == "all" ]];
|
||||
then
|
||||
. scripts/clear-android.sh || true
|
||||
fi
|
||||
|
||||
echo "\x1b[35;01m""Clearing is completed. You're ready to go!""\x1b[39;49;00m"
|
||||
|
||||
@@ -14,4 +14,4 @@ npm install
|
||||
echo "Pods install..."
|
||||
cd ios && pod install && cd ..
|
||||
|
||||
echo "\x1b[35;01m""Done!""\x1b[39;49;00m"
|
||||
echo "\x1b[35;01m""Done re-installing dependencies!""\x1b[39;49;00m"
|
||||
|
||||
Reference in New Issue
Block a user