13a15479dSJames Ide#!/usr/bin/env bash
23a15479dSJames Ide
33a15479dSJames Ideset -eo pipefail
43a15479dSJames Ide
53a15479dSJames Idescript_dir="$(dirname "$0")"
63a15479dSJames Ide
73a15479dSJames Ideargs=("$@")
8ec4c554eSEvan Bacon
9*a9e9eb76SJames Ide# If the command is used like `yarn build plugin`, set the --build option to point to
10*a9e9eb76SJames Ide# plugin/tsconfig.json
11ec4c554eSEvan Baconif [ "$1" == "plugin" ]; then
12ec4c554eSEvan Bacon  # `--build` must be the first argument, so reset the array
13ec4c554eSEvan Bacon  args=()
14ec4c554eSEvan Bacon  args+=("--build")
15ec4c554eSEvan Bacon  args+=("$(pwd)/plugin")
16ec4c554eSEvan Bacon  # Push the rest of the arguments minus the `plugin` arg
17ec4c554eSEvan Bacon  args+=("${@:2}")
18ec4c554eSEvan Baconfi
19ec4c554eSEvan Bacon
203a15479dSJames Ideif [[ -t 1 && (-z "$CI" && -z "$EXPO_NONINTERACTIVE") ]]; then
213a15479dSJames Ide  args+=("--watch")
223a15479dSJames Idefi
233a15479dSJames Ide
243a15479dSJames Ide"$script_dir/expo-module-tsc" "${args[@]}"
25