tests/pnpm: add test for pnpm 12

(cherry picked from commit feccedc4bf)
This commit is contained in:
Gutyina Gergő
2026-09-11 13:16:43 +02:00
committed by Diogo Correia
parent 05b188e5e9
commit 39bd700221
7 changed files with 136 additions and 0 deletions

View File

@@ -5,4 +5,5 @@
pnpm-workspaces = lib.recurseIntoAttrs (callPackage ./pnpm-workspaces { });
pnpm_11_v3 = callPackage ./pnpm_11_v3 { };
pnpm_11_v4 = callPackage ./pnpm_11_v4 { };
pnpm_12_v4 = callPackage ./pnpm_12_v4 { };
}

View File

@@ -0,0 +1,60 @@
{
fetchPnpmDeps,
lib,
makeShellWrapper,
nodejs-slim,
pnpmConfigHook,
pnpm_12,
stdenv,
testers,
}:
let
pnpm = pnpm_12;
in
stdenv.mkDerivation (finalAttrs: {
pname = "pnpm-test";
inherit (pnpm) version;
src = ./src;
pnpmDeps = testers.invalidateFetcherByDrvHash fetchPnpmDeps {
inherit (finalAttrs) pname version src;
inherit pnpm;
fetcherVersion = 4;
hash = "sha256-NDGKyqZasK13YkmNQ1ypP14rCP8wp2llT8bnKUi4/zo=";
};
nativeBuildInputs = [
makeShellWrapper
nodejs-slim
pnpm
pnpmConfigHook
];
buildPhase = ''
runHook preBuild
pnpm build
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -Dm644 -t $out/lib/pnpm-12-test dist/index.js
makeWrapper ${lib.getExe nodejs-slim} $out/bin/pnpm-12-test \
--add-flags "$out/lib/pnpm-12-test"
runHook postInstall
'';
__structuredAttrs = true;
meta = {
license = lib.licenses.mit;
mainProgram = "pnpm-12-test";
inherit (pnpm.meta) maintainers;
};
})

View File

@@ -0,0 +1,2 @@
dist/
node_modules/

View File

@@ -0,0 +1 @@
console.log("Hello World");

View File

@@ -0,0 +1,20 @@
{
"name": "pnpm12test",
"version": "1.0.0",
"description": "",
"main": "dist/index.js",
"scripts": {
"build": "tsc",
"start": "node dist/index.js"
},
"license": "MIT",
"packageManager": "pnpm",
"type": "module",
"files": [
"dist/"
],
"devDependencies": {
"@types/node": "^25.5.0",
"typescript": "^6.0.2"
}
}

View File

@@ -0,0 +1,39 @@
lockfileVersion: '9.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
importers:
.:
devDependencies:
'@types/node':
specifier: ^25.5.0
version: 25.9.6
typescript:
specifier: ^6.0.2
version: 6.0.3
packages:
'@types/node@25.9.6':
resolution: {integrity: sha512-JR6Q/PV5DKFvjrGFVqQJdeG0qvsqQQLDa3TzFrqVwhqRXqwNaxPo2KYCtCQXpOdIulCouKwT7a6in9nFthBAzw==}
typescript@6.0.3:
resolution: {integrity: sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==}
engines: {node: '>=14.17'}
hasBin: true
undici-types@7.24.6:
resolution: {integrity: sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==}
snapshots:
'@types/node@25.9.6':
dependencies:
undici-types: 7.24.6
typescript@6.0.3: {}
undici-types@7.24.6: {}

View File

@@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "dist",
"rootDir": ".",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}
}