Summary of the discussion started here: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl-demo/+/22077
Having a single way to build apps (containing html5, qml or whatever stuff) is a good signal to developers: "if you follow the rules and use the templates, you're good to go". Let's add some kind of support for HTML5 apps build in cmake templates.
From the Yocto POV, building a html5 app shouldn't be different from other apps either: this means that everything must be solved using autobuild scripts and should also be buildable using the standard SDK.
Also keep in mind that an app may not be only a UI, but also a UI + bindings and other data. So the proper way is probably to extend the existing cmake templates (gerrit:src/cmake-apps-module) to provide a simple way to build the webapp, i.e.: call npm install, npm run build etc. from the CMakefile, as part of a more global build process (do we use webpack or not? this is another debate - let's keep it generic first: webpack templates can be added later).
As result, we would not need to modify the Yocto class and make upstream the modification so more generic than acting on Yocto build workflow. We can also make life easier for HTML5 developers by adding the necessary stuff in cmake templates.
Additionally, webapps will be added to the app CI as well, so we better make it work like all other packages (autobuild/autobuild or at least cmake+make needs to include the npm calls).
Building nodejs-native takes ~5mn and the resulting content (populate_sysroot stuff in sstate-cache) is ~11MB. nodejs is maintained in meta-openembedded, which doesn't move very frequently for us => the cost is low for nodejs-native.