buildNpmPackage: make nodejs overridable (#265171)

* buildNpmPackage: allow nodejs to be passed as argument

* Update doc/languages-frameworks/javascript.section.md

Co-authored-by: Lily Foster <lily@lily.flowers>

---------

Co-authored-by: Lily Foster <lily@lily.flowers>
This commit is contained in:
Yt 2023-11-09 16:19:24 +00:00 committed by GitHub
parent b75b355b50
commit 5aaeafbe26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -209,6 +209,7 @@ In the default `installPhase` set by `buildNpmPackage`, it uses `npm pack --json
* `npmPackFlags`: Flags to pass to `npm pack`.
* `npmPruneFlags`: Flags to pass to `npm prune`. Defaults to the value of `npmInstallFlags`.
* `makeWrapperArgs`: Flags to pass to `makeWrapper`, added to executable calling the generated `.js` with `node` as an interpreter. These scripts are defined in `package.json`.
* `nodejs`: The `nodejs` package to build against, using the corresponding `npm` shipped with that version of `node`. Defaults to `pkgs.nodejs`.
#### prefetch-npm-deps {#javascript-buildNpmPackage-prefetch-npm-deps}

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchNpmDeps, buildPackages, nodejs }:
{ lib, stdenv, fetchNpmDeps, buildPackages, nodejs } @ topLevelArgs:
{ name ? "${args.pname}-${args.version}"
, src ? null
@ -34,6 +34,7 @@
, npmPruneFlags ? npmInstallFlags
# Value for npm `--workspace` flag and directory in which the files to be installed are found.
, npmWorkspace ? null
, nodejs ? topLevelArgs.nodejs
, ...
} @ args: