Skip to content

Commit

Permalink
buildNpmPackage: allow passing npmDeps
Browse files Browse the repository at this point in the history
  • Loading branch information
happysalada authored and Yt committed Nov 16, 2023
1 parent 54f0057 commit 7fb4906
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions doc/languages-frameworks/javascript.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ In the default `installPhase` set by `buildNpmPackage`, it uses `npm pack --json
* `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`.
* `npmDeps`: The dependencies used to build the npm package. Especially useful to not have to recompute workspace depedencies.

#### prefetch-npm-deps {#javascript-buildNpmPackage-prefetch-npm-deps}

Expand Down
11 changes: 5 additions & 6 deletions pkgs/build-support/node/build-npm-package/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,15 @@
# Value for npm `--workspace` flag and directory in which the files to be installed are found.
, npmWorkspace ? null
, nodejs ? topLevelArgs.nodejs
, npmDeps ? fetchNpmDeps {
inherit forceGitDeps src srcs sourceRoot prePatch patches postPatch;
name = "${name}-npm-deps";
hash = npmDepsHash;
}
, ...
} @ args:

let
npmDeps = fetchNpmDeps {
inherit forceGitDeps src srcs sourceRoot prePatch patches postPatch;
name = "${name}-npm-deps";
hash = npmDepsHash;
};

# .override {} negates splicing, so we need to use buildPackages explicitly
npmHooks = buildPackages.npmHooks.override {
inherit nodejs;
Expand Down

0 comments on commit 7fb4906

Please sign in to comment.