#!/bin/bash -e
# deployJs.sh
#
# Execute commands related to deploying the application Javascript bundle to App Center

bundlePath="bundle"
if [ ! -z "$BUNDLE_PATH" ]
then
    bundlePath=$BUNDLE_PATH
fi

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

NODE_MODULES_BIN="$(pwd)/node_modules/.bin"
export PATH=$NODE_MODULES_BIN:$PATH

export BUNDLE_VERSION_NAME=$(./scripts/bundleVersion.sh)

yarn clean
yarn reset
yarn setup
yarn install
./scripts/yarnInstallSharp.sh
eval "$bundlePath exec fastlane deploy"
