Skip to content

Commit

Permalink
Merge pull request #317739 from SuperSandro2000/pnpm-fetch-deps
Browse files Browse the repository at this point in the history
pnpm.fetchDeps: error if lockfile version has a mismatch
  • Loading branch information
SuperSandro2000 authored Jun 28, 2024
2 parents 3e2d4a4 + 7a1cd1f commit 31efaed
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pkgs/development/tools/pnpm/fetch-deps/default.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
lib,
stdenvNoCC,
fetchurl,
callPackage,
jq,
moreutils,
cacert,
makeSetupHook,
pnpm,
yq,
}:
{
fetchDeps =
{
src,
hash ? "",
pname,
...
Expand All @@ -36,15 +36,22 @@
name = "${pname}-pnpm-deps";

nativeBuildInputs = [
cacert
jq
moreutils
pnpm
cacert
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
Expand Down

0 comments on commit 31efaed

Please sign in to comment.