diff options
author | Doron Behar <doron.behar@gmail.com> | 2023-10-02 17:07:31 +0300 |
---|---|---|
committer | Doron Behar <doron.behar@gmail.com> | 2023-10-07 14:09:05 +0300 |
commit | 384b1e5b91172cd9a031745266779389f6e31e02 (patch) | |
tree | 79297b04320b959dd17bb22bc4ffa1d37db21992 /doc | |
parent | feb1cfa3a827902be46ff85bfae5d7647716fe28 (diff) |
docs/javascript/buildNpmPackage: Document bin, man and npm pack behavior
Diffstat (limited to 'doc')
-rw-r--r-- | doc/languages-frameworks/javascript.section.md | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/doc/languages-frameworks/javascript.section.md b/doc/languages-frameworks/javascript.section.md index fb1dd898c8a20..861db3679deec 100644 --- a/doc/languages-frameworks/javascript.section.md +++ b/doc/languages-frameworks/javascript.section.md @@ -161,6 +161,8 @@ git config --global url."https://github.com/".insteadOf git://github.com/ `buildNpmPackage` allows you to package npm-based projects in Nixpkgs without the use of an auto-generated dependencies file (as used in [node2nix](#javascript-node2nix)). It works by utilizing npm's cache functionality -- creating a reproducible cache that contains the dependencies of a project, and pointing npm to it. +Here's an example: + ```nix { lib, buildNpmPackage, fetchFromGitHub }: @@ -191,6 +193,8 @@ buildNpmPackage rec { } ``` +In the default `installPhase` set by `buildNpmPackage`, it uses `npm pack --json --dry-run` to decide what files to install in `$out/lib/node_modules/$name/`, where `$name` is the `name` string defined in the package's `package.json`. Additionally, the `bin` and `man` keys in the source's `package.json` are used to decide what binaries and manpages are supposed to be installed. If these are not defined, `npm pack` may miss some files, and no binaries will be produced. + #### Arguments {#javascript-buildNpmPackage-arguments} * `npmDepsHash`: The output hash of the dependencies for this project. Can be calculated in advance with [`prefetch-npm-deps`](#javascript-buildNpmPackage-prefetch-npm-deps). |