Skip to content

Commit

Permalink
update react-native to v0.63.3 and all dependencies
Browse files Browse the repository at this point in the history
extract detox config from package.json
update AppDelegate.m template
temp fix for brew issues on github runners
  • Loading branch information
ruddell committed Oct 22, 2020
1 parent 83e8198 commit a96d37b
Show file tree
Hide file tree
Showing 13 changed files with 144 additions and 89 deletions.
34 changes: 34 additions & 0 deletions boilerplate/.detoxrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"configurations": {
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/<%= props.name %>.app",
"build": "xcodebuild -workspace ios/<%= props.name %>.xcworkspace -scheme <%= props.name %> -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone 11"
},
"ios.sim.release": {
"binaryPath": "ios/build/Build/Products/Release-iphonesimulator/<%= props.name %>.app",
"build": "export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/<%= props.name %>.xcworkspace -scheme <%= props.name %> -configuration Release -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone 11"
},
"android.emu.debug": {
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "cd android && ./gradlew app:assembleDebug app:assembleAndroidTest -DtestBuildType=debug",
"type": "android.emulator",
"device": {
"avdName": "Nexus_6_API_29"
}
},
"android.emu.release": {
"binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
"build": "cd android && ./gradlew app:assembleRelease app:assembleAndroidTest -DtestBuildType=release",
"type": "android.emulator",
"device": {
"avdName": "Nexus_6_API_29"
}
}
},
"test-runner": "mocha",
"runner-config": "./e2e/.mocharc.json"
}
5 changes: 5 additions & 0 deletions boilerplate/e2e/.mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"timeout": 120000,
"retries": 3,
"bail": true
}
1 change: 0 additions & 1 deletion boilerplate/e2e/mocha.opts

This file was deleted.

38 changes: 19 additions & 19 deletions boilerplate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,42 @@
"apisauce": "1.1.2",
"format-json": "1.0.3",
"identity-obj-proxy": "3.0.0",
"lodash": "4.17.15",
"lodash": "4.17.20",
"prop-types": "15.7.2",
"querystringify": "2.1.1",
"ramda": "0.27.0",
"react-native-vector-icons": "6.6.0",
"react-native-keyboard-aware-scroll-view": "0.9.1",
"react-redux": "7.2.0",
"querystringify": "2.2.0",
"ramda": "0.27.1",
"react-native-vector-icons": "7.1.0",
"react-native-keyboard-aware-scroll-view": "0.9.3",
"react-redux": "7.2.1",
"redux": "4.0.5",
"redux-persist": "6.0.0",
"redux-saga": "1.1.3",
"reduxsauce": "1.1.2",
"react-native-navigation": "6.4.0",
"reduxsauce": "1.2.0",
"react-native-navigation": "7.2.0",
"seamless-immutable": "7.1.4",
"@react-native-community/cookies": "2.0.8",
"@react-native-community/cookies": "4.0.1",
"stompjs": "2.3.3",
"sockjs-client": "1.5.0",
"net": "1.0.2",
"tcomb-form-native": "0.6.20"
},
"devDependencies": {
"@storybook/addons": "5.3.18",
"@storybook/react-native": "5.3.18",
"@storybook/theming": "5.3.18",
"@storybook/addons": "5.3.21",
"@storybook/react-native": "5.3.23",
"@storybook/theming": "5.3.21",
"babel-preset-env": "1.7.0",
"buffer": "5.6.0",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.5",
"eslint-config-prettier": "6.10.1",
"eslint-config-prettier": "6.14.0",
"eslint-plugin-prettier": "3.1.4",
"lint-staged": "10.1.3",
"react-native-app-auth": "5.1.1",
"detox": "16.2.0",
"mocha": "7.1.1",
"lint-staged": "10.4.2",
"react-native-app-auth": "6.0.0",
"detox": "17.10.2",
"mocha": "8.2.0",
"mockery": "2.1.0",
"react-dom": "16.8.6",
"prettier": "2.0.4",
"react-dom": "16.13.1",
"prettier": "2.1.2",
"reactotron-react-native": "5.0.0",
"reactotron-redux": "3.1.3",
"reactotron-redux-saga": "4.2.3",
Expand Down
35 changes: 0 additions & 35 deletions boilerplate/package.json.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -116,40 +116,5 @@
],
"preset": "react-native"
},
<%_ if (props.detox) { _%>
"detox": {
"configurations": {
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/<%= props.name %>.app",
"build": "xcodebuild -workspace ios/<%= props.name %>.xcworkspace -UseNewBuildSystem=NO -scheme <%= props.name %> -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone 11"
},
"ios.sim.release": {
"binaryPath": "ios/build/Build/Products/Release-iphonesimulator/<%= props.name %>.app",
"build": "export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/<%= props.name %>.xcworkspace -UseNewBuildSystem=NO -scheme <%= props.name %> -configuration Release -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone 11"
},
"android.emu.debug": {
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "cd android && ./gradlew app:assembleDebug app:assembleAndroidTest -DtestBuildType=debug",
"type": "android.emulator",
"device": {
"avdName": "Nexus_6_API_29"
}
},
"android.emu.release": {
"binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
"build": "cd android && ./gradlew app:assembleRelease app:assembleAndroidTest -DtestBuildType=release",
"type": "android.emulator",
"device": {
"avdName": "Nexus_6_API_29"
}
}
},
"test-runner": "mocha"
},
<%_ } _%>
"config": { }
}
1 change: 0 additions & 1 deletion boilerplate/storybook/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { getStorybookUI, configure } from '@storybook/react-native'
import { View } from 'react-native'
import AsyncStorage from '@react-native-community/async-storage';
import './rn-addons'

