Thanks everyone, that did get me onto something. node-red seem to use an older version of the nodejs plugin which allowed one to specify node-packages
. That seems to be gone in the current version of the nodejs plugin.
After studying the sources of the nodejs plugin [1] carefully, I came up with this (hack) of a part hat seems to work:
node:
plugin: nodejs
nodejs-package-manager: npm
source: ./travis
override-pull: |
echo '{"name": "fiduswriter", "version": "1.0.0", "dependencies": {"npm": "*"}, "bin": {"npm": "node_modules/.bin/npm"}}' > package.json
snapcraftctl pull
rm -f configuration.py
I chose the “travis” dir for the sources as it is the emptiest directory around. It only contains a configuration.py
file, which I delete subsequently. It’s not possible to just skip snapcraftctl pull
as that breaks it. For some reason this is dumping the package.json
file in the root of the snap. I don’t know what the point of that is, but it doesn’t seem to hurt either.
[1] https://github.com/snapcore/snapcraft/blob/master/snapcraft/plugins/nodejs.py