Skip to content

Commit a44d9a2

Browse files
committed
feat: add typescript support
1 parent 0612374 commit a44d9a2

File tree

5 files changed

+2945
-1332
lines changed

5 files changed

+2945
-1332
lines changed

.autod.conf.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@ module.exports = {
1212
'egg',
1313
'egg-ci',
1414
'egg-bin',
15+
'egg-path-matching',
1516
'autod',
1617
'autod-egg',
1718
'eslint',
1819
'eslint-config-egg',
19-
'webstorm-disable-index',
20+
'http-proxy-middleware',
21+
'koa2-connect',
22+
'lodash',
23+
'webstorm-disable-index'
2024
],
2125
exclude: [
2226
'./test/fixtures',

.travis.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
sudo: false
22
language: node_js
33
node_js:
4-
- '8'
5-
- '9'
4+
- '13'
5+
- '12'
6+
- '10'
7+
before_install:
8+
- npm i npminstall -g
69
install:
7-
- npm i npminstall && npminstall
10+
- npminstall
811
script:
912
- npm run ci
1013
after_script:

index.d.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import 'egg';
2+
import * as httpProxyMiddleware from 'http-proxy-middleware';
3+
4+
declare module 'egg' {
5+
interface ProxyConfigMap {
6+
[url: string]: string | httpProxyMiddleware.Config;
7+
}
8+
9+
type ProxyConfigArrayItem = {
10+
path?: string | string[];
11+
context?: string | string[] | httpProxyMiddleware.Filter;
12+
} & httpProxyMiddleware.Config;
13+
14+
type ProxyConfigArray = ProxyConfigArrayItem[];
15+
16+
interface EggAppConfig {
17+
httpProxy: ProxyConfigMap | ProxyConfigArray;
18+
}
19+
}

package.json

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,24 @@
1515
],
1616
"dependencies": {
1717
"egg-path-matching": "^1.0.1",
18-
"http-proxy-middleware": "^0.18.0",
18+
"http-proxy-middleware": "^0.20.0",
1919
"koa2-connect": "^1.0.2",
20-
"lodash": "^4.17.10"
20+
"lodash": "^4.17.15"
2121
},
2222
"devDependencies": {
23-
"autod": "^3.0.0",
24-
"autod-egg": "^1.0.0",
25-
"egg": "^2.0.0",
26-
"egg-bin": "^4.3.0",
27-
"egg-ci": "^1.8.0",
28-
"egg-mock": "^3.13.0",
29-
"eslint": "^4.11.0",
30-
"eslint-config-egg": "^5.1.0",
31-
"express": "^4.16.3",
23+
"autod": "^3.1.0",
24+
"autod-egg": "^1.1.0",
25+
"egg": "^2.26.0",
26+
"egg-bin": "^4.14.0",
27+
"egg-ci": "^1.13.1",
28+
"egg-mock": "^3.25.0",
29+
"egg-path-matching": "^1.0.1",
30+
"eslint": "^6.8.0",
31+
"eslint-config-egg": "^8.0.0",
32+
"express": "^4.17.1",
33+
"http-proxy-middleware": "^0.20.0",
34+
"koa2-connect": "^1.0.2",
35+
"lodash": "^4.17.15",
3236
"webstorm-disable-index": "^1.2.0"
3337
},
3438
"engines": {
@@ -46,7 +50,8 @@
4650
"files": [
4751
"app",
4852
"config",
49-
"app.js"
53+
"app.js",
54+
"index.d.ts"
5055
],
5156
"ci": {
5257
"version": "8, 9"

0 commit comments

Comments
 (0)