summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorDoron Behar <doron.behar@gmail.com>2023-10-02 17:08:40 +0300
committerDoron Behar <doron.behar@gmail.com>2023-10-07 14:09:05 +0300
commitd6521ce1868450a6b3fd6840a391cb213d3d9631 (patch)
treef59b44541a789b4ec6cda4488671a291429ef333 /doc
parent384b1e5b91172cd9a031745266779389f6e31e02 (diff)
downloadnixpkgs-d6521ce1868450a6b3fd6840a391cb213d3d9631.tar
nixpkgs-d6521ce1868450a6b3fd6840a391cb213d3d9631.tar.gz
nixpkgs-d6521ce1868450a6b3fd6840a391cb213d3d9631.tar.bz2
nixpkgs-d6521ce1868450a6b3fd6840a391cb213d3d9631.tar.lz
nixpkgs-d6521ce1868450a6b3fd6840a391cb213d3d9631.tar.xz
nixpkgs-d6521ce1868450a6b3fd6840a391cb213d3d9631.tar.zst
nixpkgs-d6521ce1868450a6b3fd6840a391cb213d3d9631.zip
docs/javascript/buildNpmPackage: Document fetchNpmDeps
Co-authored-by: Lily Foster <lily@lily.flowers>
Diffstat (limited to 'doc')
-rw-r--r--doc/languages-frameworks/javascript.section.md11
1 files changed, 10 insertions, 1 deletions
diff --git a/doc/languages-frameworks/javascript.section.md b/doc/languages-frameworks/javascript.section.md
index 861db3679de..291629e3a71 100644
--- a/doc/languages-frameworks/javascript.section.md
+++ b/doc/languages-frameworks/javascript.section.md
@@ -211,7 +211,7 @@ In the default `installPhase` set by `buildNpmPackage`, it uses `npm pack --json
 
 #### prefetch-npm-deps {#javascript-buildNpmPackage-prefetch-npm-deps}
 
-`prefetch-npm-deps` can calculate the hash of the dependencies of an npm project ahead of time.
+`prefetch-npm-deps` is a Nixpkgs package that calculates the hash of the dependencies of an npm project ahead of time.
 
 ```console
 $ ls
@@ -221,6 +221,15 @@ $ prefetch-npm-deps package-lock.json
 sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
 ```
 
+#### fetchNpmDeps {#javascript-buildNpmPackage-fetchNpmDeps}
+
+`fetchNpmDeps` is a Nix function that requires the following mandatory arguments:
+
+- `src`: A directory / tarball with `package-lock.json` file
+- `hash`: The output hash of the node dependencies defined in `package-lock.json`.
+
+It returns a derivation with all `package-lock.json` dependencies downloaded into `$out/`, usable as an npm cache.
+
 ### 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`.