Hi all!
I'm new here and new to Node-RED. I don't know if this is the common way to do this, but in my team we export all the flows to a flows.json file and use this to deploy the apps.
While exporting it, I noticed the content of a function ends up in only one line. Example:
[
{
"id": "3fc0691543bbac9f",
"type": "function",
"z": "1a93fafb2ad45337",
"name": "function 1",
"func": "msg.test = 'hey, listen!'\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 200,
"y": 100,
"wires": [
[]
]
}
]
We use git to version this. And if there is a change in only one line of the code, it is hard to check it while deciding by add or not to the commits, even for codes with just few lines. I was thinking about opening a PR for change the function export, making "func" to be exported to an array of lines. Like this:
[
{
"id": "3fc0691543bbac9f",
"type": "function",
"z": "1a93fafb2ad45337",
"name": "function 1",
"func": [
"msg.test = 'hey, listen!'",
"return msg;"
],
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 200,
"y": 100,
"wires": [
[]
]
}
]
Given it is a big change, seems fair to give an option at the settings of each project to decide if the functions are exported into array or one line. But it would make it easier to check the code while committing.
I would have to take a time to study where to make all these changes. I came here because I read the terms in the github and it says we must discuss things here before run to the code and change stuff. Already looked for similar topic, could not find it. If it was already raised, sorry for that.