Skip to content

Commit

Permalink
feat: 优化 剔除所有内置插件 只留初始化核心逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
wangw19 committed Apr 20, 2023
1 parent 05b8eba commit a2c57aa
Show file tree
Hide file tree
Showing 55 changed files with 44 additions and 2,002 deletions.
3 changes: 2 additions & 1 deletion packages/errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.0.1-beta.14",
"main": "./dist/index.js",
"typings": "dist/index.d.ts",
"description": "yunfly error.",
"scripts": {
"build": "gts clean && tsc",
"dev": "tsc --watch"
Expand All @@ -17,4 +18,4 @@
"dist"
],
"license": "MIT"
}
}
2 changes: 1 addition & 1 deletion packages/loggers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
"winston": "^3.7.2",
"winston-daily-rotate-file": "^4.6.1"
}
}
}
1 change: 1 addition & 0 deletions packages/yunfly-bin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
],
"dependencies": {
"@yunflyjs/ts-node-dev": "2.0.0",
"cross-spawn": "^7.0.3",
"commander": "9.0.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/yunfly-cluster/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
"devDependencies": {
"@yunflyjs/loggers": "0.0.1-beta.14"
}
}
}
6 changes: 0 additions & 6 deletions packages/yunfly-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,19 @@
"build"
],
"dependencies": {
"@types/cookie": "^0.4.1",
"@types/koa": "^2.13.4",
"@types/lodash": "^4.14.171",
"@yunflyjs/errors": "0.0.1-beta.14",
"@yunflyjs/loggers": "0.0.1-beta.14",
"@yunflyjs/routing-controllers": "0.9.0",
"@yunflyjs/yunfly-cluster": "0.0.1-beta.14",
"chalk": "^4.1.0",
"chokidar": "^3.5.1",
"commander": "^7.2.0",
"cross-spawn": "^7.0.3",
"deepmerge": "^4.2.2",
"find-process": "^1.4.5",
"graceful-process": "^1.2.0",
"lodash": "^4.17.21",
"node-schedule": "^1.3.2",
"prom-client": "^14.0.0",
"sendmessage": "^1.1.0",
"socket.io": "^2.3.0",
"typedi": "^0.8.0"
}
}
10 changes: 0 additions & 10 deletions packages/yunfly-core/src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@ export const DEFAULT_SCHEDULE_DIR = path
.join(process.cwd(), `${ENV_SRC}/schedule/`)
.replace(/\\/g, '//');

// socket middleware 文件夹
export const SOCKET_MIDDLEWARE_DIR = path
.join(process.cwd(), `${ENV_SRC}/socket/middleware/`)
.replace(/\\/g, '//');

// socket main 函数入口
export const SOCKET_CONTROLLER_MAIN = path
.join(process.cwd(), `${ENV_SRC}/socket/controller/MainController`)
.replace(/\\/g, '//');

// alone 文件夹
export const DEFAULT_ALONE_DIR = path.join(process.cwd(), `${ENV_SRC}/alone/`).replace(/\\/g, '//');

Expand Down
31 changes: 0 additions & 31 deletions packages/yunfly-core/src/core/current-context.ts

This file was deleted.

5 changes: 0 additions & 5 deletions packages/yunfly-core/src/core/plugin-hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export function beforeStartPluginHook(config: Config): Promise<any> {
return new Plugin({
koaApp: {} as KoaApp,
config: config,
yunflyApp: {} as Yunfly.YunflyAppConfig,
lifeHook: 'beforeStart',
}).init();
}
Expand All @@ -32,14 +31,12 @@ export function beforeStartPluginHook(config: Config): Promise<any> {
export async function appDidReadyPluginHook(
app: KoaApp,
config: Config,
yunflyApp: Yunfly.YunflyAppConfig,
callback: Function,
) {
// 初始化plugins
return await new Plugin({
koaApp: app,
config: config,
yunflyApp,
lifeHook: 'appDidReady',
callback: callback,
}).init();
Expand All @@ -54,12 +51,10 @@ export async function appDidReadyPluginHook(
export function afterStartPluginHook(
app: KoaApp,
config: Config,
yunflyApp: Yunfly.YunflyAppConfig,
): Promise<any> {
return new Plugin({
koaApp: app as KoaApp,
config: config,
yunflyApp: yunflyApp,
lifeHook: 'afterStart',
}).init();
}
70 changes: 0 additions & 70 deletions packages/yunfly-core/src/loader/app/index.ts

This file was deleted.

36 changes: 0 additions & 36 deletions packages/yunfly-core/src/loader/controller/index.ts

This file was deleted.

31 changes: 0 additions & 31 deletions packages/yunfly-core/src/loader/index.ts

This file was deleted.

36 changes: 0 additions & 36 deletions packages/yunfly-core/src/loader/service/index.ts

This file was deleted.

43 changes: 0 additions & 43 deletions packages/yunfly-core/src/loader/types.ts

This file was deleted.

3 changes: 1 addition & 2 deletions packages/yunfly-core/src/plugin/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { PluginConfig } from '../loader/types';
import { ApolloConfig, Config } from '../type';
import { ApolloConfig, Config, PluginConfig } from '../type';
import { RUNTIME_ENV, deepMerge } from '../util';
import { getPathFromPlugin } from './utils';

Expand Down
3 changes: 1 addition & 2 deletions packages/yunfly-core/src/plugin/controllers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as path from 'path';
import { PluginConfig } from '../loader/types';
import { AnyOptionConfig, Config, KoaApp } from '../type';
import { AnyOptionConfig, Config, KoaApp, PluginConfig } from '../type';
import { getDirPaths } from '../util';
import { getPathFromPlugin } from './utils';

Expand Down
Loading

0 comments on commit a2c57aa

Please sign in to comment.