summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
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