Which files need version control?

I found only one topic that's close to my question but it's old and I'd rather not necro-bump.

I have a local Subversion server that I want to use for versioning my changes/additions to my work. I read about Projects but it doesn't seem to handle my case. So, what I need to know is the list of files that I need to put in my repository to save me from myself. I'm not going to put the entire ~/.node-red tree in there, just whatever holds my flows... and settings.js

You're assistance is appreciated.

You should check in everything except the node_modules folder.

2 Likes

Thanks, @TotallyInformation

I'd also leave out the files beginning with a dot, especially the backup files.

And I recommend setting flowFilePretty: true, in your settings.js, so you can track flow file changes by line.

1 Like

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

Actually, I would want those in version control personally.

Yes, that certainly will allow git to do a better job of diff'ing the changes.

Cool.

Yep...except for one.

Sweet! Thanks

Probably good advice but...

Here is the list that serves my needs:

  • .config.json
  • flows_pvr.json
  • flows_pvr_cred.json
  • nodejs-node-red
  • package-lock.json
  • package.json
  • settings.js

My thanks to all!

I left out the .config.json since early versions of Node-RED because it doesn't contain anything useful in my setups. The node list is regenerated at start, I don't use projects and my credentials key is in the settings.js. So besides the user settings for the editor, there's nothing I would want in Git.

However, there's an interesting change coming: Split .config.json into separate files
So you will have better control over what goes into Git in the future. :grinning:

For curiosity's sake, why would want the *.backup files in Git, too? Or did you just mean the .config.json?

What is that file?

Well, if you have arranged something so that you auto-commit on every change AND gave users the ability to undo changes via git, you wouldn't need it. Otherwise, the backup files are your users get-out-of-jail-free card in case they make a booboo or in case there is a write error when Node-RED updates the file (something that is improved in the next release).

Just these 2 lines
NODE_OPTIONS=""
NODE_RED_OPTIONS=""

I meant where did it come from and what is it for? I don't think it is part of the standard set of files, unless it is a Windows thing that I don't know about.

Do many still use SVN? I switched to git about 12 years ago I think.

I think I copied it when I setup NR to run under my username. It's been a while so I'm not sure why.

Not in my network!!!

I haven't any idea. I set it up at home because that's what we used at work 15 years ago and I have no need or desire to change.

Not many :slight_smile: Too many advantages to git.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.