2016-01-05 16:59:43 +00:00
#! /bin/bash
JAVA_VERSION = "1.7"
RED = "\033[0;31m"
GREEN = "\033[0;32m"
BLUE = "\033[0;35m"
ENDCOLOR = "\033[0m"
error( ) {
echo -e $RED " $@ " $ENDCOLOR
exit 1
}
success( ) {
echo -e $GREEN " $@ " $ENDCOLOR
}
info( ) {
echo -e $BLUE " $@ " $ENDCOLOR
}
2016-03-24 12:30:49 +00:00
PACKAGE_VERSION = $( cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g' \
| tr -d '[[:space:]]' )
2016-01-05 16:59:43 +00:00
2016-03-24 12:30:49 +00:00
success " Preparing version $PACKAGE_VERSION "
2016-01-05 16:59:43 +00:00
2016-03-24 12:30:49 +00:00
repo_root = $( pwd )
2016-01-05 16:59:43 +00:00
2016-06-21 12:18:02 +00:00
rm -rf android
2016-03-15 16:21:50 +00:00
./gradlew :ReactAndroid:installArchives || error "Couldn't generate artifacts"
2016-01-05 16:59:43 +00:00
success "Generated artifacts for Maven"
2017-03-29 23:12:39 +00:00
npm install
success "Killing any running packagers"
lsof -i :8081 | grep LISTEN
lsof -i :8081 | grep LISTEN | /usr/bin/awk '{print $2}' | xargs kill
info "Start the packager in another terminal by running 'npm start' from the root"
info "and then press any key."
info ""
read -n 1
2017-05-06 03:50:47 +00:00
./gradlew :RNTester:android:app:installDebug || error "Couln't build RNTester Android"
2017-03-29 23:12:39 +00:00
2017-05-06 03:50:47 +00:00
info "Press any key to run RNTester in an already running Android emulator/device"
2017-03-29 23:12:39 +00:00
info ""
read -n 1
2017-05-06 03:50:47 +00:00
adb shell am start -n com.facebook.react.uiapp/.RNTesterActivity
2017-03-29 23:12:39 +00:00
info "Press any key to open the project in Xcode, then build and test manually."
info ""
read -n 1
2017-05-06 03:50:47 +00:00
open "RNTester/RNTester.xcodeproj"
2017-03-29 23:12:39 +00:00
2017-05-06 03:50:47 +00:00
info "When done testing RNTester app on iOS and Android press any key to continue."
2017-03-29 23:12:39 +00:00
info ""
read -n 1
success "Killing packager"
lsof -i :8081 | grep LISTEN
lsof -i :8081 | grep LISTEN | /usr/bin/awk '{print $2}' | xargs kill
2016-03-24 12:30:49 +00:00
npm pack
2016-01-05 16:59:43 +00:00
2016-03-24 12:30:49 +00:00
PACKAGE = $( pwd ) /react-native-$PACKAGE_VERSION .tgz
success " Package bundled ( $PACKAGE ) "
2016-01-05 16:59:43 +00:00
project_name = "RNTestProject"
cd /tmp/
rm -rf " $project_name "
2016-03-24 12:30:49 +00:00
react-native init " $project_name " --version $PACKAGE
2016-01-05 18:51:50 +00:00
2016-03-24 12:30:49 +00:00
info "Double checking the versions in package.json are correct:"
grep " \"react-native\": \".*react-native- $PACKAGE_VERSION .tgz\" " " /tmp/ ${ project_name } /package.json " || error " Incorrect version number in /tmp/ ${ project_name } /package.json "
2016-02-09 16:01:36 +00:00
grep -E "com.facebook.react:react-native:\\+" " ${ project_name } /android/app/build.gradle " || error " Dependency in /tmp/ ${ project_name } /android/app/build.gradle must be com.facebook.react:react-native:+ "
2016-01-05 16:59:43 +00:00
success " New sample project generated at /tmp/ ${ project_name } "
2016-04-18 18:30:51 +00:00
info "Test the following on Android:"
2016-03-24 13:36:09 +00:00
info " - Disable Hot Reloading. It might be enabled from last time (the setting is stored on the device)"
2016-01-05 16:59:43 +00:00
info " - Verify 'Reload JS' works"
info ""
info "Press any key to run the sample in Android emulator/device"
2016-03-24 12:30:49 +00:00
info ""
2016-01-05 16:59:43 +00:00
read -n 1
2016-03-24 12:30:49 +00:00
cd " /tmp/ ${ project_name } " && react-native run-android
2016-01-05 16:59:43 +00:00
2016-04-18 18:30:51 +00:00
info "Test the following on iOS:"
info " - Disable Hot Reloading. It might be enabled from last time (the setting is stored on the device)"
info " - Verify 'Reload JS' works"
info " - Test Chrome debugger by adding breakpoints and reloading JS. We don't have tests for Chrome debugging."
info " - Disable Chrome debugging."
2017-08-03 20:52:06 +00:00
info " - Enable Hot Reloading, change a file (index.js) and save. The UI should refresh."
2016-04-18 18:30:51 +00:00
info " - Disable Hot Reloading."
info ""
2017-02-28 06:46:00 +00:00
info "Press any key to open the project in Xcode"
2016-03-24 12:30:49 +00:00
info ""
2016-01-05 16:59:43 +00:00
read -n 1
open " /tmp/ ${ project_name } /ios/ ${ project_name } .xcodeproj "
cd " $repo_root "
info "Next steps:"
2016-03-24 12:30:49 +00:00
info " - https://github.com/facebook/react-native/blob/master/Releases.md"