diff --git a/bin/clean b/bin/clean index 4ef1502..86f457e 100755 --- a/bin/clean +++ b/bin/clean @@ -12,16 +12,17 @@ run "watchman watch-del-all" run "rm -rf $TMPDIR/react-*" run "rm ~/.babel.json" run "rm -rf ~/.rncache" + run "rm -rf ios/build" run "rm -rf ios/Pods" +run "rm -rf ios/*.xcworkspace" + +run "cd android ./gradlew clean && cd .." +run "rm -rf android/build" +run "rm -rf android/app/build" + run "rm -rf node_modules/" +run "yarn cache clean" run "npm cache clean --force" -run "npm install" - -#this is important - the cache needs to be reloaded manually -puts "Manually refreshing packages..." -pid = Process.spawn "npm run start -- --reset-cache" -sleep(10) -run "curl --output /dev/null --silent http://localhost:8081/index.bundle?platform=ios&dev=true" -puts "Clean finished 🚀".green +puts "Clean finished 🚀 run:\n npm install or yarn".green diff --git a/bin/setup b/bin/setup index 7dd911c..54e01fa 100755 --- a/bin/setup +++ b/bin/setup @@ -10,6 +10,6 @@ puts "Installing platforms: #{args}" args.each do |p| cmd = "#{bin_dir}/setup-#{p} #{bin_dir}" - puts system "#{cmd}" + abort "Setup failed".red if !system "#{cmd}" end -puts "Setup finished 🚀".green \ No newline at end of file +puts "Setup finished 🚀".green diff --git a/bin/setup-android b/bin/setup-android index 659c5c0..af8617e 100755 --- a/bin/setup-android +++ b/bin/setup-android @@ -1,27 +1,34 @@ #!/usr/bin/env bash -set -o +set -eo +set INSTALLED="$(brew cask list | grep -w java)" echo "== Installing android" +if [ -n "$INSTALLED" ] +then + echo -e "The wrong version of java is installed, please uninstall java: brew cask uninstall java" + exit 1 +fi + brew tap caskroom/cask brew cask install java8 brew cask install android-sdk echo "== Updating Android Packages" yes | sdkmanager --update -touch ~/.android/repositories.cfg +mkdir ~/.android || true +touch ~/.android/repositories.cfg || true yes | sdkmanager $(cat $1/../lib/android_packages) echo "== Creating virtual device" echo 'n' | avdmanager create avd -n Api26 --package "system-images;android-26;google_apis;x86_64" --force --device "Nexus 5" -echo "Add the following to your environment file: +echo 'Add the following to your environment file: -------------------------------------------- -export ANDROID_SDK_ROOT=/usr/local/share/android-sdk -export ANDROID_HOME=\$ANDROID_SDK_ROOT -export ANDROID_NDK_HOME=\$ANDROID_SDK_ROOT/ndk-bundle +export ANDROID_SDK_ROOT="/usr/local/share/android-sdk" +export PATH="$ANDROID_SDK_ROOT/platform-tools:$PATH" +export PATH="$ANDROID_SDK_ROOT/emulator:$PATH" -export PATH=\$PATH:\$ANDROID_SDK_ROOT/emulator -export PATH=\$PATH:\$ANDROID_SDK_ROOT/tools -export PATH=\$PATH:\$ANDROID_SDK_ROOT/platform-tools ---------------------------------------------" \ No newline at end of file +export ANDROID_HOME=$ANDROID_SDK_ROOT +export ANDROID_NDK_HOME="$ANDROID_SDK_ROOT/ndk-bundle" +--------------------------------------------' diff --git a/bin/setup-react-native b/bin/setup-react-native index 6257ae3..5426f89 100755 --- a/bin/setup-react-native +++ b/bin/setup-react-native @@ -1,3 +1,3 @@ #!/usr/bin/env bash -brew install watchman +brew install watchman nvm diff --git a/bin/start-dev b/bin/start-dev deleted file mode 100755 index f2129c8..0000000 --- a/bin/start-dev +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/ruby - -platform = ARGV[0] -emulator = ARGV[1] - -if !platform - puts "No platform specified. Available platforms: (ios|android)" - exit -elsif platform == 'android' && !emulator - puts "No emulator specified. Existing emulators: (avdmanager list avd)" - system "avdmanager list avd" - exit -end -begin - pid = Process.spawn "npm run storybook" - # give storybook time to grab the socket port - sleep (5) - if emulator - Process.spawn("emulator -avd #{emulator}") - sleep(5) - end - - system "react-native run-#{platform}" - system "open http://localhost:7007" - Process.wait(pid) -rescue Exception => ex - puts "================== Error, stopping dev script ========================" - puts ex -ensure - Process.kill("HUP", pid) -end \ No newline at end of file diff --git a/lib/android_packages b/lib/android_packages index c096013..6bfdb81 100644 --- a/lib/android_packages +++ b/lib/android_packages @@ -1,5 +1,5 @@ -system-images;android-26;google_apis;x86_64 -platforms;android-26 -build-tools;26.0.2 +system-images;android-28;google_apis;x86_64 +platforms;android-28 +build-tools;28.0.3 ndk-bundle -emulator \ No newline at end of file +emulator diff --git a/mobile_scripts.gemspec b/mobile_scripts.gemspec index 0ddce87..2026608 100644 --- a/mobile_scripts.gemspec +++ b/mobile_scripts.gemspec @@ -9,7 +9,6 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency 'colorize' spec.executables = [ 'clean', - 'setup', - 'start-dev' + 'setup' ] end