feat: electron
This commit is contained in:
parent
5d62fdd1f9
commit
47f44a228f
|
@ -43,6 +43,14 @@
|
|||
port: 32352
|
||||
'@flecks/docker': {}
|
||||
'@flecks/dox': {}
|
||||
'@flecks/electron/server':
|
||||
browserWindowOptions:
|
||||
backgroundColor: '#212121'
|
||||
show: false
|
||||
window:
|
||||
- '@humus/core'
|
||||
- '...'
|
||||
url: 'https://humus.local.cha0s.io'
|
||||
'@flecks/governor': {}
|
||||
'@flecks/web': {}
|
||||
'@flecks/web/client':
|
||||
|
@ -112,6 +120,7 @@
|
|||
- '...'
|
||||
- '@humus/universe'
|
||||
- '@flecks/web'
|
||||
- '@flecks/electron'
|
||||
- '@flecks/repl'
|
||||
'@flecks/socket': {}
|
||||
'@flecks/socket/server':
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<base href="/" />
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no" />
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
<title>Humus</title>
|
||||
<style>
|
||||
html {
|
||||
background-color: #212121;
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
"@flecks/create-app": "^1.4.1",
|
||||
"@flecks/db": "^1.4.1",
|
||||
"@flecks/dox": "^1.4.1",
|
||||
"@flecks/electron": "^1.4.1",
|
||||
"@flecks/governor": "^1.4.1",
|
||||
"@flecks/react": "^1.4.1",
|
||||
"@flecks/redis": "^1.4.1",
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
"build",
|
||||
"index.js",
|
||||
"index.js.map",
|
||||
"server.js",
|
||||
"server.js.map",
|
||||
"persea.js",
|
||||
"persea.js.map",
|
||||
"src",
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
// import {fork} from 'child_process';
|
||||
// import {app, BrowserWindow} from 'electron';
|
||||
// import {get} from 'web';
|
||||
|
||||
// let serverInstance = false;
|
||||
// async function startServer() {
|
||||
// if (serverInstance) {
|
||||
// return;
|
||||
// }
|
||||
// serverInstance = fork(`${__dirname}/index`);
|
||||
// const check = true;
|
||||
// while (check) {
|
||||
// try {
|
||||
// // eslint-disable-next-line no-await-in-loop
|
||||
// const {statusCode} = await new Promise((resolve, reject) => {
|
||||
// get('http://humus.localhost', {timeout: 50}, resolve).on('error', reject);
|
||||
// });
|
||||
// if (200 === statusCode) {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// // eslint-disable-next-line no-empty
|
||||
// catch (error) {}
|
||||
// }
|
||||
// }
|
||||
|
||||
// async function createWindow() {
|
||||
// const win = new BrowserWindow({
|
||||
// height: 600,
|
||||
// webPreferences: {
|
||||
// contextIsolation: true,
|
||||
// nodeIntegration: false,
|
||||
// },
|
||||
// width: 800,
|
||||
// });
|
||||
// await win.loadURL('http://humus.localhost');
|
||||
// }
|
||||
|
||||
// app.on('window-all-closed', () => {
|
||||
// if (process.platform !== 'darwin') {
|
||||
// app.quit();
|
||||
// }
|
||||
// });
|
||||
|
||||
// app.on('activate', async () => {
|
||||
// if (BrowserWindow.getAllWindows().length === 0) {
|
||||
// createWindow();
|
||||
// }
|
||||
// });
|
||||
|
||||
// app.on('quit', () => {
|
||||
// serverInstance.kill();
|
||||
// });
|
||||
|
||||
// (async () => {
|
||||
// await app.whenReady();
|
||||
// await startServer();
|
||||
// await createWindow();
|
||||
// })();
|
14
packages/core/src/server.js
Normal file
14
packages/core/src/server.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
import {Hooks} from '@flecks/core';
|
||||
|
||||
export default {
|
||||
[Hooks]: {
|
||||
'@flecks/electron/server.window': async (win) => {
|
||||
win.removeMenu();
|
||||
win.openDevTools();
|
||||
win.maximize();
|
||||
win.once('ready-to-show', () => {
|
||||
win.show();
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
9
patches/electron+18.0.1.patch
Normal file
9
patches/electron+18.0.1.patch
Normal file
|
@ -0,0 +1,9 @@
|
|||
diff --git a/node_modules/electron/cli.js b/node_modules/electron/cli.js
|
||||
index 09f4677..b64bb88 100755
|
||||
--- a/node_modules/electron/cli.js
|
||||
+++ b/node_modules/electron/cli.js
|
||||
@@ -23,3 +23,4 @@ const handleTerminationSignal = function (signal) {
|
||||
|
||||
handleTerminationSignal('SIGINT');
|
||||
handleTerminationSignal('SIGTERM');
|
||||
+handleTerminationSignal('SIGUSR2');
|
Loading…
Reference in New Issue
Block a user