|
| 1 | +--- |
| 2 | +navTitle: Custom Node Packages |
| 3 | +--- |
| 4 | + |
| 5 | +# Custom Node Packages |
| 6 | + |
| 7 | +FlowFuse has access to the wide range of Node-RED nodes listed in the public |
| 8 | +catalogue as found on https://flows.nodered.org. But occasionally there will |
| 9 | +be the need for a custom node for a situation that is specific to your Team. |
| 10 | + |
| 11 | +If you decide to [develop](https://nodered.org/docs/creating-nodes/) your |
| 12 | +own node, you will need somewhere to host both the node and a Node-RED |
| 13 | +catalogue file. FlowFuse has 2 solutions for this. |
| 14 | + |
| 15 | +## FlowFuse Hosted Nodes |
| 16 | + |
| 17 | +If you want to create a Node-RED node for private use by Instances in your |
| 18 | +FlowFuse Team then you can publish them to the FlowFuse Custom Node Registry |
| 19 | +(available to Teams and Enterprise level teams on FlowFuse Cloud). |
| 20 | + |
| 21 | +### Publishing Nodes |
| 22 | + |
| 23 | +After developing your node you can publish it to your Teams Custom Nodes |
| 24 | +registry with the following steps |
| 25 | + |
| 26 | +#### Authenticating |
| 27 | + |
| 28 | +Before publishing to the registry you need to authenticate. This step should |
| 29 | +only need to be done once. |
| 30 | + |
| 31 | +The credentials can be found by navigating to the "Custom Nodes" tab under |
| 32 | +the Team Library and clicking on the "Publish" button. |
| 33 | + |
| 34 | +{data-zoomable} |
| 35 | +_Publish Custom Package_ |
| 36 | + |
| 37 | +``` |
| 38 | +npm login --registry=https://registry.flowfuse.dev |
| 39 | +``` |
| 40 | + |
| 41 | +#### Packaging |
| 42 | + |
| 43 | +There are steps required to ensure your node is correctly packaged for the |
| 44 | +FlowFuse Custom Nodes registry |
| 45 | + |
| 46 | +1. Make sure the package name contains the correct scope prefix e.g. |
| 47 | +`@flowfuse-[team id]/node-name`. The correct prefix will be shown on the in |
| 48 | +the FlowFuse application |
| 49 | +2. Add a `publishConfig` section with a `registry` entry |
| 50 | + |
| 51 | + |
| 52 | +e.g. for a Team with ID `6Rag1kQj4k` |
| 53 | +```json |
| 54 | +{ |
| 55 | + "name": "@flowfuse-6Rag1kQj4k/bar", |
| 56 | + "version": "0.0.1", |
| 57 | + "description": "...", |
| 58 | + "publishConfig": { |
| 59 | + "registry": "https://registry.flowfuse.dev" |
| 60 | + }, |
| 61 | + ... |
| 62 | +} |
| 63 | +``` |
| 64 | + |
| 65 | +#### Publishing |
| 66 | + |
| 67 | +In the same directory as the `package.json` file run the following command |
| 68 | + |
| 69 | +``` |
| 70 | +npm publish |
| 71 | +``` |
| 72 | + |
| 73 | +Once published you should see the Node listed in the "Custom Nodes" section |
| 74 | +of the Team Library. |
| 75 | + |
| 76 | +{data-zoomable} |
| 77 | +_Custom Node List_ |
| 78 | + |
| 79 | +### Installing Nodes |
| 80 | + |
| 81 | +Any packages uploaded to the Team Library will be published to your Instances |
| 82 | +under a custom catalogue with the name "FlowFuse Team [team name] Catalogue" |
| 83 | + |
| 84 | +{data-zoomable} |
| 85 | +_Custom Catalogue_ |
| 86 | + |
| 87 | + |
| 88 | +## 3rd Party NPM Registries or Private npmjs.org packages |
| 89 | + |
| 90 | +The following features are available to Team and Enterprise users of FlowFuse |
| 91 | +Cloud. |
| 92 | + |
| 93 | +### NPM Registries |
| 94 | + |
| 95 | +If you have already published packages to an existing NPM Registry then you |
| 96 | +can enable access to this by adding the required values to a `.npmrc" file |
| 97 | +in the Instance Settings. |
| 98 | + |
| 99 | +This can include authentication tokens to access private packages. |
| 100 | + |
| 101 | +{data-zoomable} |
| 102 | +_.npmrc file_ |
| 103 | + |
| 104 | +### Node-RED Catalogues |
| 105 | + |
| 106 | +In order to be able to install packages in the Node-RED editor they need to |
| 107 | +in a Node-RED Catalogue file that is loaded from a HTTPS URL. You can |
| 108 | +supply a list of Catalogue URLS in the Instance Settings. |
| 109 | + |
| 110 | +{data-zoomable} |
| 111 | +_Node Catalogues_ |
0 commit comments