In a
recent posting about reuse of subflow nodes, the broader topic arose about collaborative development and sharing of node-red artifacts, specifically flows.
Node-RED fever is spreading like wildfire through our group. This is great. And it poses some challenges.
Typical methods of developing and sharing nodes do apply, although sometimes are complicated by us not being ready to share the nodes in the broader community. I guess we'll have to learn about local npm repos.
For a number of reasons we also find ourselves wanting/needing to share flows, flow fragments, and subflows.
The first and perhaps most profound issue is sharing by copying. If the intent is to share and abandon, that's fine. But if there's any desire to maintain versions, it seems impractical to do so via copy/paste. Sharing of nodes can benefit from the mechanisms already in place. Reimplementing subflows as nodes is a possibility. But embedding others' nodes' code into a node-ified subflow means a lot of manual updating when those other nodes change (not to mention licensing troubles). So, finding some way to share a subflow as a versionable artifact would be a goal.
A little more about our current efforts toward collaboration: I’ve shared entire “tabs” of flows, and also individual flows, and have done so using export and committing to svn. For the most part it works quite well. The recipients need to do a bit of cleanup after importing, including addressing additional dependencies and the things I’ve already addressed on the article linked above. As I mentioned, maintenance will become an issue.
In addition to sharing reusable artifacts, we also need to share entire demonstrator projects and also “libraries of helper nodes and helper flows"
For the demonstration projects, we check in to svn a directory that looks like a node project: there's a package.json, a local userdir, a flows.json, and either a settings.js file and link to red.js or there's an app.js file (with embedded settings). Any interested party checks out the project, does a "npm install" and then runs node with the red.js link or the app.js file. In addition, we provide some export files in the userdir/lib/flows directory that users can import. All is good, with an exception.
For the most part, these demonstration projects make use of flow artifacts (library of flows and/or exported subflow nodes) borrowed from other projects. That "helper code" dependency either needs to be accommodated by either copying or linking into the demonstrator directory. Also, the user must incorporate these artifacts, likely via manual import and integration.
Again, the theme is dependencies on flows and/or subflow nodes.
Recently, I've "exploded" all subflow nodes, until we've worked out how to import them without replicating (addressed in the linked article).
This is a first attempt for us. We'll follow up with what we've learned.
Mark