Dear Dave,
ohh... Electron; did not find this in my research, but seems much more mature than nexe.... I'll do some serious research on that based on your repo.... see if i can build in my environment (windows or linux... ).
The mods consist of changing the dynamic 'require' calls to call a function 'noderequire', which by default is 'require', unless a js called 'modulerequire' is in the folder below node-red.
This mod is done in registry/installer, registry/loader, registry/localfilesystem, and storage/index.
The file 'modulerequire', if it exists, contains static requires for all the dynamic .js files, with 'if (false)' around them, so they never actually get required; but browserify sees these require statements, and includes the files into the combined source chunk, and notes where they are by some module id.
The function 'noderequire' just does a require, but from inside the 'modulerequire.js' (which must be the way, as browserify only maps from where the require is done....). This then means that the dynamic requires are fulfilled.
In order to wrap the whole thing, 'modulerequire.js' is created dynamically at build by searching certain paths, and at the same time, a file containing all the other resources is created (all the node html and json files, for example).
The resources are later accessed by node-red by the initial inclusion of a js which replaces certain fs. functions (readFile, stat, plus others); so node-red sees the resources as being there, even though they are actually built in.
In this way, flows, settings, etc. can also be 'wrapped in'. It's not the most efficient wrapping of resources as all the resource files are bin64 encoded :(. But I'm thinking they could almost as easily be read from a zip or other archive.
I've not got a repo of the actual wrapping process yet.
There was also a dynamic require issue with oauth2orize, which I patch, and a wrapper for the lot which loads the fs modification before node-red.
I will try Electron and report back on differences. I guess the immediate difference (from literally 1 minute looking at Electron) is that nexe only wraps node + node-red, and has no browser integration. Basically, it patches the node sources to include the (compiled) single browserified js, and builds a version of node with the startup js you specify; so fairly raw and bare, but workable result. I am guessing that Electron has options to NOT include the browser if required, and so can produce a very similar result.
When you say 'attempted' when referring to your repository, what issues did you come across, and what remains to be resolved? From a quick look, there's no node-red modification required?
best regards,
Simon