ozomer / node-red-contrib-unsafe-function

The fast and furious version of function nodes
1 stars 5 forks source link

Feature proposal: external file #2

Open natcl opened 7 years ago

natcl commented 7 years ago

Hello ! Would you be interested in a PR that would add external file support ? (being able to load a js file from disk instead of executing the code in the node's editor window) If so would you be willing to discuss implementation details ?

Thanks !

ozomer commented 7 years ago

Hi, I don't want the unsafe-function node to diverge too much from the standard function node. I guess you want to be able to save the code in files in order to use source control and linters, right? We are use mongodb to store our configuration, and a script to download the configuration to local files (each "node" gets its own file). https://gist.github.com/ozomer/ee02a398a4e70e20d50399a0f75d8449 We also run eslint on the code of the function\unsafe-function node, and you can easily review code changes by committing these "auto-generated" files to git (however merging is still complicated).

Why saving only the function\unsafe-function nodes in files if you can save all the nodes in files?

Regards, Oren

natcl commented 7 years ago

Our goal is mainly to ease versioning/merging on Github, didn't really think about linting yet. We may create our own node for this but I don't like the idea of having a bunch of different function nodes around...

ozomer commented 7 years ago

We use the script for versioning of all the nodes, not only function nodes! including their configuration, connections, etc. We also use the storage module from here to avoid saving credentials\secrets\environment-depended-configuration directly in our node-red flows. They are automatically loaded when node-red loads.

The problem that you mentioned is true for node-red in general, not only for unsafe-function.