Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] code review #10

Closed
wants to merge 2 commits into from
Closed

[DO NOT MERGE] code review #10

wants to merge 2 commits into from

Conversation

atian25
Copy link
Member

@atian25 atian25 commented Aug 17, 2016

看了一遍源码, 提了点建议, @popomore @fengmk2 看看

正文补充下讨论结果:

  • 干掉 loadExtend/app 目录的兼容 feat: [BREAKING_CHANGE] remove compatible support loadExtend #12
  • config 会被加载执行两次, 需补充到文档
  • egg-core jsdocs 走查
    • this._options
    • XxApplication 示例
  • loadPlugin 暴露出 plugin 是在哪里定义和引入的
  • loadFile 同名函数导致的递归误解
  • Don't
    • plugin 可以作为 devDeps
    • 增加对 app/router/index.js 的支持
    • getLoadUnit()经常会被 map, 是不是直接提供 getLoadDirs('app/middleware')?

@mention-bot
Copy link

@atian25, thanks for your PR! By analyzing the annotation information on this pull request, we identified @popomore to be a potential reviewer

@@ -19,6 +19,7 @@ module.exports = {
app.use(router.middleware());

// 加载 router.js
// 增加对 app/router/index.js 的支持? 当 router 比较多的时候有分文件的需求
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得这里可以自己 require

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

router.js 和 router 目录? 两个在一起有点怪怪的.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是自己选择的,放 app 下也可以,router 代码放一个查询起来更方便

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@atian25
Copy link
Member Author

atian25 commented Aug 17, 2016

@popomore 加了几点 bee70cb

@@ -130,6 +130,7 @@ class EggLoader {
*
* ```
* // lib/xx.js
* // 这里需要修改示例, egg-core ?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const EggCore = require('egg-core').EggCore;

class XxApplication extends EggCore {
  constructor(options) {
    super(options);
  }

  get [Symbol.for('egg#eggPath')]() {
    return path.join(__dirname, '..');
  }
}

@popomore
Copy link
Member

可以把一些没有争议的评论删了,然后有些能改的先改了,不能改了提到 issue 里

@popomore
Copy link
Member

这个改下?

@atian25
Copy link
Member Author

atian25 commented Aug 18, 2016

好, 我整理到 issue 去, 这个 close 掉. 讨论内容保留.

@atian25
Copy link
Member Author

atian25 commented Aug 18, 2016

@popomore 整理到顶楼了

@popomore
Copy link
Member

我把前面几个改了

@atian25
Copy link
Member Author

atian25 commented Aug 18, 2016

第一个我已经改了, @popomore

@atian25
Copy link
Member Author

atian25 commented Aug 18, 2016

第一个已经 PR, 其他几个你改下?

@popomore
Copy link
Member

popomore commented Aug 18, 2016

config 会被加载执行两次

这个没法改,后面的加载逻辑和前置的不一样,还得重新执行下。

@atian25
Copy link
Member Author

atian25 commented Aug 18, 2016

重新执行的这个没问题的, 只是要加到文档说明, 避免踩坑

@atian25
Copy link
Member Author

atian25 commented Aug 18, 2016

README 有个 egg**

@popomore
Copy link
Member

为啥会有坑

@atian25
Copy link
Member Author

atian25 commented Aug 18, 2016

  • 我们执行了两次, 第一次没有第二个参数, 第二次有, 这个肯定要说出来的
  • 有可能会存在在 config 里面执行一些只能执行一次的操作

@popomore
Copy link
Member

app 没有第二个参数,那我这个改下

@popomore
Copy link
Member

popomore commented Aug 18, 2016

loadPlugin 暴露出 plugin 是在哪里定义和引入的

#13

@popomore
Copy link
Member

loadFile 同名函数导致的递归误解

#14

@popomore popomore mentioned this pull request Aug 18, 2016
31 tasks
@popomore popomore closed this Aug 18, 2016
@atian25 atian25 deleted the code-review branch August 19, 2016 02:17
fengmk2 added a commit that referenced this pull request Jan 13, 2023
```bash
egg start timeline:
▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ [289ms] - #0 Process Start
                  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ [510ms] - #1 Application Start
                  ▇ [2ms] - #2 Load Plugin
                  ▇ [1ms] - #3 Load Config
                  ▇ [0ms] - #4 Require(0) ~/eggjs/egg-core/test/fixtures/egg/config/config.default.js
                  ▇ [0ms] - #5 Require(1) ~/eggjs/egg-core/test/fixtures/egg/config/config.unittest.js
                  ▇ [0ms] - #6 Load extend/application.js
                  ▇ [0ms] - #7 Require(2) ~/eggjs/egg-core/test/fixtures/egg/app/extend/application.js
                  ▇ [1ms] - #8 Load extend/context.js
                  ▇ [0ms] - #9 Load extend/request.js
                  ▇ [0ms] - #10 Load extend/response.js
                  ▇ [1ms] - #11 Load app.js
                  ▇ [0ms] - #12 Require(3) ~/eggjs/egg-core/test/fixtures/egg/node_modules/session/app.js
                  ▇ [0ms] - #13 Require(4) app.js
                  ▇▇▇▇▇▇ [101ms] - #14 readyCallback in a
                  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ [501ms] - #15 readyCallback in b
                  ▇ [4ms] - #16 Load Middleware
                  ▇ [4ms] - #17 Load "middlewares" to Application
                  ▇ [2ms] - #18 Load Service
                  ▇ [2ms] - #19 Load "service" to Context
                  ▇ [0ms] - #20 Load Controller
                  ▇ [0ms] - #21 Load "controller" to Application
                  ▇ [0ms] - #22 Load Router
```
fengmk2 added a commit that referenced this pull request Jan 13, 2023
```bash
egg start timeline:
▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ [289ms] - #0 Process Start
                  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ [510ms] - #1 Application Start
                  ▇ [2ms] - #2 Load Plugin
                  ▇ [1ms] - #3 Load Config
                  ▇ [0ms] - #4 Require(0) ~/eggjs/egg-core/test/fixtures/egg/config/config.default.js
                  ▇ [0ms] - #5 Require(1) ~/eggjs/egg-core/test/fixtures/egg/config/config.unittest.js
                  ▇ [0ms] - #6 Load extend/application.js
                  ▇ [0ms] - #7 Require(2) ~/eggjs/egg-core/test/fixtures/egg/app/extend/application.js
                  ▇ [1ms] - #8 Load extend/context.js
                  ▇ [0ms] - #9 Load extend/request.js
                  ▇ [0ms] - #10 Load extend/response.js
                  ▇ [1ms] - #11 Load app.js
                  ▇ [0ms] - #12 Require(3) ~/eggjs/egg-core/test/fixtures/egg/node_modules/session/app.js
                  ▇ [0ms] - #13 Require(4) app.js
                  ▇▇▇▇▇▇ [101ms] - #14 readyCallback in a
                  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ [501ms] - #15 readyCallback in b
                  ▇ [4ms] - #16 Load Middleware
                  ▇ [4ms] - #17 Load "middlewares" to Application
                  ▇ [2ms] - #18 Load Service
                  ▇ [2ms] - #19 Load "service" to Context
                  ▇ [0ms] - #20 Load Controller
                  ▇ [0ms] - #21 Load "controller" to Application
                  ▇ [0ms] - #22 Load Router
```
atian25 pushed a commit that referenced this pull request Jan 13, 2023
[skip ci]

## [5.3.0](v5.2.0...v5.3.0) (2023-01-13)

### Features

* support show app.timing in timline string ([#260](#260)) ([5b7af12](5b7af12)), closes [#0](https://github.com/eggjs/egg-core/issues/0) [#1](#1) [#2](#2) [#3](#3) [#4](#4) [#5](#5) [#6](#6) [#7](#7) [#8](#8) [#9](#9) [#10](#10) [#11](#11) [#12](#12) [#13](#13) [#14](#14) [#15](#15) [#16](#16) [#17](#17) [#18](#18) [#19](#19) [#20](#20) [#21](#21) [#22](#22)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants