Files
coder/scripts/yarn_install.sh
Jonathan Yu 3c04c7f3e6 chore: install optional dependencies (required for swc) (#335)
* chore: install optional dependencies (required for swc)

* Use install script in Makefile

* add trailing newline
2022-02-20 13:52:14 -06:00

40 lines
907 B
Bash
Executable File

#!/bin/bash
#
# Run "yarn install" with flags appropriate to the environment
# (local development vs build system)
#
# Usage: yarn_install.sh [optional extra flags]
set -euo pipefail
PROJECT_ROOT=$(git rev-parse --show-toplevel)
cd "$PROJECT_ROOT/site"
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[@]}"