yarnBuildHook: init

This commit is contained in:
Doron Behar 2024-06-07 16:27:13 +03:00
parent a84f3ca3d8
commit 296556a320
3 changed files with 33 additions and 0 deletions

View File

@ -168,4 +168,11 @@ in
description = "Install nodejs dependencies from an offline yarn cache produced by fetchYarnDeps";
};
} ./yarn-config-hook.sh;
yarnBuildHook = makeSetupHook {
name = "yarn-build-hook";
meta = {
description = "Run yarn build in buildPhase";
};
} ./yarn-build-hook.sh;
}

View File

@ -0,0 +1,25 @@
yarnBuildHook() {
runHook preBuild
echo "Executing yarnBuildHook"
if [ -z "${yarnBuildScript-}" ]; then
yarnBuildScript="build"
fi
if ! type node > /dev/null 2>&1 ; then
echo yarnConfigHook WARNING: a node interpreter was not added to the \
build, and is probably required to run \'yarn $yarnBuildHook\'. \
A common symptom of this is getting \'command not found\' errors \
for Nodejs related tools.
fi
yarn --offline "$yarnBuildScript" \
$yarnBuildFlags "${yarnBuildFlagsArray[@]}"
echo "finished yarnBuildHook"
runHook postBuild
}
if [[ -z "${dontYarnBuild-}" && -z "${buildPhase-}" ]]; then
buildPhase=yarnBuildHook
fi

View File

@ -987,6 +987,7 @@ with pkgs;
fixup-yarn-lock
prefetch-yarn-deps
yarnConfigHook
yarnBuildHook
fetchYarnDeps;
find-cursor = callPackage ../tools/X11/find-cursor { };