Chore: add react native clean project
This commit is contained in:
@@ -97,7 +97,6 @@ $ npm run ios
|
|||||||
Make sure that you have Java 1.8 by running `java -version`.
|
Make sure that you have Java 1.8 by running `java -version`.
|
||||||
|
|
||||||
If you don't have Java installed, or your Java version is different, the app may not work. You can try just using Android Studio's Java by prepending it to your `$PATH` in your shell profile:
|
If you don't have Java installed, or your Java version is different, the app may not work. You can try just using Android Studio's Java by prepending it to your `$PATH` in your shell profile:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ export PATH="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin:${PATH}"
|
$ export PATH="/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin:${PATH}"
|
||||||
```
|
```
|
||||||
@@ -116,6 +115,22 @@ If you get error messages about `adb` not being found on your path:
|
|||||||
$ ln -s ~/Library/Android/sdk/platform-tools/adb /usr/local/bin/adb
|
$ ln -s ~/Library/Android/sdk/platform-tools/adb /usr/local/bin/adb
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Clearing project cache
|
||||||
|
If you would like to clear project cache and/or re-install project libraries, you can run clear script as follows:
|
||||||
|
|
||||||
|
$ npm run clear
|
||||||
|
|
||||||
|
Script accepts the following options:
|
||||||
|
"none" - 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
|
||||||
|
"npm" - script will reinstall project libraries.
|
||||||
|
|
||||||
|
For example, if you would like to clear android part of the project and re-install project libraries, you can run the following command:
|
||||||
|
|
||||||
|
$ npm run clear android npm
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
### Unit tests
|
### Unit tests
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ allprojects {
|
|||||||
|
|
||||||
ext {
|
ext {
|
||||||
googlePlayServicesVersion = "+" // default: "+"
|
googlePlayServicesVersion = "+" // default: "+"
|
||||||
firebaseMessagingVersion = "+" // default: "+"
|
firebaseMessagingVersion = "21.1.0" // default: "+"
|
||||||
|
|
||||||
buildToolsVersion = "29.0.3"
|
buildToolsVersion = "29.0.3"
|
||||||
minSdkVersion = 23
|
minSdkVersion = 23
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "\x1b[35;01m""Start clearing android cache...""\x1b[39;49;00m"
|
||||||
|
|
||||||
|
echo "Clean android project..."
|
||||||
|
cd android && ./gradlew clean && cd ..
|
||||||
|
|
||||||
|
echo "Remove Android build..."
|
||||||
|
rm -rf android/app/build
|
||||||
|
|
||||||
|
echo "\x1b[35;01m""Done!""\x1b[39;49;00m"
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "\x1b[35;01m""Start clearing general cache...""\x1b[39;49;00m"
|
||||||
|
|
||||||
|
echo "Clear Watchman cache..."
|
||||||
|
watchman watch-del-all
|
||||||
|
|
||||||
|
echo "Remove React temp data..."
|
||||||
|
rm -rf $TMPDIR/react-*
|
||||||
|
|
||||||
|
echo "Remove React Native Packager temp data..."
|
||||||
|
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"
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "\x1b[35;01m""Start clearing ios cache...""\x1b[39;49;00m"
|
||||||
|
|
||||||
|
echo "Remove all Xcode derived data..."
|
||||||
|
rm -rf ~/Library/Developer/Xcode/DerivedData
|
||||||
|
|
||||||
|
echo "Remove iOS build..."
|
||||||
|
rm -rf ios/build
|
||||||
|
|
||||||
|
echo "Remove iOS Pods data..."
|
||||||
|
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 "Wipe system iOS Pods cache..."
|
||||||
|
pod cache clean --all
|
||||||
|
|
||||||
|
echo "Wipe user iOS Pods cocoapods cache..."
|
||||||
|
rm -rf ~/.cocoapods
|
||||||
|
|
||||||
|
echo "\x1b[35;01m""Done!""\x1b[39;49;00m"
|
||||||
+64
-24
@@ -1,37 +1,77 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo "rm -rf ios/build..."
|
# if user provided argument all, all caches are cleared
|
||||||
rm -rf ios/build
|
|
||||||
|
|
||||||
echo "rm -rf android/app/build..."
|
if [[ -z "$1" ]];
|
||||||
rm -rf android/app/build
|
then
|
||||||
|
if [[ -z "$TMPDIR" ]];
|
||||||
|
then
|
||||||
|
echo "\x1b[35;01m""Your current TMPDIR variable is not set. Please set it before running the script.""\x1b[39;49;00m"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Removed all Xcode derived data..."
|
echo "\x1b[35;01m""Do you want to clear ios project(y/n)?""\x1b[39;49;00m"
|
||||||
rm -rf ~/Library/Developer/Xcode/DerivedData
|
read ios
|
||||||
|
|
||||||
echo "Removed iOS Pods data..."
|
echo "\x1b[35;01m""Do you want to clear android project(y/n)?""\x1b[39;49;00m"
|
||||||
rm -rf ios/Pods/*
|
read android
|
||||||
|
|
||||||
echo "Removed Podfile.lock..."
|
echo "\x1b[35;01m""Do you want to clear general cache(y/n)?""\x1b[39;49;00m"
|
||||||
rm Podfile.lock
|
read cache
|
||||||
|
|
||||||
echo "watchman watch-del-all..."
|
echo "\x1b[35;01m""Do you want to re-install project libraries?""\x1b[39;49;00m"
|
||||||
watchman watch-del-all
|
read libraries
|
||||||
|
else
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
key="$1"
|
||||||
|
|
||||||
echo "rm -rf node_modules..."
|
case $key in
|
||||||
rm -rf node_modules
|
ios)
|
||||||
|
ios="y"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
android)
|
||||||
|
android="y"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
cache)
|
||||||
|
cache="y"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
npm)
|
||||||
|
libraries="y"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
echo "npm install..."
|
echo "ios " $ios
|
||||||
npm install
|
echo "android " $android
|
||||||
|
echo "cache " $cache
|
||||||
|
echo "npm " $libraries
|
||||||
|
|
||||||
echo "Pods install..."
|
if [[ $ios == "y" ]] || [[ $1 == "all" ]];
|
||||||
cd ios && pod install && cd ..
|
then
|
||||||
|
. scripts/clear-ios.sh
|
||||||
|
fi
|
||||||
|
|
||||||
echo "rm -rf $TMPDIR/react-*..."
|
if [[ $android == "y" ]] || [[ $1 == "all" ]];
|
||||||
rm -rf $TMPDIR/react-*
|
then
|
||||||
|
. scripts/clear-android.sh
|
||||||
|
fi
|
||||||
|
|
||||||
echo "rm -rf $TMPDIR/haste-map-react-native-packager-*..."
|
if [[ $cache == "y" ]] || [[ $1 == "all" ]];
|
||||||
rm -rf $TMPDIR/haste-map-react-native-packager-*
|
then
|
||||||
|
. scripts/clear-cache.sh
|
||||||
|
fi
|
||||||
|
|
||||||
echo "rm -rf $TMPDIR/metro-*..."
|
if [[ $libraries == "y" ]] || [[ $1 == "all" ]];
|
||||||
rm -rf $TMPDIR/metro-*
|
then
|
||||||
|
. scripts/reinstall-project.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "\x1b[35;01m""Clearing is completed. You're ready to go!""\x1b[39;49;00m"
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "\x1b[35;01m""Start re-installing dependencies...""\x1b[39;49;00m"
|
||||||
|
|
||||||
|
echo "Remove node_modules..."
|
||||||
|
rm -rf node_modules
|
||||||
|
|
||||||
|
echo "Verify npm cache..."
|
||||||
|
npm cache verify
|
||||||
|
|
||||||
|
echo "Npm install..."
|
||||||
|
npm install
|
||||||
|
|
||||||
|
echo "Pods install..."
|
||||||
|
cd ios && pod install && cd ..
|
||||||
|
|
||||||
|
echo "\x1b[35;01m""Done!""\x1b[39;49;00m"
|
||||||
Reference in New Issue
Block a user