mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: load ts files only
This commit is contained in:
2 files changed
+2
-2
No files matched your search
@@ -68,7 +68,7 @@ export const service = getLoader('service', 'service');
|
||||
export async function builtinModel(ctx: Context) {
|
||||
const modelDir = path.resolve(__dirname, '..', 'model');
|
||||
const models = await fs.readdir(modelDir);
|
||||
for (const t of models) {
|
||||
for (const t of models.filter((i) => i.endsWith('.ts'))) {
|
||||
const q = path.resolve(modelDir, t);
|
||||
if ('apply' in require(q)) ctx.loader.reloadPlugin(ctx, q, {}, `hydrooj/model/${t.split('.')[0]}`);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ export async function apply(ctx: Context) {
|
||||
|
||||
const handlerDir = path.resolve(__dirname, '..', 'handler');
|
||||
const handlers = await fs.readdir(handlerDir);
|
||||
for (const h of handlers) {
|
||||
for (const h of handlers.filter((i) => i.endsWith('.ts'))) {
|
||||
ctx.loader.reloadPlugin(ctx, path.resolve(handlerDir, h), {}, `hydrooj/handler/${h.split('.')[0]}`);
|
||||
}
|
||||
await handler(pending, fail, ctx);
|
||||
|
||||
Reference in new issue
Block a user