mirror of
https://github.com/AIsouler/GKD_subscription.git
synced 2025-12-21 09:15:11 +08:00
perf: check app config file
This commit is contained in:
@@ -8,6 +8,9 @@ import type { RawApp } from './types';
|
|||||||
|
|
||||||
const rawApps: RawApp[] = [];
|
const rawApps: RawApp[] = [];
|
||||||
for await (const tsFp of walk(process.cwd() + '/src/apps')) {
|
for await (const tsFp of walk(process.cwd() + '/src/apps')) {
|
||||||
|
if (!tsFp.endsWith('.ts')) {
|
||||||
|
throw new Error('invalid typescript app config file: ' + tsFp);
|
||||||
|
}
|
||||||
const mod: { default: RawApp } = await import(url.pathToFileURL(tsFp).href);
|
const mod: { default: RawApp } = await import(url.pathToFileURL(tsFp).href);
|
||||||
const appConfig = mod.default;
|
const appConfig = mod.default;
|
||||||
if (path.basename(tsFp, '.ts') != appConfig.id) {
|
if (path.basename(tsFp, '.ts') != appConfig.id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user