This is an Electron template to embed Node-RED with an existing Node-RED project to create a native application.
 
 
Go to file
Dave Conway-Jones 28f7c6fbff
add kiosk mode (dangerous)
2019-10-26 18:30:16 +01:00
.github Create no-response.yml 2019-10-13 22:43:01 +01:00
.vscode add kiosk mode (dangerous) 2019-10-26 18:30:16 +01:00
build major upgrade to latest electron and builder 2019-10-23 17:40:06 +01:00
.gitignore major upgrade to latest electron and builder 2019-10-23 17:40:06 +01:00
.travis.yml Slight tidy 2016-10-29 22:57:05 +01:00
LICENSE update README and License to Apcahe-2 2019-10-23 23:46:16 +01:00
README.md add kiosk mode (dangerous) 2019-10-26 18:30:16 +01:00
console.htm major upgrade to latest electron and builder 2019-10-23 17:40:06 +01:00
dockbuild major upgrade to latest electron and builder 2019-10-23 17:40:06 +01:00
electronflow.json add kiosk mode (dangerous) 2019-10-26 18:30:16 +01:00
electronflow_cred.json add loading page for slow devices 2018-08-27 14:45:40 +01:00
load.html add loading page for slow devices 2018-08-27 14:45:40 +01:00
loading.gif Better loading icon and demo flow 2016-10-30 23:03:12 +00:00
main.js add kiosk mode (dangerous) 2019-10-26 18:30:16 +01:00
nodered.png major upgrade to latest electron and builder 2019-10-23 17:40:06 +01:00
package.json major upgrade to latest electron and builder 2019-10-23 17:40:06 +01:00

README.md

electron-node-red

This is an Electron template to embed Node-RED with a Dashboard generated by node-red-dashboard to create a native application.

This is not intended to be a useful tool as-is, but as a base for you to create your own versions. You will need to edit the main.js to suit your application and update the package.json file to include your own required nodes and dependencies.

At the top of main.js are a couple of flags you can switch to turn off editing, allow loading of a different flow file (and save as), and add the worldmap to the menu. Again these are only there to show you possibilities. Have fun.

Configuring the project for building

This project uses the electron-builder project to help build native versions of Node-RED applications, so please read and become familiar with their documentation as some basic knowledge is assumed.

As a pre-req, as well as a recent version of node.js, you will need the yarn install tool

# Clone this repository
git clone https://github.com/dceejay/electron-node-red.git
# Go into the repository
cd electron-node-red
# Install the yarn install tool globally
sudo npm i -g yarn
# Install project dependencies
yarn

Building local runtime

You should then be able to run

yarn && yarn dist

to create a runtime for your local platform. However - there may be some errors. If so they are usually fairly self explanatory, and may just require installation of another npm or brew or apt package, then retry the command.

Runtimes are created in the dist directory under the electron-node-red project.

Building for other platforms

Generally you can just add the required parameter to the command

yarn && yarn dist -w        // for windows
yarn && yarn dist -l        // for linux
yarn && yarn dist -m        // for mac

These will generally fail the first time through and you will need to install some extra library in order to make it complete successfully.

The defaults are to build a .msi for Windows, a .dmg for Mac, and both a .deb and .rpm for Linux. These can be changed by editing the build section of the package.json file, see the electron-builder config docs for more info.

Building multi platform using Docker

Electron-builder has a pre-configured Docker image that can help you build cross platform images if you like Docker - again read their docs.

Developing and Testing - Running locally

While developing and testing you can just run your app locally by running

npm start

from within the project folder.

The initial flow file is named electronflow.json along with it's credentials file electronflow_cred.json. Just copy your existing flow in instead.

The default is to start on the dashboard page - as this is intended to be just an application - without the Node-RED editor exposed to the end user, but there are some simple flags to to configure this at the top of main.js.