Hi I am working on my first custom node and have some very basic questions
Is there a particular preferred namespace for the scoped names used for new nodes?
i.e. in @myScope/node-red-contrib-my-node,
is myScope a) my username in the node red forum
b) my npm username used to publish the package
c) my github username used to host the repo
d) or some random string that I generate.
I realised after rereading the packaging section that there is a hyperlink on that page to the following
That page contains the following
...
Each npm user/organization has their own scope, and only you can add packages in your scope. This means you don't have to worry about someone taking your package name ahead of you. Thus it is also a good way to signal official packages for organizations.
...
That would seem to imply that the user scope would be defined by my npm userid
Previously, we asked that if a module’s name started with node-red- , that it use node-red-contrib- to distinguish it from modules maintained by the core project.
With the scoped prefix, it is no longer suggested to have the "contrib" part in your node name based on that linked post.
The small issue you could have is that if you are publishing @tonymacdonald/node-red-my-node and somebody else has already published node-red-contrib-my-node, then maybe you might both name your node my-node which could cause a conflict. Unless there has been some change, I do not think the @scoped-name will help in this situation.
It would be useful I think if there were a specific section on Scoping of packages and node types in the Creating Nodes docs. I have not created any nodes since scoping was introduced so don't feel qualified to do this myself.
Using a slash / as scope delimiter will crash the runtime as soon as someone accesses the editor in a browser.
with a
TypeError: Cannot read properties of undefined (reading 'user')
in the following line: (Node-Red v3.0.2)
As a workaround, I used @me-my-node instead of @me/my-node, which is working as expected.
Are these property names from package.json of any relevance or can these just be arbitrary? After all, the names that actually get used are ones from the RED.nodes.registerType('@me/my-node') call.
And, of course, do a sanity check on node names before starting work. Both avoiding "obvious", generic words (e.g. "chart" would obviously be a very bad choice, "ui-chartjs" would be a fairly bad choice unless you intend to provide wide-ranging support for that library for all use-cases in Dashboard) and searching the flows site for the name you are thinking of.
I understand that the new model requires custom node packages to be published with scoped names and from the responses here and the documentation I can see how to do that.
However, it was not clear to me that the names of the nodes within that package also have to be scoped.
If there is no need to scope the names of the nodes within the package, then the "@me/" wouldn't be required in the nodes: entry below