Merge pull request #244646 from wmertens/corepack-wrappers

nodejs: corepack wrappers package
This commit is contained in:
Wout Mertens 2023-09-20 21:00:37 +02:00 committed by GitHub
commit e99603603d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 13 deletions

View File

@ -217,6 +217,10 @@ $ prefetch-npm-deps package-lock.json
sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
```
### corepack {#javascript-corepack}
This package puts the corepack wrappers for pnpm and yarn in your PATH, and they will honor the `packageManager` setting in the `package.json`.
### node2nix {#javascript-node2nix}
#### Preparation {#javascript-node2nix-preparation}

View File

@ -0,0 +1,26 @@
{ lib, stdenv, nodejs }:
stdenv.mkDerivation {
pname = "corepack-nodejs";
inherit (nodejs) version;
nativeBuildInputs = [ nodejs ];
dontUnpack = true;
installPhase = ''
mkdir -p $out/bin
corepack enable --install-directory $out/bin
# Enabling npm caused some crashes - leaving out for now
# corepack enable --install-directory $out/bin npm
'';
meta = {
description = "Wrappers for npm, pnpm and Yarn via Node.js Corepack";
homepage = "https://nodejs.org/api/corepack.html";
changelog = "https://github.com/nodejs/node/releases/tag/v${nodejs.version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ wmertens ];
platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
}

View File

@ -10236,31 +10236,30 @@ with pkgs;
nodenv = callPackage ../development/tools/nodenv { };
nodejs = hiPrio nodejs_18;
nodejs-slim = nodejs-slim_18;
corepack = hiPrio corepack_18;
nodejs_14 = callPackage ../development/web/nodejs/v14.nix {
openssl = openssl_1_1;
};
nodejs_14 = callPackage ../development/web/nodejs/v14.nix { openssl = openssl_1_1; };
nodejs-slim_14 = callPackage ../development/web/nodejs/v14.nix {
openssl = openssl_1_1;
enableNpm = false;
};
nodejs_16 = callPackage ../development/web/nodejs/v16.nix { };
nodejs-slim_16 = callPackage ../development/web/nodejs/v16.nix {
enableNpm = false;
};
nodejs-slim_16 = callPackage ../development/web/nodejs/v16.nix { enableNpm = false; };
nodejs_18 = callPackage ../development/web/nodejs/v18.nix { };
nodejs-slim_18 = callPackage ../development/web/nodejs/v18.nix {
enableNpm = false;
};
nodejs-slim_18 = callPackage ../development/web/nodejs/v18.nix { enableNpm = false; };
corepack_18 = hiPrio (callPackage ../development/web/nodejs/corepack.nix { nodejs = nodejs_18; });
nodejs_20 = callPackage ../development/web/nodejs/v20.nix { };
nodejs-slim_20 = callPackage ../development/web/nodejs/v20.nix {
enableNpm = false;
};
nodejs-slim_20 = callPackage ../development/web/nodejs/v20.nix { enableNpm = false; };
corepack_20 = hiPrio (callPackage ../development/web/nodejs/corepack.nix { nodejs = nodejs_20; });
# Update this when adding the newest nodejs major version!
nodejs_latest = nodejs_20;
nodejs-slim_latest = nodejs-slim_20;
corepack_latest = hiPrio corepack_20;
buildNpmPackage = callPackage ../build-support/node/build-npm-package { };