// import stories
configure(() => {
Expand Down
Empty file removed boilerplate/storybook/rn-addons.js
Empty file.
4 changes: 4 additions & 0 deletions src/boilerplate/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ project(':detox').projectDir = new File(rootProject.projectDir, '../node_modules
},
]

if (props.detox) {
templates.push({ template: '.detoxrc.json', target: '.detoxrc.json' })
}

await copyBatch(context, templates, props, {
quiet: true,
directory: `${__dirname}/../../boilerplate`,
Expand Down
58 changes: 39 additions & 19 deletions src/lib/react-native-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const patchReactNativeNavigation = async (context = {}, props) => {
})

await updateIosFiles(context, props)
await updateAndroidFiles(context)
await updateAndroidFiles(context, props)
spinner.succeed('set up react-native-navigation for iOS/Android')
}
const updateIosFiles = async (context, props) => {
Expand All @@ -58,29 +58,49 @@ const updateIosFiles = async (context, props) => {
</array>`,
})
/* eslint-enable */
}

const updateAndroidFiles = async (context) => {
// settings.gradle
// build.gradle
await patchInFile(context, `${process.cwd()}/android/build.gradle`, {
before: `mavenLocal()`,
insert: ` google()
mavenCentral()
maven { url 'https://jitpack.io' }`,
await patchInFile(context, `${process.cwd()}/ios/Podfile`, {
replace: `platform :ios, '10.0'`,
insert: `platform :ios, '11.0'`,
})

await patchInFile(context, `${process.cwd()}/android/build.gradle`, {
replace: `classpath("com.android.tools.build:gradle:3.4.2")`,
insert: `classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61"
classpath 'com.android.tools.build:gradle:3.5.3'`,
// fix pod versions
await patchInFile(context, `${process.cwd()}/ios/Podfile`, {
before: `flipper_post_install`,
insert: ` installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
end
end
`,
})

for (let i = 0; i < 4; i++) {
// align IPHONEOS_DEPLOYMENT_TARGET
await patchInFile(context, `${process.cwd()}/ios/${props.name}.xcodeproj/project.pbxproj`, {
replace: `IPHONEOS_DEPLOYMENT_TARGET = 10.0;`,
insert: `IPHONEOS_DEPLOYMENT_TARGET = 11.0;`,
force: true
})
}


// disable flipper
await patchInFile(context, `${process.cwd()}/ios/Podfile`, {
replace: `use_flipper!`,
insert: `# use_flipper!`,
})
await patchInFile(context, `${process.cwd()}/ios/Podfile`, {
replace: `flipper_post_install`,
insert: `# flipper_post_install`,
})
}

