Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packager/react-native-xcode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,14 @@ fi
# npm global install path may be a non-standard location
PATH="$(npm prefix -g)/bin:$PATH"

react-native bundle \
# check for NPM-installed react-native-cli
if [[ -d ./node_modules/react-native-cli ]] && [ -z "$REACT_NATIVE_PATH" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the reliance on cwd here might be fragile. just a thought.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated Xcode project's build step also relies on cwd, so (I think) it's a consistent assumption:

screen shot 2016-01-19 at 7 53 00 am

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We rely on cwd inside Xcode because I don't see any other way. In react-native-xcode.sh we can actually resolve the path to local-cli/cli.js relative to packager/react-native-xcode.sh location.

REACT_NATIVE_PATH=./node_modules/.bin/react-native
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: this is a dummy binary that warns users that they have installed react-native globally (instead of react-native-cli)

fi
# fall back to global/$PATH
[ -z "$REACT_NATIVE_PATH" ] && REACT_NATIVE_PATH=react-native

$REACT_NATIVE_PATH bundle \
--entry-file index.ios.js \
--platform ios \
--dev $DEV \
Expand Down