summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorBrendan Le Foll <brendan.le.foll@intel.com>2016-02-25 15:06:57 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-28 11:32:57 +0000
commit28d17cf9422ca16beb582dda4b387f0ff06949f9 (patch)
tree96703d4c4c82cb866f6e095e091799e06fadf165 /meta/classes
parentbc5a1d1684ad8627c2ffb8065460004132274607 (diff)
downloadpoky-28d17cf9422ca16beb582dda4b387f0ff06949f9.tar.gz
npm.bbclass: Add npm class to match fetcher
npm class supports the npm fetcher, helping doing the basic compile/install stages of an npm package (From OE-Core rev: 4d2ad3e39242c947612023f4429bc8fb430551b5) Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com> 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.bbclass25
1 files changed, 25 insertions, 0 deletions
diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass
new file mode 100644
index 0000000000..be76056c55
--- /dev/null
+++ b/meta/classes/npm.bbclass
@@ -0,0 +1,25 @@
1DEPENDS_prepend = "nodejs-native "
2S = "${WORKDIR}/npmpkg"
3
4npm_do_compile() {
5 # changing the home directory to the working directory, the .npmrc will
6 # be created in this directory
7 export HOME=${WORKDIR}
8 npm config set dev false
9 npm set cache ${WORKDIR}/npm_cache
10 # clear cache before every build
11 npm cache clear
12 # Install pkg into ${S} without going to the registry
13 npm --arch=${TARGET_ARCH} --production --no-registry install
14}
15
16npm_do_install() {
17 mkdir -p ${D}${libdir}/node_modules/${PN}/
18 cp -a ${S}/* ${D}${libdir}/node_modules/${PN}/ --no-preserve=ownership
19}
20
21FILES_${PN} += " \
22 ${libdir}/node_modules/${PN} \
23"
24
25EXPORT_FUNCTIONS do_compile do_install