pnpm.fetchDeps: error if lockfile version has a mismatch

This commit is contained in:
Sandro Jäckel
2024-06-25 15:28:26 +02:00
parent 49d9ddaa0f
commit 7a1cd1fcf1
@@ -1,4 +1,5 @@
{
lib,
stdenvNoCC,
callPackage,
jq,
@@ -6,6 +7,7 @@
cacert,
makeSetupHook,
pnpm,
yq,
}:
{
fetchDeps =
@@ -38,11 +40,18 @@
jq
moreutils
pnpm
yq
];
installPhase = ''
runHook preInstall
lockfileVersion="$(yq -r .lockfileVersion pnpm-lock.yaml)"
if [[ ''${lockfileVersion:0:1} -gt ${lib.versions.major pnpm.version} ]]; then
echo "ERROR: lockfileVersion $lockfileVersion in pnpm-lock.yaml is too new for the provided pnpm version ${lib.versions.major pnpm.version}!"
exit 1
fi
export HOME=$(mktemp -d)
pnpm config set store-dir $out
# Some packages produce platform dependent outputs. We do not want to cache those in the global store