#!/bin/bash -e
# postinstall.sh
#
# Scripts that must be run after Javascript dependencies have been installed (e.g., Cocoapods install)

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

./node_modules/.bin/patch-package
# Install Cocoapods dependencies
if [[ "$OSTYPE" == "darwin"* ]]; then
    cd ios
    if ! eval "$bundlePath exec pod repo update"; then
        echo "Warning: 'pod repo update' failed; continuing with existing CocoaPods specs." >&2
    fi
    RCT_NEW_ARCH_ENABLED=0 eval "$bundlePath exec pod install"
    cd ..
fi
yarn create:autogenerated:env
