nodejs: enable dev deps by default

This commit is contained in:
DavHau 2021-11-01 11:46:38 +07:00
parent 6850db9cc4
commit 2fd7782af4
3 changed files with 10 additions and 6 deletions

View File

@ -227,6 +227,7 @@ let
# - adds executables of direct node dependencies to PATH # - adds executables of direct node dependencies to PATH
# - adds the current node module to NODE_PATH # - adds the current node module to NODE_PATH
# - sets HOME=$TMPDIR, as this is required by some npm scripts # - sets HOME=$TMPDIR, as this is required by some npm scripts
# TODO: don't install dev dependencies. Load into NODE_PATH instead
d2nInstallDependenciesPhase = '' d2nInstallDependenciesPhase = ''
# symlink dependency packages into node_modules # symlink dependency packages into node_modules
for dep in $(cat $nodeDepsPath); do for dep in $(cat $nodeDepsPath); do

View File

@ -14,7 +14,7 @@
inputDirectories, inputDirectories,
inputFiles, inputFiles,
dev, noDev,
nodejs, nodejs,
... ...
}@args: }@args:
@ -22,6 +22,8 @@
b = builtins; b = builtins;
dev = ! noDev;
packageLock = packageLock =
if inputDirectories != [] then if inputDirectories != [] then
"${lib.elemAt inputDirectories 0}/package-lock.json" "${lib.elemAt inputDirectories 0}/package-lock.json"
@ -141,8 +143,8 @@
extraArgs = { extraArgs = {
dev = { noDev = {
description = "include dependencies for development"; description = "Whether to exclude development dependencies";
type = "flag"; type = "flag";
}; };

View File

@ -15,7 +15,7 @@
# extraArgs # extraArgs
name, name,
dev, noDev,
optional, optional,
peer, peer,
... ...
@ -23,6 +23,7 @@
let let
b = builtins; b = builtins;
dev = ! noDev;
yarnLock = utils.readTextFile "${lib.elemAt inputDirectories 0}/yarn.lock"; yarnLock = utils.readTextFile "${lib.elemAt inputDirectories 0}/yarn.lock";
packageJSON = b.fromJSON (b.readFile "${lib.elemAt inputDirectories 0}/package.json"); packageJSON = b.fromJSON (b.readFile "${lib.elemAt inputDirectories 0}/package.json");
parser = import ../yarn-lock/parser.nix { inherit lib; inherit (externals) nix-parsec;}; parser = import ../yarn-lock/parser.nix { inherit lib; inherit (externals) nix-parsec;};
@ -225,8 +226,8 @@
type = "argument"; type = "argument";
}; };
dev = { noDev = {
description = "Whether to include development dependencies"; description = "Whether to exclude development dependencies";
type = "flag"; type = "flag";
}; };