You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an Electron template to embed [Node-RED](https://nodered.org) with a Dashboard generated by node-red-dashboard to create a native application.
6
+
This is an Electron template to embed [Node-RED](https://nodered.org) with an existing Node-RED project to create a native application.
7
7
8
8
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.
9
9
10
10
There are several simple switches that can be set in the `NRelectron` section of
11
11
the `package.json` file. More significant modifications will require modification
12
12
of the `main.js` file. Have fun.
13
13
14
+
## Wrapping an existing Node-RED project
15
+
16
+
The `merger.js` utility should be run from within this projects directory and can be pointed at
17
+
an existing Node-RED project directory. It will try to copy over and package up the
18
+
relevant files into this project ready to install and build - so the simple flow would be
19
+
20
+
```bash
21
+
./merger.js {path to my Node-RED project directory}
22
+
yarn
23
+
yarn start
24
+
```
25
+
26
+
This uses the `package-template.json` file as the main electron setup - so you should edit any
27
+
build parameters, product name, whether you want the app version to be editable, run in kiosk mode, etc in the `NRelectron` section before running.
28
+
29
+
The app name, version and description are picked up from the package.json file of the original project.
30
+
31
+
When running using yarn start - the flow file is picked from the current directory. When running as an app (but only if editable), then the flow file is copied into the users `.node-red` directory and is read and written from there. The deafult name can be changed in the package.json file if required.
32
+
33
+
**NOTE**: Currently the settings are set around line 109 of the `main.js` file. If you do use any
34
+
custom settings then currently you will need to modify this manually.
35
+
14
36
## Configuring the project for building
15
37
16
38
This project uses the **electron-builder** project to help build native versions
@@ -40,17 +62,11 @@ yarn && yarn dist
40
62
41
63
to create a runtime for your local platform.
42
64
However - there may be some errors. If so they are usually fairly self explanatory,
43
-
and may just require installation of another npm or brew or apt package,
65
+
and may just require installation of another **npm** or **brew** or **apt** package,
44
66
then retry the command.
45
67
46
68
Runtimes are created in the `dist` directory under the `electron-node-red` project.
47
69
48
-
The `merger.js` utility can be pointed at an existing Node-RED projects directory and it will try to copy over and package up the relevant files into this project ready to install and build - so the simple flow would be
49
-
50
-
```
51
-
./merger.js {path to my Node-RED project directory} && yarn && yarn start
52
-
```
53
-
54
70
### Building for other platforms
55
71
56
72
Generally you can just add the required parameter to the command
@@ -61,12 +77,12 @@ yarn && yarn dist -l // for linux
61
77
yarn && yarn dist -m // for mac
62
78
```
63
79
64
-
These will generally fail the first time through and you will need to install some extra library in order to make it
80
+
These will generally fail the first time through, and you will need to install some extra library in order to make it
65
81
complete successfully.
66
82
67
83
The defaults are to build a `.msi` for Windows, a `.dmg` for Mac, and both a `.deb` and `.rpm` for Linux.
68
84
These can be changed by editing the build section of the `package.json` file, see the
69
-
[electron-builder config docs](https://www.electron.build/configuration/configuration) for more info.
85
+
[electron-builder config docs](https://www.electron.build/configuration/configuration) for more information.
70
86
71
87
## Building multi platform using Docker
72
88
@@ -89,6 +105,6 @@ The initial flow file is named `electronflow.json` along with it's credentials f
89
105
`electronflow_cred.json`. Just copy your existing flow in instead.
90
106
91
107
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
92
-
to configure this at the top of `main.js`.
108
+
to configure this within the package.json or at the top of main.js.
0 commit comments