packaging nodes and discovery

36 views
Skip to first unread message

Julian Lyndon-Smith

unread,
Aug 26, 2015, 5:21:22 AM8/26/15
to Node-RED
I was looking at the packaging guidelines, and was curious ;)


Specifically, "It is suggested they use node-red-contrib- as a prefix, although that is not a requirement."

Does this mean that there may be some node-red nodes that do not follow this convention ?

I was curious because I was wondering about the discovery process - do you loop through all the folders in node_modules to find the nodes ? If there is no module naming requirement, I would have to assume that you then have to load each package.json up to see if there are the node-red keys inside. This would seem to be a slow process.

Is the discovery process as I've described, or am I just being daft ? ;)

ta

Nicholas O'Leary

unread,
Aug 26, 2015, 5:41:27 AM8/26/15
to Node-RED Mailing LIst
Hi,

the discovery process loads all of the package.json files it finds looking for the node-red keys - it does not care what the name of the package is. The reason for the naming convention is to make it clear that a package isn't one maintained by us, so we don't get deluged with support requests.

I did some work to see where the time was being spent on start-up, to try to make it faster. On a raspberry pi, it took 14 seconds to start up - including the time to discover what nodes were installed. I changed the code to give it a hardcoded list of nodes, so it didn't have to scan - it then took 13.8 seconds to start. So the discovery process was only taking 200ms - the bulk of the time was loading the nodes themselves after they had been discovered.

Nick

--
http://nodered.org
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Julian Lyndon-Smith

unread,
Aug 27, 2015, 10:32:48 AM8/27/15
to Node-RED
Thanks for the info - I since discovered the "recommended" approach of npm installing the nodes in a separate folder and pointing node-red to that folder. That makes a little more sense, as I have a boat-load of non-node-red nodes in my node_modules ;)

Julian
Reply all
Reply to author
Forward
0 new messages