refactor: electon and aliases

This commit is contained in:
cha0s 2024-01-22 09:43:10 -06:00
parent 67553647f6
commit 8ec7297704
4 changed files with 35 additions and 42 deletions

View File

@ -93,13 +93,12 @@
- 'react-window'
port: 32350
public: 'humus.localhost'
'@humus/app':
'@humus/app:./packages/app':
resolution: [1600, 900]
'@humus/bootstrap': {}
'@humus/combat': {}
'@humus/core': {}
'@humus/core/electron': {}
'@humus/farm': {}
'@humus/inventory': {}
'@humus/universe':
'@humus/bootstrap:./packages/bootstrap': {}
'@humus/combat:./packages/combat': {}
'@humus/core:./packages/core': {}
'@humus/farm:./packages/farm': {}
'@humus/inventory:./packages/inventory': {}
'@humus/universe:./packages/universe':
resource: '../persea/projects/c41ddaac-89c2-46a4-b3e5-1d634a1a7c36'

View File

@ -17,7 +17,6 @@
"test": "flecks test"
},
"files": [
"electron/server.js",
"index.js",
"server.js",
"persea.js"

View File

@ -1,33 +0,0 @@
import {Flecks} from '@flecks/core';
import isElectron from 'is-electron';
const {
NODE_ENV,
} = process.env;
export const hooks = {
'@flecks/electron/server.window': Flecks.priority(
async (win) => {
// win.removeMenu();
if ('production' !== NODE_ENV) {
win.openDevTools();
}
win.maximize();
win.once('ready-to-show', () => {
win.show();
});
},
{after: '@flecks/electron/server'},
),
'@flecks/web/server.request.route': Flecks.priority(
(flecks) => async (req, res, next) => {
if (isElectron() && 0 === req.user.id) {
const {User} = flecks.db.Models;
req.logIn(await User.findByPk(1), next);
return;
}
next();
},
{after: '@flecks/passport/server'},
),
};

View File

@ -1,11 +1,39 @@
import {join} from 'path';
import {Flecks} from '@flecks/core';
import isElectron from 'is-electron';
const {
FLECKS_CORE_ROOT = process.cwd(),
NODE_ENV,
} = process.env;
export const hooks = {
'@flecks/electron/server.browserWindowOptions.alter': (browserWindowOptions) => {
browserWindowOptions.icon = join(FLECKS_CORE_ROOT, 'icon.png');
},
'@flecks/electron/server.window': Flecks.priority(
async (win) => {
// win.removeMenu();
if ('production' !== NODE_ENV) {
win.openDevTools();
}
win.maximize();
win.once('ready-to-show', () => {
win.show();
});
},
{after: '@flecks/electron/server'},
),
'@flecks/web/server.request.route': Flecks.priority(
(flecks) => async (req, res, next) => {
if (isElectron() && 0 === req.user.id) {
const {User} = flecks.db.Models;
req.logIn(await User.findByPk(1), next);
return;
}
next();
},
{after: '@flecks/passport/server'},
),
};