imyller / meta-nodejs

OpenEmbedded layer for latest Node.js releases
MIT License
79 stars 87 forks source link

Add support for bower package manager #18

Closed geomatsi closed 8 years ago

geomatsi commented 8 years ago

Hi,

This commit integrates bower support into meta-nodejs. Let me know if it is of any interest. Any comments/suggestions are welcome !


Bower is a package manager for front-end dependencies: see http://bower.io

Suppose a software package has some front-end dependencies which are described in file bower.json. In this case the recipe can auto-install all those dependencies during yocto build by inheriting bower-install class.

Note that front-end dependencies are auto-installed into build directory. They have to be explicitely copied into target image in do_install or do_install_append.

Here is a simple example of web app recipe with nodejs and bower dependencies:


SUMMARY = "simple web app with js deps described in bower.json" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"

SRCREV = "${AUTOREV}"

PR = "r0" PV = "0.0.1+git${SRCPV}"

SRC_URI = "git://path/to/git/repo/test.git;branch=master;protocol=ssh"

inherit npm-install bower-install

S = "${WORKDIR}/git"

do_install () { install -d ${D}/www/test install -d ${D}/www/test/public

install -m 0644 ${S}/simple.node.js ${D}/www/test/simple.node.js
install -m 0644 ${S}/public/index.html ${D}/www/simple/public/index.html

cp -r ${S}/node_modules ${D}/www/test/
cp -r ${S}/public/bower_components ${D}/www/test/public/

}

Signed-off-by: Sergey Matyukevich geomatsi@gmail.com

bachp commented 8 years ago

From my point of view it makes sense to have it in here.

imyller commented 8 years ago

I've merged bower and updated to 1.7.7.

@geomatsi I'd be happy to receive PR for README.md docs for bower and bower-install classes.

geomatsi commented 8 years ago

Ok, I will rebase on top of your changes, double-check my builds and then submit PR with docs.