diff --git a/docs/source/_data/guide_toc.yml b/docs/source/_data/guide_toc.yml index 9397e5d907..38b3023d43 100644 --- a/docs/source/_data/guide_toc.yml +++ b/docs/source/_data/guide_toc.yml @@ -36,5 +36,6 @@ Advanced: View Plugin: /advanced/view-plugin.html Community: Contributing: /contributing.html + Resource: /resource.html # Member Guide: /member_guide.html # FAQ: /faq.html diff --git a/docs/source/zh-cn/resource.md b/docs/source/zh-cn/resource.md new file mode 100644 index 0000000000..ad7f021d1f --- /dev/null +++ b/docs/source/zh-cn/resource.md @@ -0,0 +1,13 @@ +title: 资源 +--- + +## 框架列表 + +- [aliyun-egg](https://github.com/eggjs/aliyun-egg) + +## 社区文章 + +- [如何评价阿里开源的企业级 Node.js 框架 egg?](https://www.zhihu.com/question/50526101/answer/144952130) +[天猪](https://github.com/atian25) + +- 你也可以到[知乎专栏](https://zhuanlan.zhihu.com/eggjs)看我们的文章 diff --git a/docs/source/zh-cn/tutorials/async-function.md b/docs/source/zh-cn/tutorials/async-function.md index eb4f638cd8..46e4b79953 100644 --- a/docs/source/zh-cn/tutorials/async-function.md +++ b/docs/source/zh-cn/tutorials/async-function.md @@ -1,4 +1,3 @@ - title: 使用 async function 开发应用 --- diff --git a/docs/themes/egg/languages/zh-cn.yml b/docs/themes/egg/languages/zh-cn.yml index ae3323b2fc..347c0b877b 100644 --- a/docs/themes/egg/languages/zh-cn.yml +++ b/docs/themes/egg/languages/zh-cn.yml @@ -57,3 +57,4 @@ guide_toc: Contributing: 如何贡献 Member Guide: 成员指南 FAQ: 常见问题 + Resource: 资源 diff --git a/scripts/doc.js b/scripts/doc.js index befecc9fb0..f648ff8cb8 100755 --- a/scripts/doc.js +++ b/scripts/doc.js @@ -23,8 +23,8 @@ co(function* () { } console.log('Copying CONTRIBUTING.md'); - yield copyFile('CONTRIBUTING.md', 'docs/source/contributing.md'); - yield copyFile('CONTRIBUTING.zh-CN.md', 'docs/source/zh-cn/contributing.md'); + yield copyContributing('CONTRIBUTING.md', 'docs/source/en/contributing.md'); + yield copyContributing('CONTRIBUTING.zh-CN.md', 'docs/source/zh-cn/contributing.md'); yield rm('docs/public'); yield runscript('npminstall', { cwd: 'docs' }); @@ -65,9 +65,10 @@ function* deploy() { }); } -function* copyFile(src, dist) { - const buf = yield fs.readFile(src); - yield fs.writeFile(dist, buf); +function* copyContributing(src, target) { + let content = yield fs.readFile(src, 'utf8'); + content = content.replace(/^#\s*(.*?)\n/, 'title: $1\n---\n'); + yield fs.writeFile(target, content); } function rm(dir) { diff --git a/test/fixtures/apps/logger-level-debug/app/router.js b/test/fixtures/apps/logger-level-debug/app/router.js index 50eeeeb446..b9b998b884 100644 --- a/test/fixtures/apps/logger-level-debug/app/router.js +++ b/test/fixtures/apps/logger-level-debug/app/router.js @@ -1,8 +1,13 @@ 'use strict'; +const sleep = require('ko-sleep'); + + module.exports = app => { app.get('/', function*() { this.logger.debug('hi %s %s', this.method, this.url); + // wait for writing to file + yield sleep(1000); this.body = 'ok'; }); }; diff --git a/test/lib/core/messenger.test.js b/test/lib/core/messenger.test.js index 7b730fb75c..9fac3d6a77 100644 --- a/test/lib/core/messenger.test.js +++ b/test/lib/core/messenger.test.js @@ -122,17 +122,19 @@ describe('test/lib/core/messenger.test.js', () => { }); after(() => app.close()); - it('app should accept agent message', done => { - setTimeout(() => { - const m = app.stdout.match(/\d+=\d+/g); - const map = new Map(); - for (const item of m) { - const a = item.split('='); - map.set(a[0], a[1]); - } - map.size.should.equal(4); - done(); - }, 8000); + it('app should accept agent message', function* () { + yield sleep(10000); + + const m = app.stdout.match(/\d+=\d+/g); + const map = new Map(); + for (const item of m) { + const a = item.split('='); + map.set(a[0], a[1]); + } + for (const [ pid, count ] of map) { + console.log('pid: %s, %s', pid, count); + } + map.size.should.equal(4); }); });