gorenje / node-red-contrib-nodedev

Node-RED nodes for the development of Node-RED nodes in Node-RED
https://flowhub.org/f/b92be5062203ff69
Other
3 stars 0 forks source link

Missing node ? #1

Open bohtho opened 6 days ago

bohtho commented 6 days ago

Is there a missing node (and instructions) for the Github functionality ? A designated end node in parallell to the NR Install and NPM publish nodes ?

The only way I could make it work was by linking a NodeFactory generated node dev flow to the last half of the flow that commits to Github in the Flowhub flow you refer to here. Only by looking through the code did I found out about the GITHUB_TOKEN (actually I later found it is informed about beneath that flow on Flowhub but not in the node readme).

And, btw, in that Flowhub flow I kept getting an error that I was missing a github token in my ENVs until I changed process.env to get.env in all occurences, but I guess that flow is "dated"(?) or not meant for the general public(?).

Also a thought: Since the NodeFactory has little function in the flow other than being a holder for the config fields and a button, couldn't that get implemented in the sidebar (plugin) too ? And split out the tgz converter if necessary ?

gorenje commented 5 days ago

Is there a missing node (and instructions) for the Github functionality ?

Yes there is, it's this flow that provides GitHub functionality. The flow you're referencing duplicates that functionality because that flow defines the NodeDev nodes - so they can't use themselves, i.e. the flow that provides the github functionality also uses the NodeDev nodes so it can't be used by a flow that defines the NodeDev nodes - makes perfect sense! 🤔

And yes the documentation around GITHUB_TOKEN is admittedly thin ...

Since the NodeFactory has little function

The NodeFactory is designed to be an artifact in the flow that defines nodes. For example, this flow that defines the FlowCompare node package contains the NodeFactory node as an indication of how the original node was generated (i.e. what properties). This is of course purely documentation however it did generated the template code for the node - in the beginning.

Also that FlowCompare flow demonstrates the use of the GitHub functionality and also the Restart flow - both are referenced via link out nodes from within the flow. (this link out node for the github functionality and this link out node for restart).

To include those flows, there are two FlowHub pull within the flow nodes: this one for Github functionality and this one for the restart. FlowHub pull nodes are designed to be opened and the there is a pull button to retrieve and include the relevant flow. I.e., they define flow dependencies amongst flows.

gorenje commented 5 days ago

And yes the documentation around GITHUB_TOKEN is admittedly thin ...

What I'll do is add a field to the NodeDevOps node so that a location of the GITHUB_TOKEN can be choosen. As is the case with the OTP generator sidebar:

Screenshot 2024-10-16 at 09 37 39

I'll also do that with the npm token that is required for publishing.

Update:

This is now fixed with 0.4.7 which allows for the specification of github and npm auth tokens in the dialog for the NodeDevOps node:

Screenshot 2024-10-16 at 12 41 04

bohtho commented 5 days ago

It's not that ENV variables were a surprise, but your latest iteration is much less convoluted for new users, and this node's offer of a more "visual coding experience" for nodes wouldn't attract the most hardcore commandline hackers either. Nice!👍🏻

While on this (vague) subject of "missing nodes"; Are you aware of any documented attempts to elegantly mix the nodedev and nodemaker nodes in a single node generating flow? I think it's a good idea for a visual node editor to offer some help with building the ui too, but in this case they both have helpful strong points and don't necessarily overlap as much as it may seem from the names.

gorenje commented 5 days ago

I tried out nodemaker a couple of times. I only used it to do an initial UI and then integrated my results into what I was building. I don't know whether @Steveorevo is still maintaining nodemaker, I did notice that there have been changes to the NR components making nodemaker a little inconsistent with the current versions of NR. But it still works out of the box, definitely good stuff 👍

As for NodeDev, it's definitely hard work to find a "simple" method for supporting node development and perhaps it's not even needed. I only started work on NodeDev because I got tired of the context switch between my text editor and my visual editor. And the constant need to reinstall packages into Node-RED on the commandline and then having to restart NR. In addition, I found the npm publish flow to be a pain on the commandline (OTP generations and auth tokens ...).

I just wanted to automate all the fluff around NR node development and hence NodeDev was created. Then I had to bootstrap it because I couldn't have it depend on itself and also I didn't want to develop NodeDev using my text editor. So that got complicated, i.e. the flow but the end result is simpler - for me - node development.

Thanks for taking the effort to have a look at NodeDev 👍