Files
coder/scripts/pnpm_install.sh
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
897 B
Bash
Raw Normal View History

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