coder/scripts/yarn_install.sh

38 lines
881 B
Bash
Raw Normal View History

2022-04-19 15:45:13 +00:00
#!/usr/bin/env bash
#
2023-07-19 16:57:57 +00:00
# Run "yarn install" with flags appropriate to the environment (local
# development vs build system). The install is always run within the current
# directory.
#
# Usage: yarn_install.sh [optional extra flags]
set -euo pipefail
yarn_flags=(
# Do not execute install scripts
# TODO: check if build works properly with this enabled
# --ignore-scripts
# Check if existing node_modules are valid
# TODO: determine if this is necessary
# --check-files
)
if [[ -n ${CI:-} ]]; then
yarn_flags+=(
# Install dependencies from lockfile, ensuring builds are fully
# reproducible
--frozen-lockfile
# Suppress progress information
--silent
# Disable interactive prompts for build
--non-interactive
)
fi
# Append whatever is specified on the command line
yarn_flags+=("$@")
echo "+ yarn install ${yarn_flags[*]}"
yarn install "${yarn_flags[@]}"