depot/third_party/nixpkgs/pkgs/build-support/node/fetch-yarn-deps/yarn-config-hook.sh
Default email f34ce41345 Project import generated by Copybara.
GitOrigin-RevId: b73c2221a46c13557b1b3be9c2070cc42cf01eb3
2024-07-27 08:49:29 +02:00

37 lines
989 B
Bash

yarnConfigHook(){
runHook preConfigure
echo "Executing yarnConfigHook"
# Use a constant HOME directory
mkdir -p /tmp/home
export HOME=/tmp/home
if [[ -n "$yarnOfflineCache" ]]; then
offlineCache="$yarnOfflineCache"
fi
if [[ -z "$offlineCache" ]]; then
echo yarnConfigHook: No yarnOfflineCache or offlineCache were defined\! >&2
exit 2
fi
yarn config --offline set yarn-offline-mirror "$offlineCache"
fixup-yarn-lock yarn.lock
yarn install \
--frozen-lockfile \
--force \
--production=false \
--ignore-engines \
--ignore-platform \
--ignore-scripts \
--no-progress \
--non-interactive \
--offline
# TODO: Check if this is really needed
patchShebangs node_modules
echo "finished yarnConfigHook"
runHook postConfigure
}
if [[ -z "${dontYarnInstallDeps-}" && -z "${configurePhase-}" ]]; then
configurePhase=yarnConfigHook
fi