-
Notifications
You must be signed in to change notification settings - Fork 581
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add script to install yarn dependencies
* Use frozen lockfile in build for reproducible builds * Do not install optional dependencies * Suppress interactive prompts in build
- Loading branch information
Showing
3 changed files
with
53 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/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 | ||
|
||
# Do not install optional dependencies | ||
--ignore-optional | ||
) | ||
|
||
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[@]}" |