mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: cli: load server as entry object
This commit is contained in:
1 parent
5f7dae0111
commit
db0bcbac8f
2 files changed
+4
-2
No files matched your search
@@ -4,6 +4,7 @@ import path from 'path';
|
||||
import cac from 'cac';
|
||||
import fs from 'fs-extra';
|
||||
import { ObjectID } from 'mongodb';
|
||||
import { Context } from '../context';
|
||||
import db from '../service/db';
|
||||
import {
|
||||
addon, lib, model, script, service, setting,
|
||||
@@ -79,7 +80,7 @@ async function cli() {
|
||||
return console.log(result);
|
||||
}
|
||||
|
||||
export async function load(ctx) {
|
||||
export async function load(ctx: Context) {
|
||||
const pending = global.addons;
|
||||
const fail = [];
|
||||
require('../lib/i18n');
|
||||
@@ -100,6 +101,7 @@ export async function load(ctx) {
|
||||
model(pending, fail, ctx),
|
||||
setting(pending, fail, require('../model/setting')),
|
||||
]);
|
||||
await require('hydrooj/src/service/server').apply(ctx);
|
||||
await addon(pending, fail, ctx);
|
||||
const scriptDir = path.resolve(__dirname, '..', 'script');
|
||||
for (const h of await fs.readdir(scriptDir)) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "@hydrooj/utils",
|
||||
"version": "1.4.0",
|
||||
"description": "hydrooj utils",
|
||||
"main": "package.json",
|
||||
"main": "lib/utils.ts",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
|
||||
Reference in new issue
Block a user