refactor: priority

This commit is contained in:
cha0s 2024-01-09 23:02:33 -06:00
parent 0879069d54
commit c87cca3813
3 changed files with 52 additions and 84 deletions

View File

@ -38,10 +38,6 @@
'@humus/core/persea': {}
'@flecks/core':
id: 'persea'
# '@flecks/core/server':
# profile:
# - http
# - server
'@flecks/db': {}
'@flecks/db/server':
port: 32362
@ -52,15 +48,8 @@
backgroundColor: '#212121'
show: false
quitOnClosed: false
window:
- '...'
- '@persea/core'
'@flecks/governor': {}
'@flecks/react':
providers:
- '@flecks/redux'
- '@flecks/react/router'
- '...'
'@flecks/react': {}
'@flecks/react/router': {}
'@flecks/redis': {}
'@flecks/redis/server':
@ -71,38 +60,13 @@
'@flecks/server':
nodeArgs:
- '--inspect'
# - '--log-deopt'
# - '--log-ic'
# - '--logfile=/home/cha0s/yuge/tmp/v8.log'
up:
- '@flecks/docker'
- '@flecks/db'
- '@flecks/redis'
- '@flecks/user/session'
- '@flecks/user'
- '@flecks/user/local'
- '@flecks/governor'
- '...'
- '@persea/bootstrap'
- '@flecks/web'
- '@flecks/electron'
- '@flecks/repl'
'@flecks/socket': {}
'@flecks/socket/server':
authenticate:
- '@flecks/user/session/server'
- '@flecks/user/server'
connect:
- '@flecks/socket/server'
'@flecks/socket/server': {}
'@flecks/user': {}
'@flecks/user/local': {}
'@flecks/user/session': {}
'@flecks/web': {}
'@flecks/web/client':
up:
- '@flecks/socket'
- '@flecks/react'
- '...'
'@flecks/web/client': {}
'@flecks/web/server':
devDisableHostCheck: true
dll:
@ -134,17 +98,9 @@
- 'react-window'
port: 32360
public: 'persea.localhost'
request.route:
- '@flecks/user/session'
- '@flecks/user'
- '@persea/core/electron'
- '...'
request.socket:
- '@persea/core'
- '...'
stream.html:
- '@flecks/react'
- '...'
'@persea/bootstrap': {}
'@persea/core': {}
'@persea/core/electron': {}

View File

@ -1,5 +1,8 @@
import {Flecks} from '@flecks/core';
export const hooks = {
'@flecks/server.up': async (flecks) => {
'@flecks/server.up': Flecks.priority(
async (flecks) => {
// if ('production' === NODE_ENV) {
// return;
// }
@ -18,4 +21,6 @@ export const hooks = {
await user.save();
}
},
{after: '@flecks/user/local/server'},
),
};

View File

@ -1,3 +1,4 @@
import {Flecks} from '@flecks/core';
import {join} from 'path';
import isElectron from 'is-electron';
@ -12,7 +13,8 @@ export const hooks = {
const {browserWindowOptions} = flecks.get('@flecks/electron/server');
browserWindowOptions.icon = join(FLECKS_CORE_ROOT, 'icon.png');
},
'@flecks/electron/server.window': async (win) => {
'@flecks/electron/server.window': Flecks.priority(
async (win) => {
// win.removeMenu();
if ('production' !== NODE_ENV) {
win.openDevTools();
@ -22,7 +24,10 @@ export const hooks = {
win.show();
});
},
'@flecks/web/server.request.route': (flecks) => async (req, res, next) => {
{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);
@ -30,4 +35,6 @@ export const hooks = {
}
next();
},
{after: '@flecks/user/server'},
),
};