kopia lustrzana https://github.com/dceejay/electron-node-red
Tidy up
rodzic
1889d4d0a7
commit
90004fa701
|
@ -25,6 +25,8 @@ Run `npm run pack` to create packages for all platforms - these are the files re
|
||||||
|
|
||||||
Builds are created in the `build` directory. Runtimes are created in the `../electron-bin` directory.
|
Builds are created in the `build` directory. Runtimes are created in the `../electron-bin` directory.
|
||||||
|
|
||||||
|
**Note**: this was written to work on a Mac... other tools may/will be needed on other platforms.
|
||||||
|
|
||||||
## Packaging your application
|
## Packaging your application
|
||||||
|
|
||||||
If you want to distribute executables of this project, the easiest way is to use electron-packager:
|
If you want to distribute executables of this project, the easiest way is to use electron-packager:
|
||||||
|
|
79
main.js
79
main.js
|
@ -77,61 +77,62 @@ var template = [{
|
||||||
{ type: "separator" },
|
{ type: "separator" },
|
||||||
{ role: 'quit' }
|
{ role: 'quit' }
|
||||||
]}, {
|
]}, {
|
||||||
label: "Edit",
|
|
||||||
submenu: [
|
|
||||||
{ label: "Undo", accelerator: "CmdOrCtrl+Z", selector: "undo:" },
|
|
||||||
{ label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", selector: "redo:" },
|
|
||||||
{ type: "separator" },
|
|
||||||
{ label: "Cut", accelerator: "CmdOrCtrl+X", selector: "cut:" },
|
|
||||||
{ label: "Copy", accelerator: "CmdOrCtrl+C", selector: "copy:" },
|
|
||||||
{ label: "Paste", accelerator: "CmdOrCtrl+V", selector: "paste:" },
|
|
||||||
{ label: "Select All", accelerator: "CmdOrCtrl+A", selector: "selectAll:" }
|
|
||||||
]}, {
|
|
||||||
label: 'View',
|
|
||||||
submenu: [
|
|
||||||
{ label: 'Reload',
|
|
||||||
accelerator: 'CmdOrCtrl+R',
|
|
||||||
click (item, focusedWindow) { if (focusedWindow) focusedWindow.reload() }
|
|
||||||
},
|
|
||||||
{ label: 'Toggle Developer Tools',
|
|
||||||
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
|
|
||||||
click (item, focusedWindow) { if (focusedWindow) focusedWindow.webContents.toggleDevTools() }
|
|
||||||
},
|
|
||||||
{ type: 'separator' },
|
|
||||||
{ role: 'resetzoom' },
|
|
||||||
{ role: 'zoomin' },
|
|
||||||
{ role: 'zoomout' },
|
|
||||||
{ type: 'separator' },
|
|
||||||
{ role: 'togglefullscreen' },
|
|
||||||
{ role: 'minimize' }
|
|
||||||
]
|
|
||||||
}, {
|
|
||||||
label: 'Node-RED',
|
label: 'Node-RED',
|
||||||
submenu: [
|
submenu: [
|
||||||
{ label: 'Editor',
|
{ label: 'Editor',
|
||||||
accelerator: "Shift+CmdOrCtrl+E",
|
accelerator: "Shift+CmdOrCtrl+E",
|
||||||
click () { mainWindow.loadURL("http://localhost:"+listenPort+urledit); }
|
click() { mainWindow.loadURL("http://localhost:"+listenPort+urledit); }
|
||||||
},
|
},
|
||||||
{ label: 'Dashboard',
|
{ label: 'Dashboard',
|
||||||
accelerator: "Shift+CmdOrCtrl+D",
|
accelerator: "Shift+CmdOrCtrl+D",
|
||||||
click () { mainWindow.loadURL("http://localhost:"+listenPort+url); }
|
click() { mainWindow.loadURL("http://localhost:"+listenPort+url); }
|
||||||
},
|
},
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{ label: 'Documentation',
|
{ label: 'Documentation',
|
||||||
click () { require('electron').shell.openExternal('http://nodered.org/docs') }
|
click() { require('electron').shell.openExternal('http://nodered.org/docs') }
|
||||||
|
},
|
||||||
|
{ label: 'Flows and Nodes',
|
||||||
|
click() { require('electron').shell.openExternal('http://flows.nodered.org') }
|
||||||
},
|
},
|
||||||
{ label: 'Google group',
|
{ label: 'Google group',
|
||||||
click () { require('electron').shell.openExternal('https://groups.google.com/forum/#!forum/node-red') }
|
click() { require('electron').shell.openExternal('https://groups.google.com/forum/#!forum/node-red') }
|
||||||
}
|
}
|
||||||
]
|
]}, {
|
||||||
}
|
// label: "Edit",
|
||||||
|
// submenu: [
|
||||||
|
// { label: "Undo", accelerator: "CmdOrCtrl+Z", selector: "undo:" },
|
||||||
|
// { label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", selector: "redo:" },
|
||||||
|
// { type: "separator" },
|
||||||
|
// { label: "Cut", accelerator: "CmdOrCtrl+X", selector: "cut:" },
|
||||||
|
// { label: "Copy", accelerator: "CmdOrCtrl+C", selector: "copy:" },
|
||||||
|
// { label: "Paste", accelerator: "CmdOrCtrl+V", selector: "paste:" },
|
||||||
|
// { label: "Select All", accelerator: "CmdOrCtrl+A", selector: "selectAll:" }
|
||||||
|
// ]}, {
|
||||||
|
label: 'View',
|
||||||
|
submenu: [
|
||||||
|
{ label: 'Reload',
|
||||||
|
accelerator: 'CmdOrCtrl+R',
|
||||||
|
click(item, focusedWindow) { if (focusedWindow) focusedWindow.reload(); }
|
||||||
|
},
|
||||||
|
{ label: 'Toggle Developer Tools',
|
||||||
|
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
|
||||||
|
click(item, focusedWindow) { if (focusedWindow) focusedWindow.webContents.toggleDevTools(); }
|
||||||
|
},
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ role: 'resetzoom' },
|
||||||
|
{ role: 'zoomin' },
|
||||||
|
{ role: 'zoomout' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ role: 'togglefullscreen' },
|
||||||
|
{ role: 'minimize' }
|
||||||
|
]}
|
||||||
];
|
];
|
||||||
|
|
||||||
// Keep a global reference of the window object, if you don't, the window will
|
// Keep a global reference of the window object, if you don't, the window will
|
||||||
// be closed automatically when the JavaScript object is garbage collected.
|
// be closed automatically when the JavaScript object is garbage collected.
|
||||||
let mainWindow;
|
let mainWindow;
|
||||||
|
|
||||||
function createWindow () {
|
function createWindow() {
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
|
@ -190,7 +191,7 @@ app.on('window-all-closed', function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.on('activate', function () {
|
app.on('activate', function() {
|
||||||
// On OS X it's common to re-create a window in the app when the
|
// On OS X it's common to re-create a window in the app when the
|
||||||
// dock icon is clicked and there are no other windows open.
|
// dock icon is clicked and there are no other windows open.
|
||||||
if (mainWindow === null) {
|
if (mainWindow === null) {
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron main.js",
|
"start": "electron main.js",
|
||||||
"test": "echo \" Warning: no test specified \"",
|
"test": "echo \" Warning: no test specified \"",
|
||||||
|
"watch": "nodemon --exec \"npm run start\" --ext js,css,json --ignore build/",
|
||||||
|
|
||||||
"clean": "rm -rf ./build ../electron-bin && mkdir -p ./build ../electron-bin",
|
"clean": "rm -rf ./build ../electron-bin && mkdir -p ./build ../electron-bin",
|
||||||
|
|
||||||
"pack": "npm run clean && electron-packager . Node-RED --icon=nodered.icns --all --out=build --overwrite",
|
"pack": "npm run clean && electron-packager . Node-RED --icon=nodered.icns --all --out=build --overwrite",
|
||||||
|
|
Ładowanie…
Reference in New Issue