1#!/usr/bin/env bash
2
3set -eo pipefail
4
5script_dir="$(dirname "$0")"
6
7args=("$@")
8
9# If the command is used like `yarn build plugin`, set the --build option to point to plugin/tsconfig.json
10if [ "$1" == "plugin" ]; then
11  # `--build` must be the first argument, so reset the array
12  args=()
13  args+=("--build")
14  args+=("$(pwd)/plugin")
15  # Push the rest of the arguments minus the `plugin` arg
16  args+=("${@:2}")
17fi
18
19if [[ -t 1 && (-z "$CI" && -z "$EXPO_NONINTERACTIVE") ]]; then
20  args+=("--watch")
21fi
22
23"$script_dir/expo-module-tsc" "${args[@]}"
24