File tree Expand file tree Collapse file tree 4 files changed +27
-14
lines changed Expand file tree Collapse file tree 4 files changed +27
-14
lines changed Original file line number Diff line number Diff line change 36
36
" scripts/launchPackager.command" ,
37
37
" scripts/packager.sh" ,
38
38
" scripts/react-native-xcode.sh" ,
39
+ " scripts/node-binary.sh" ,
39
40
" jest-preset.js" ,
40
41
" jest" ,
41
42
" lib" ,
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # Copyright (c) Facebook, Inc. and its affiliates.
3
+ #
4
+ # This source code is licensed under the MIT license found in the
5
+ # LICENSE file in the root directory of this source tree.
6
+
7
+ [ -z " $NODE_BINARY " ] && export NODE_BINARY=" node"
8
+
9
+ nodejs_not_found ()
10
+ {
11
+ echo " error: Can't find the '$NODE_BINARY ' binary to build the React Native bundle. " \
12
+ " If you have a non-standard Node.js installation, select your project in Xcode, find " \
13
+ " 'Build Phases' - 'Bundle React Native code and images' and change NODE_BINARY to an " \
14
+ " absolute path to your node executable. You can find it by invoking 'which node' in the terminal." >&2
15
+ exit 2
16
+ }
17
+
18
+ type " $NODE_BINARY " > /dev/null 2>&1 || nodejs_not_found
Original file line number Diff line number Diff line change @@ -13,11 +13,15 @@ PROJECT_ROOT="$THIS_DIR/../../.."
13
13
# shellcheck source=/dev/null
14
14
source " ${THIS_DIR} /.packager.env"
15
15
16
+ # check and assign NODE_BINARY env
17
+ # shellcheck disable=SC1091
18
+ source " ${THIS_DIR} /node-binary.sh"
19
+
16
20
# When running react-native tests, react-native doesn't live in node_modules but in the PROJECT_ROOT
17
21
if [ ! -d " $PROJECT_ROOT /node_modules/react-native" ];
18
22
then
19
23
PROJECT_ROOT=" $THIS_DIR /.."
20
24
fi
21
25
# Start packager from PROJECT_ROOT
22
26
cd " $PROJECT_ROOT " || exit
23
- node " $REACT_NATIVE_ROOT /cli.js" start " $@ "
27
+ " $NODE_BINARY " " $REACT_NATIVE_ROOT /cli.js" start " $@ "
Original file line number Diff line number Diff line change @@ -93,7 +93,9 @@ if [[ ! -x node && -d ${HOME}/.anyenv/bin ]]; then
93
93
fi
94
94
fi
95
95
96
- [ -z " $NODE_BINARY " ] && export NODE_BINARY=" node"
96
+ # check and assign NODE_BINARY env
97
+ # shellcheck disable=SC1091
98
+ source ' ./node-binary.sh'
97
99
98
100
[ -z " $NODE_ARGS " ] && export NODE_ARGS=" "
99
101
@@ -107,18 +109,6 @@ else
107
109
CONFIG_ARG=" --config $BUNDLE_CONFIG "
108
110
fi
109
111
110
- nodejs_not_found ()
111
- {
112
- echo " error: Can't find '$NODE_BINARY ' binary to build React Native bundle" >&2
113
- echo " If you have non-standard nodejs installation, select your project in Xcode," >&2
114
- echo " find 'Build Phases' - 'Bundle React Native code and images'" >&2
115
- echo " and change NODE_BINARY to absolute path to your node executable" >&2
116
- echo " (you can find it by invoking 'which node' in the terminal)" >&2
117
- exit 2
118
- }
119
-
120
- type " $NODE_BINARY " > /dev/null 2>&1 || nodejs_not_found
121
-
122
112
BUNDLE_FILE=" $DEST /main.jsbundle"
123
113
124
114
" $NODE_BINARY " $NODE_ARGS " $CLI_PATH " $BUNDLE_COMMAND \
You can’t perform that action at this time.
0 commit comments