depot/third_party/nixpkgs/pkgs/build-support/node/fetch-yarn-deps/yarn-config-hook.sh
Default email 159e378cbb Project import generated by Copybara.
GitOrigin-RevId: c04d5652cfa9742b1d519688f65d1bbccea9eb7e
2024-09-19 17:19:46 +03:00

35 lines
918 B
Bash

yarnConfigHook(){
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"
}
if [[ -z "${dontYarnInstallDeps-}" ]]; then
postConfigureHooks+=(yarnConfigHook)
fi