Rename or copy core nodes ( inject)

Is it possible to rename core nodes or make similar nodes with different name ?

Yes, but Why?

3 Likes

If you compile the source code yourself then you can pretty much do want you want with an exisiting node.

If you want to make your own version of a core node without going to such lengths, you can copy the code from a core node and make your own contrib node from it.

You'll need to do a lot of search and replacing of the node name
e.g I have a copy of the inject node

I have replaced every reference to the word "inject" with "newinject" and "Inject" with "NewInject" apart from the line that specifies the icon.png file to use - I left that to the original

And I had to create my own simple package.json file

{
  "name" : "node-red-contrib-newinject",
  "version": "0.0.2",
  "description": "mod of inject node",
  "author": "simon walters @cymplecy",
  "license": "ISC",
  "node-red" : {
      "nodes": {
          "newinject": "newinject.js"
      }
  }

}

See https://nodered.org/docs/creating-nodes/first-node for creating your own node

I'd recommend making the example one first rather than diving in to make a copy of core one

Hi Kimari,
When you want to add a useful feature to those nodes, perhaps your new functionality might be interesting for other users also? You can always discuss here on the forum your new functionality. If you get green light, you can create a pull request to contribute your functionality into the standard Node-RED node. Otherwise we end up with N versions of the same node, each with their own extra features...
Bart

5 Likes

Yes, there are currently 3546 Nodes in the library and it is already confusing. Having lots of similar Nodes can be very frustrating for people.

2 Likes

If you do copy one - then remove the node-red keyword from package.json. That way it will remain private to you and we won't try to index it.

4 Likes