Version control


#1

Is version control possible with node-red? I dont like creating too many files and copy-paste my flows in them , or having too many json files its a mess.


#2

Yes - read about the Projects feature here


#3

Hi Nick,

Thank you for pretty good documentation page about projects and for video explanation.
Being old fashioned, I managed so far the version control of NR in terminal with git CLI. I find this pretty versatile and handy, however some people may think different.

To the moment, NR saves flows.json as single line. That means even simple movement of single node causes git to commit the entire json. This makes hard version compare and tracking.

Is there a way to configure NR to save json files structured?
Like this:

{
   "id": "236ea675.41ed8a",
   "type": "inject",
   "z": "25a82b05.7c01a4",
   "name": "",
   "topic": "",
   "payload": "",
   "payloadType": "date",
   "repeat": "",
   "crontab": "",
   "once": true,
   "onceDelay": 0.1,
   "x": 130,
   "y": 40,
   "wires": [
       [
           "d797c17b.12e8d"
       ]
   ]
},

Structured files make to git easy job to indicate what changed. As well, it makes for developer easy tracking and code review.
Thank you.


#4

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


#5

Detailed instructions to make NR keeping structures jsons - maybe this will help someone:

  1. Open settings.js in .node-red folder for editing (vim, nano, or other text editor).
  2. Find line with word 'Pretty' and uncomment it.
  3. Save the file and exit from the editor.
  4. node-red-stop && node-red-start
    followed with Ctrl+C (as usual). The makes NR reading the settings.
  5. Change something in your flow and deploy. The flows_xxx.json structured!