Skip to content

Commit cb74322

Browse files
committed
feat: use new code style
1 parent f3dcd8a commit cb74322

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed
Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
import { EggAppConfig } from 'egg'
1+
import { EggAppConfig, PowerPartial } from 'egg';
22
import { readFileSync } from 'fs'
33
import { join } from 'path'
44

5-
import defaultConfig from './defaultConfig'
65

6+
// for config.{env}.ts
7+
export type DefaultConfig = PowerPartial<EggAppConfig>;
78

89
export default (appInfo: EggAppConfig) => {
9-
const config: any = {}
10-
11-
// should change to your own for every new project!
12-
config.keys = appInfo.name + 1234567890
10+
const config = <PowerPartial<EggAppConfig>> {}
1311

1412
/**
1513
* some description
@@ -20,15 +18,14 @@ export default (appInfo: EggAppConfig) => {
2018
key: appInfo.name + '_123456',
2119
}
2220

23-
// config.siteFile = {
24-
// '/favicon.ico': readFileSync(join(appInfo.baseDir, 'app/public/favicon.png')),
25-
// }
26-
2721
config.view = {
2822
defaultViewEngine: 'nunjucks',
2923
mapping: { '.tpl': 'nunjucks' },
3024
}
3125

26+
config.siteFile = {
27+
'/favicon.ico': readFileSync(join(appInfo.baseDir, 'app/public/favicon.png')),
28+
};
3229

33-
return { ...config, ...defaultConfig }
30+
return config;
3431
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { DefaultConfig } from './config.default';
2+
3+
export default () => {
4+
const config: DefaultConfig = {};
5+
6+
return config;
7+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { DefaultConfig } from './config.default';
2+
3+
export default () => {
4+
const config: DefaultConfig = {};
5+
6+
return config;
7+
};

framework-ts/yadan/config/defaultConfig.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
'use strict';
12

2-
// add you build-in plugin here, example:
3-
export const nunjucks = {
4-
enable: true,
5-
package: 'egg-view-nunjucks',
6-
}
3+
export default {
4+
nunjucks: {
5+
enable: true,
6+
package: 'egg-view-nunjucks',
7+
},
8+
};

0 commit comments

Comments
 (0)