core: cli: load server as entry object

This commit is contained in:
undefined committed 2022-09-27 11:16:08 +08:00
1 parent 5f7dae0111
commit db0bcbac8f
2 files changed
+4 -2

No files matched your search

+3 -1
View File
@@ -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)) {
+1 -1
View File
@@ -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",