Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 6d878bc

Browse files
authored
Automate test (#704)
* test automation * accept PR comments and update the script. * upgrade the auto script * update the script comment. * tackle all comments.
1 parent 0c2aa44 commit 6d878bc

File tree

3 files changed

+76
-7
lines changed

3 files changed

+76
-7
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,6 @@ ipch/
186186
[Dd]ebug*/
187187
[Rr]elease*/
188188
Ankh.NoLoad
189+
190+
# RN New Version App Generation
191+
Examples/testapp_rn

Examples/CodePushDemoApp/demo.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ import {
1111

1212
import CodePush from "react-native-code-push";
1313

14-
/**
15-
* Configured with a MANUAL check frequency for easy testing. For production apps, it is recommended to configure a
16-
* different check frequency, such as ON_APP_START, for a 'hands-off' approach where CodePush.sync() does not
17-
* need to be explicitly called. All options of CodePush.sync() are also available in this decorator.
18-
*/
19-
@CodePush({ checkFrequency: CodePush.CheckFrequency.MANUAL })
2014
class CodePushDemoApp extends Component {
2115
constructor() {
2216
super();
@@ -156,4 +150,13 @@ const styles = StyleSheet.create({
156150
},
157151
});
158152

159-
AppRegistry.registerComponent("CodePushDemoApp", () => CodePushDemoApp);
153+
/**
154+
* Configured with a MANUAL check frequency for easy testing. For production apps, it is recommended to configure a
155+
* different check frequency, such as ON_APP_START, for a 'hands-off' approach where CodePush.sync() does not
156+
* need to be explicitly called. All options of CodePush.sync() are also available in this decorator.
157+
*/
158+
let codePushOptions = { checkFrequency: CodePush.CheckFrequency.MANUAL };
159+
160+
CodePushDemoApp = CodePush(codePushOptions)(CodePushDemoApp);
161+
162+
AppRegistry.registerComponent("CodePushDemoApp", () => CodePushDemoApp);

Examples/generate-app.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash
2+
3+
# Copyright (c) 2015-present, Microsoft Inc.
4+
# All rights reserved.
5+
#
6+
# This source code is licensed under the BSD-style license found in the
7+
# LICENSE file in the root directory of this source tree. An additional grant
8+
# of patent rights can be found in the PATENTS file in the same directory.
9+
10+
echo 'CodePush + RN sample app generation script';
11+
echo
12+
13+
rm -rf testapp_rn
14+
15+
echo '************************ Configuration ***********************************';
16+
17+
#################### Configure versions #################################################
18+
19+
read -p "Enter React Native version (default: latest):" react_native_version
20+
read -p "Enter CodePush version (default: latest): " react_native_code_push_version
21+
22+
echo
23+
24+
if [ ! $react_native_version]; then
25+
react_native_version=`npm view react-native version`
26+
fi
27+
echo 'React Native version: ' + $react_native_version
28+
29+
if [ ! $react_native_code_push_version ]; then
30+
react_native_code_push_version=`npm view react-native-code-push version`
31+
fi
32+
echo 'React Native Code Push version: ' + $react_native_code_push_version
33+
echo
34+
35+
#################### Create app #########################################################
36+
37+
echo '********************* Creating app ***************************************';
38+
39+
current_dir=`pwd`;
40+
echo 'Current directory: ' + $current_dir;
41+
42+
echo 'Create testapp_rn app';
43+
rninit init testapp_rn --source react-native@$react_native_version
44+
45+
cd testapp_rn
46+
47+
echo 'Install React Native Code Push Version $react_native_code_push_version'
48+
npm install --save react-native-code-push@$react_native_code_push_version
49+
50+
echo 'react native link to react native code push'
51+
react-native link react-native-code-push
52+
53+
rm index.android.js
54+
rm index.ios.js
55+
cp ../CodePushDemoApp/*js .
56+
mkdir images
57+
cp ../CodePushDemoApp/images/* images
58+
59+
# Make changes required to test CodePush in debug mode (see OneNote)
60+
sed -ie '162s/AppRegistry.registerComponent("CodePushDemoApp", () => CodePushDemoApp);/AppRegistry.registerComponent("testapp_rn", () => CodePushDemoApp);/' demo.js
61+
perl -i -p0e 's/#ifdef DEBUG.*?#endif/jsCodeLocation = [CodePush bundleURL];/s' ios/testapp_rn/AppDelegate.m
62+
sed -ie '17,20d' node_modules/react-native/packager/react-native-xcode.sh
63+
sed -ie '90s/targetName.toLowerCase().contains("release")/true/' node_modules/react-native/react.gradle

0 commit comments

Comments
 (0)