Skip to content

Commit

Permalink
feat: add egg definition
Browse files Browse the repository at this point in the history
  • Loading branch information
czy88840616 committed Feb 23, 2019
1 parent c9ad379 commit 5d28443
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 26 deletions.
1 change: 1 addition & 0 deletions packages/midway-definition/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './typings/egg';
28 changes: 28 additions & 0 deletions packages/midway-definition/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@midwayjs/definition",
"version": "1.3.2",
"description": "declare all midway dependencies by typescript definition",
"scripts": {
"lint": "../../node_modules/.bin/tslint --format prose -c ../../tslint.json *.ts",
"test-local": "midway-bin test",
"test": "npm run lint && midway-bin test",
"ci": "npm run lint && midway-bin cov"
},
"dependencies": {
"egg": "^2.14.2",
"egg-logger": "^2.3.1"
},
"keywords": [
"midway",
"typings",
"definition"
],
"engines": {
"node": ">= 8.0.0"
},
"author": "Harry Chen <[email protected]>",
"repository": {
"type": "git",
"url": "http://github.com/midwayjs/midway.git"
}
}
23 changes: 23 additions & 0 deletions packages/midway-definition/typings/egg/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as egg from 'egg';
import * as eggLogger from 'egg-logger';

export declare namespace Egg {
export interface Context extends egg.Context {}
export interface IContextLocals extends egg.IContextLocals {}
export type EggEnvType = egg.EggEnvType;
export interface EggPlugin extends egg.EggPlugin {}
export interface EggAppConfig extends egg.EggAppConfig {}
export interface IApplicationLocals extends egg.IApplicationLocals {}
export interface EggApplication extends egg.EggApplication {}
export interface EggAppInfo extends egg.EggAppInfo {}
export interface EggHttpClient extends egg.EggHttpClient {}
export interface EggContextHttpClient extends egg.EggContextHttpClient {}
export interface Request extends egg.Request {}
export interface Response extends egg.Response {}
export interface Router extends egg.Router {}
export interface EggLoggerOptions extends eggLogger.EggLoggerOptions {}
export type EggLoggerLevel = eggLogger.LoggerLevel;
export interface EggLogger extends eggLogger.EggLogger {}
export interface EggLoggers extends eggLogger.EggLoggers {}
export interface EggContextLogger extends eggLogger.EggContextLogger {}
}
2 changes: 0 additions & 2 deletions packages/midway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
"midway-bin": "^1.3.0"
},
"dependencies": {
"egg": "^2.14.2",
"egg-cluster": "^1.22.2",
"egg-core": "^4.13.1",
"injection": "^1.1.0",
"midway-core": "^1.3.2",
"midway-web": "^1.3.2",
Expand Down
24 changes: 0 additions & 24 deletions packages/midway/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,6 @@
export * from 'injection';
export * from 'midway-core';
export * from 'midway-web';
export {
Context,
IContextLocals,
EggEnvType,
IEggPluginItem,
EggPlugin,
PowerPartial,
EggAppConfig,
FileStream,
IApplicationLocals,
EggApplication,
EggAppInfo,
EggHttpClient,
EggContextHttpClient,
Request,
Response,
Router,
} from 'egg';
export {
LoggerLevel as EggLoggerLevel,
EggLogger,
EggLoggers,
EggContextLogger,
} from 'egg-logger';
const Master = require('../cluster/master');

/**
Expand Down

0 comments on commit 5d28443

Please sign in to comment.