[OE-core] [PATCH] npm.bbclass: introduce NPM_PXORY
liu.ming50 at gmail.com
liu.ming50 at gmail.com
Wed Jan 9 17:24:35 UTC 2019
From: Ming Liu <liu.ming50 at gmail.com>
This is needed to support building npm packages under environment with
proxy setting.
Signed-off-by: Ming Liu <liu.ming50 at gmail.com>
---
meta/classes/npm.bbclass | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass
index 6dbae6b..0f37f30 100644
--- a/meta/classes/npm.bbclass
+++ b/meta/classes/npm.bbclass
@@ -24,6 +24,9 @@ def npm_oe_arch_map(target_arch, d):
NPM_ARCH ?= "${@npm_oe_arch_map(d.getVar('TARGET_ARCH'), d)}"
NPM_INSTALL_DEV ?= "0"
+# Format: http://proxyhost:proxyport
+NPM_PROXY ?= ""
+
npm_do_compile() {
# Copy in any additionally fetched modules
if [ -d ${WORKDIR}/node_modules ] ; then
@@ -32,6 +35,13 @@ npm_do_compile() {
# changing the home directory to the working directory, the .npmrc will
# be created in this directory
export HOME=${WORKDIR}
+ if [ -n "${NPM_PROXY}" ]; then
+ npm config set proxy ${NPM_PROXY}
+ npm config set https-proxy ${NPM_PROXY}
+ else
+ npm config set proxy null
+ npm config set https-proxy null
+ fi
if [ "${NPM_INSTALL_DEV}" = "1" ]; then
npm config set dev true
else
--
2.7.4
More information about the Openembedded-core
mailing list