Formatted flow file, by default?

Hi,

Is there an option to force Node-RED to save the flow file json formatted?

While the new projects feature great, the built in commit browser great, looking at differences the git diff way or at any hosted git service is terrible, since the flow.json is saved as a single line, making any diff like comparison useless.

Regards,
András

Have a look for the flowFilePretty option in your settings file.

2 Likes

Thank you!

In addition to flowFilePretty, before committing I run the command
sed -r 's/\\n/\n/g' flowfile.json > flowfile.json.formatted

Where flowfile.json is the name of the flowfile. This formats function nodes by splitting on newlines in the source. Add flowfile.json.formatted to the files to be committed. A diff will then show changes made to function nodes.

3 Likes

The requirement to store flows as readable/diffable text keeps popping up... I know that @nlecaude created the yaml storage plugin for this purpose -- any chance his logic could be pulled into the current storage impl, so it could be turned on along with "projects" as well?

The idea of supporting alternative storage formats in the built-in storage implementations has been discussed, you are right. But it isn't simply a case of pulling in his logic - formatting the flow as yaml just before writing to the file is the trivial part. There's a huge amount of UX work needed to expose that in the projects UI and workflow. Unless someone wants to step forward to design the integration and work on it, then it has to wait its turn.