about summary refs log tree commit diff
path: root/pkgs/build-support/node/fetch-yarn-deps/yarn-build-hook.sh
blob: 947aa1736b6f7798107ef809e6bde2ef3f3e4664 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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

    echo "finished yarnBuildHook"
    runHook postBuild
}

if [[ -z "${dontYarnBuild-}" && -z "${buildPhase-}" ]]; then
    buildPhase=yarnBuildHook
fi