diff options
author | Anders Darander <anders@chargestorm.se> | 2017-03-13 11:01:53 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-22 11:35:20 +0000 |
commit | b1f10b18eaf6c8009e86863ca4a26f429de97082 (patch) | |
tree | ff8ee86cf09ff0e9ad1f66d62b3a18a1c4208e89 /meta/classes | |
parent | 6fa0fda1165f05adc9d971a8c873dbbd4ba18d6a (diff) | |
download | poky-b1f10b18eaf6c8009e86863ca4a26f429de97082.tar.gz |
classes/npm: allow installation of devDependencies
Often, eg when using angular2, there's a need to install also
the devDependencies.
The default is to keep the old behaviour, to not install
devDependencies.
(From OE-Core rev: 9377d16751aeff0a913e754d711bca6e4e4d9df1)
Signed-off-by: Anders Darander <anders@chargestorm.se>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/npm.bbclass | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass index c5380405af..a69bedbb28 100644 --- a/meta/classes/npm.bbclass +++ b/meta/classes/npm.bbclass | |||
@@ -14,6 +14,7 @@ def npm_oe_arch_map(target_arch, d): | |||
14 | return target_arch | 14 | return target_arch |
15 | 15 | ||
16 | NPM_ARCH ?= "${@npm_oe_arch_map(d.getVar('TARGET_ARCH'), d)}" | 16 | NPM_ARCH ?= "${@npm_oe_arch_map(d.getVar('TARGET_ARCH'), d)}" |
17 | NPM_INSTALL_DEV = "0" | ||
17 | 18 | ||
18 | npm_do_compile() { | 19 | npm_do_compile() { |
19 | # Copy in any additionally fetched modules | 20 | # Copy in any additionally fetched modules |
@@ -23,12 +24,20 @@ npm_do_compile() { | |||
23 | # changing the home directory to the working directory, the .npmrc will | 24 | # changing the home directory to the working directory, the .npmrc will |
24 | # be created in this directory | 25 | # be created in this directory |
25 | export HOME=${WORKDIR} | 26 | export HOME=${WORKDIR} |
26 | npm config set dev false | 27 | if [ "${NPM_INSTALL_DEV}" = "1" ]; then |
28 | npm config set dev true | ||
29 | else | ||
30 | npm config set dev false | ||
31 | fi | ||
27 | npm set cache ${WORKDIR}/npm_cache | 32 | npm set cache ${WORKDIR}/npm_cache |
28 | # clear cache before every build | 33 | # clear cache before every build |
29 | npm cache clear | 34 | npm cache clear |
30 | # Install pkg into ${S} without going to the registry | 35 | # Install pkg into ${S} without going to the registry |
31 | npm --arch=${NPM_ARCH} --target_arch=${NPM_ARCH} --production --no-registry install | 36 | if [ "${NPM_INSTALL_DEV}" = "1" ]; then |
37 | npm --arch=${NPM_ARCH} --target_arch=${NPM_ARCH} --no-registry install | ||
38 | else | ||
39 | npm --arch=${NPM_ARCH} --target_arch=${NPM_ARCH} --production --no-registry install | ||
40 | fi | ||
32 | } | 41 | } |
33 | 42 | ||
34 | npm_do_install() { | 43 | npm_do_install() { |