npm and nodejs packages - victronenergy/venus GitHub Wiki
This page contains various details on how the Venus OS build system handles npm and nodejs recipes, and especially the shrinkwrap file.
Everything described here applies to all recipes using the npm-online-install.bbclass. At this moment, these are:
- node-red
- node-red-contrib-victron
- signalk-server
- victron-vrm-api
List can always be updated by a simple grep over a Venus OS build system tree.
How to update npm-shrinkwrap
Use the method here: https://github.com/victronenergy/meta-victronenergy/commits/matthijs/npm-shrinkwrap/.
That commit is not in master yet, so you'll need to cherry pick it.
A nice tool to check the up to dateness of all packages is:
npm outdated
Don't clone from github to make npm-shrinkwraps!
Beware that cloning the signalk repo from github and then installing and making the npm-shrinkwrap doesn't work and results in issues when building Venus in OE and or only thereafter: signalk-server doesn't run, complaining of missing server-api
package and more.
Cloning from github and npm installing results in symlinking to the modules under packages because it uses npm workspaces - mechanism for monorepo = multiple different modules that are interconnected to facilitate developing features that span the sk server proper and the modules it uses
For further info, see also this issue: https://github.com/victronenergy/venus/issues/1298.
how does Venus OS build an npm package?
The npm class in OE was so slow, that we made a new implementation, see here: https://github.com/victronenergy/meta-victronenergy/blob/master/meta-third-party/classes/npm-online-install.bbclass
So, any recipe using that class, is built using the code in that file.
npm-shrinkwrap.json
Each recipe should contain an npm-shrinkwrap.json.
The purpose of having that is having installable builds. Instead of whenever doing a Venus OS build, having the npm installer take the latest versions of all packages according to limitations defined in the package.json file.
If a recipe doesn't have a npm-shrinkwrap.json file, the Venus OS build will fail with a warning about it being missing.
Some work was done to make that work right, see: