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
10# plugin/tsconfig.json
11if [ "$1" == "plugin" ]; then
12  # `--build` must be the first argument, so reset the array
13  args=()
14  args+=("--build")
15  args+=("$(pwd)/plugin")
16  # Push the rest of the arguments minus the `plugin` arg
17  args+=("${@:2}")
18fi
19
20if [[ -t 1 && (-z "$CI" && -z "$EXPO_NONINTERACTIVE") ]]; then
21  args+=("--watch")
22fi
23
24"$script_dir/expo-module-tsc" "${args[@]}"
25