const updateAndroidFiles = async (context) => {
// settings.gradle
await patchInFile(context, `${process.cwd()}/android/build.gradle`, {
after: `repositories {`,
insert: ` google()
mavenLocal()
mavenCentral()`,
after: `dependencies {`,
insert: ` classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$RNNKotlinVersion")"`,
})

await patchInFile(context, `${process.cwd()}/android/build.gradle`, {
Expand All @@ -90,7 +110,7 @@ const updateAndroidFiles = async (context) => {

await patchInFile(context, `${process.cwd()}/android/build.gradle`, {
after: ` ext {`,
insert: ` RNNKotlinVersion = "1.3.61"\n RNNKotlinStdlib = "kotlin-stdlib-jdk8"`,
insert: ` RNNKotlinVersion = "1.3.61"`,
})

await patchInFile(context, `${process.cwd()}/android/app/build.gradle`, {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/react-native-version.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { pathOr, is } = require('ramda')

// the default React Native version for this boilerplate
const REACT_NATIVE_VERSION = '0.61.5'
const REACT_NATIVE_VERSION = '0.63.3'
// https://github.com/react-native-community/react-native-releases/blob/master/CHANGELOG.md

// where the version lives under gluegun
Expand Down
44 changes: 36 additions & 8 deletions templates/react-native-navigation/AppDelegate.m.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,55 @@
*/

#import "AppDelegate.h"
#import <ReactNativeNavigation/ReactNativeNavigation.h>

#import <React/RCTBridge.h>
#import <React/RCTLinkingManager.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <ReactNativeNavigation/ReactNativeNavigation.h>

@implementation AppDelegate
#ifdef FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>

static void InitializeFlipper(UIApplication *application) {
FlipperClient *client = [FlipperClient sharedClient];
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
[client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
[client addPlugin:[FlipperKitReactPlugin new]];
[client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
[client start];
}
#endif

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation;

jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

[ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];
#ifdef FB_SONARKIT_ENABLED
InitializeFlipper(application);
#endif

[ReactNativeNavigation bootstrapWithDelegate:self launchOptions:launchOptions];
return YES;
}

- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge {
return [ReactNativeNavigation extraModulesForBridge:bridge];
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler
{
Expand Down
6 changes: 6 additions & 0 deletions test/scripts/install-detox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
set -e

if [ "$PLATFORM" = "ios" ]; then
# remove the workaround when fixed: https://github.com/actions/virtual-environments/issues/1811
brew uninstall [email protected]
brew uninstall [email protected]
brew untap local/openssl
brew untap local/python2

brew update
brew tap wix/brew
brew install applesimutils
Expand Down
5 changes: 0 additions & 5 deletions test/scripts/start-android-emulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,4 @@ echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd -n Nexus_6_API_29 -k '

nohup $ANDROID_HOME/emulator/emulator -avd Nexus_6_API_29 -no-snapshot -memory 3072 > /dev/null 2>&1 & $ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82'

# disable animations
$ANDROID_HOME/platform-tools/adb shell settings put global window_animation_scale 0.0
$ANDROID_HOME/platform-tools/adb shell settings put global transition_animation_scale 0.0
$ANDROID_HOME/platform-tools/adb shell settings put global animator_duration_scale 0.0

echo "Emulator started"

0 comments on commit a96d37b

Please sign in to comment.