Which files need version control?

In addition to setting flowFilePretty, before committing I run this script which generates a formatted version of the flows file (with the extension .formatted) which has function nodes formatted one line per line of source (rather than the function being all on one line). This allows diffs to be viewed which show line by line changes to function nodes. The formatted file has to be committed too of course. The formatted file cannot be used as the actual flows file, it is just for viewing diffs.

#!/usr/bin/env sh

# generates formatted versions of node red flow files matching flow*.json
# in files flow*.json.formatted

# NOTE must have flowFilePretty: true in settings.js

for f in flow*.json; do
  echo $f
  sed -r 's/\\n/\n/g' "$f" > "$f.formatted"
done
# remove any cred files converted
rm *_cred.json.formatted
2 Likes