2015-10-22 01:42:08 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This source code is licensed under the BSD-style license found in the
|
|
|
|
# LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
# of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
|
|
|
|
# Bundle React Native app's code and image assets.
|
|
|
|
# This script is supposed to be invoked as part of Xcode build process
|
|
|
|
# and relies on envoronment variables (including PWD) set by Xcode
|
|
|
|
|
|
|
|
case "$CONFIGURATION" in
|
|
|
|
Debug)
|
|
|
|
DEV=true
|
|
|
|
;;
|
|
|
|
"")
|
|
|
|
echo "$0 must be invoked by Xcode"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*)
|
2015-12-09 12:39:36 +00:00
|
|
|
DEV=false
|
2015-10-22 01:42:08 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Xcode project file for React Native apps is located in ios/ subfolder
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
set -x
|
|
|
|
DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH
|
|
|
|
|
2015-11-10 00:41:23 +00:00
|
|
|
# Define NVM_DIR and source the nvm.sh setup script
|
|
|
|
[ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm"
|
|
|
|
|
|
|
|
if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
|
|
|
|
. "$HOME/.nvm/nvm.sh"
|
|
|
|
elif [[ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/nvm.sh" ]]; then
|
|
|
|
. "$(brew --prefix nvm)/nvm.sh"
|
|
|
|
fi
|
|
|
|
|
2015-12-17 22:09:40 +00:00
|
|
|
# Set up the nodenv node version manager if present
|
|
|
|
if [[ -x "$HOME/.nodenv/bin/nodenv" ]]; then
|
|
|
|
eval "$($HOME/.nodenv/bin/nodenv init -)"
|
|
|
|
fi
|
|
|
|
|
2016-01-06 19:02:35 +00:00
|
|
|
# npm global install path may be a non-standard location
|
|
|
|
PATH="$(npm prefix -g)/bin:$PATH"
|
|
|
|
|
2015-10-22 01:42:08 +00:00
|
|
|
react-native bundle \
|
|
|
|
--entry-file index.ios.js \
|
|
|
|
--platform ios \
|
|
|
|
--dev $DEV \
|
|
|
|
--bundle-output "$DEST/main.jsbundle" \
|
|
|
|
--assets-dest "$DEST"
|