electron-node-red/README.md

71 wiersze
2.7 KiB
Markdown
Czysty Zwykły widok Historia

2016-03-09 21:59:34 +00:00
# electron-node-red
2016-03-09 21:49:41 +00:00
2019-10-23 22:46:16 +00:00
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.
2019-10-23 22:46:16 +00:00
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.
2019-10-23 22:46:16 +00:00
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.
2016-03-09 21:49:41 +00:00
## To Use
2019-10-23 22:46:16 +00:00
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](https://www.electron.build/) as some basic
knowledge is assumed.
2019-10-24 08:38:26 +00:00
As a pre-req, as well as a recent version of node.js, you will need the **yarn** install tool
2016-03-09 21:49:41 +00:00
```bash
# Clone this repository
2016-10-29 13:43:32 +00:00
git clone https://github.com/dceejay/electron-node-red.git
2016-03-09 21:49:41 +00:00
# Go into the repository
2016-03-09 21:59:34 +00:00
cd electron-node-red
2019-10-23 22:46:16 +00:00
# Install the yarn install tool globally
sudo npm i -g yarn
# Install project dependencies
yarn
2016-03-09 21:49:41 +00:00
```
2019-10-23 22:46:16 +00:00
## Building local runtime
2019-10-23 22:46:16 +00:00
You should then be able to run
```
2019-10-23 22:46:16 +00:00
yarn && yarn dist
```
2019-10-23 22:46:16 +00:00
to create a runtime for your local platform.
2019-10-24 08:38:26 +00:00
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.
2016-05-06 12:18:15 +00:00
2019-10-24 08:38:26 +00:00
Runtimes are created in the `dist` directory under the `electron-node-red` project.
2016-10-29 13:43:32 +00:00
2019-10-23 22:46:16 +00:00
### Building for other platforms
2016-05-06 12:18:15 +00:00
2019-10-23 22:46:16 +00:00
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
```
2016-05-10 11:39:24 +00:00
2019-10-23 22:46:16 +00:00
These will generally fail the first time through and you will need to install some extra library in order to make it
complete successfully.
2016-10-30 22:06:48 +00:00
2019-10-23 22:46:16 +00:00
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](https://www.electron.build/configuration/configuration) for more info.
2016-10-30 22:06:48 +00:00
2019-10-24 08:38:26 +00:00
## Running locally
2019-10-23 22:46:16 +00:00
While developing and testing you can just run locally by running
```
npm start
```
from within the project folder.
2016-05-20 10:20:54 +00:00
2019-10-24 08:38:26 +00:00
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 intended to be just an application - without the Node-RED editor exposed to the end user.
2019-10-23 22:46:16 +00:00
---