2022-04-19 15:45:13 +00:00
|
|
|
#!/usr/bin/env bash
|
2022-02-20 17:42:50 +00:00
|
|
|
#
|
2023-08-02 18:28:16 +00:00
|
|
|
# Run "pnpm install" with flags appropriate to the environment (local
|
2023-07-19 16:57:57 +00:00
|
|
|
# development vs build system). The install is always run within the current
|
|
|
|
# directory.
|
2022-02-20 17:42:50 +00:00
|
|
|
#
|
2023-08-02 18:28:16 +00:00
|
|
|
# Usage: pnpm_install.sh [optional extra flags]
|
2022-02-20 17:42:50 +00:00
|
|
|
|
2022-09-07 16:40:17 +00:00
|
|
|
set -euo pipefail
|
2022-02-20 17:42:50 +00:00
|
|
|
|
2023-08-02 18:28:16 +00:00
|
|
|
pnpm_flags=(
|
2022-09-07 16:40:17 +00:00
|
|
|
# Do not execute install scripts
|
|
|
|
# TODO: check if build works properly with this enabled
|
|
|
|
# --ignore-scripts
|
2022-02-20 17:42:50 +00:00
|
|
|
|
2022-09-07 16:40:17 +00:00
|
|
|
# Check if existing node_modules are valid
|
|
|
|
# TODO: determine if this is necessary
|
|
|
|
# --check-files
|
|
|
|
)
|
2022-05-27 17:15:19 +00:00
|
|
|
|
2022-09-07 16:40:17 +00:00
|
|
|
if [[ -n ${CI:-} ]]; then
|
2023-08-02 18:28:16 +00:00
|
|
|
pnpm_flags+=(
|
2022-09-07 16:40:17 +00:00
|
|
|
# Install dependencies from lockfile, ensuring builds are fully
|
|
|
|
# reproducible
|
|
|
|
--frozen-lockfile
|
2023-08-02 18:28:16 +00:00
|
|
|
# Disable interactive prompts.
|
|
|
|
--reporter append-only
|
2022-05-27 17:15:19 +00:00
|
|
|
)
|
2022-09-07 16:40:17 +00:00
|
|
|
fi
|
2022-05-27 17:15:19 +00:00
|
|
|
|
2022-09-07 16:40:17 +00:00
|
|
|
# Append whatever is specified on the command line
|
2023-08-02 18:28:16 +00:00
|
|
|
pnpm_flags+=("$@")
|
2022-05-27 17:15:19 +00:00
|
|
|
|
2023-08-02 18:28:16 +00:00
|
|
|
echo "+ pnpm install ${pnpm_flags[*]}"
|
|
|
|
pnpm install "${pnpm_flags[@]}"
|