chore: @gkd-kit/api

This commit is contained in:
AIsouler
2024-03-05 23:11:00 +08:00
parent 31c13ed2ac
commit 46d3cc2008
7 changed files with 26 additions and 626 deletions

View File

@@ -4,15 +4,17 @@ import url from 'node:url';
import picocolors from 'picocolors';
import { pinyin } from 'pinyin-pro';
import { walk } from './file';
import type { RawApp } from './types';
import type { RawAppAddProp } from './types';
import { OPEN_AD_ORDER } from './utils';
const rawApps: RawApp[] = [];
const rawApps: RawAppAddProp[] = [];
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: RawAppAddProp } = await import(
url.pathToFileURL(tsFp).href
);
const appConfig = mod.default;
if (path.basename(tsFp, '.ts') != appConfig.id) {
throw new Error(