2024-06-20 14:57:18 +00:00
|
|
|
# shellcheck shell=bash
|
|
|
|
|
|
|
|
pnpmConfigHook() {
|
|
|
|
echo "Executing pnpmConfigHook"
|
|
|
|
|
|
|
|
if [ -n "${pnpmRoot-}" ]; then
|
|
|
|
pushd "$pnpmRoot"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "${pnpmDeps-}" ]; then
|
|
|
|
echo "Error: 'pnpmDeps' must be set when using pnpmConfigHook."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Configuring pnpm store"
|
|
|
|
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
export STORE_PATH=$(mktemp -d)
|
|
|
|
|
|
|
|
cp -Tr "$pnpmDeps" "$STORE_PATH"
|
|
|
|
chmod -R +w "$STORE_PATH"
|
|
|
|
|
|
|
|
pnpm config set store-dir "$STORE_PATH"
|
|
|
|
|
|
|
|
echo "Installing dependencies"
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
if [[ -n "$pnpmWorkspace" ]]; then
|
|
|
|
pnpmInstallFlags+=("--filter=$pnpmWorkspace")
|
|
|
|
fi
|
|
|
|
runHook prePnpmInstall
|
|
|
|
|
|
|
|
pnpm install \
|
|
|
|
--offline \
|
|
|
|
--ignore-scripts \
|
|
|
|
"${pnpmInstallFlags[@]}" \
|
|
|
|
--frozen-lockfile
|
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
|
|
|
|
echo "Patching scripts"
|
|
|
|
|
|
|
|
patchShebangs node_modules/{*,.*}
|
|
|
|
|
|
|
|
if [ -n "${pnpmRoot-}" ]; then
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Finished pnpmConfigHook"
|
|
|
|
}
|
|
|
|
|
|
|
|
postConfigureHooks+=(pnpmConfigHook)
|