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