Comments (14)
cc @eggjs/core
from egg.
- egg 在文档中全部以小写出现?
- plugin name 即便出现在首行,也都用小写?
- 写 plugin name 的时候,要不要都带上
egg-
?
我的建议是
- 小写
- 小写
- 带
其他一些遇到的文档细节约定都在这里讨论吧
@fengmk2 @dead-horse @popomore
from egg.
写 plugin name 的时候,要不要都带上 egg-?
这个不需要吧,模块名称带 egg-,但是插件名称不需要。
from egg.
egg 全小写这个之前讨论过的,不能首字母大写和全大写
from egg.
我们现在有很多插件是 userService 这样命名的。。
from egg.
命名这个讨论过。
- 最简单的pacakge name:
@ali/egg-xx
,@alipay/egg-xx
,pluginName 为全小写xx
- 比较长的用中划线package name
@ali/egg-foo-bar
,@alipay/egg-foo-bar
,对应的 pluginName 使用小驼峰,小驼峰转换规则以 package name 的中划线为准fooBar
对于可以中划线也可以不用的情况,不做强制约定,例如 sessiontair
(@alipay/egg-sessiontair
) 还是 sessionTair
(@alipay/egg-session-tair
),userservice
(@alipay/egg-userservice
) 还是 user-service
(@ali/egg-user-service
)。只要遵循以上规则即可,如果选择用中划线,就要按照小驼峰命名 pluginName。
链接不贴了 issue 188
from egg.
这个命名规范回头可以移植到 docs 下
from egg.
就按 @shaoshuai0102 说的来吧。
from egg.
注释和文档里面出现的代码, 建议都在第一行加上文件地址
// {app_root}/config/plugin.js
exports.session = {
};
from egg.
其实这个就是约定,社区肯定会存在驼峰党和非驼峰党
from egg.
egg 保留的 Symbol 就用全局的,之后可以整理出来
- Symbol.for('egg#eggPath')
- Symbol.for('egg#view')
from egg.
单元测试
before
记得调用app.ready
let app;
before(function* () {
app = mm.app({
baseDir: 'security',
});
yield app.ready();
});
supertest
2.x 后支持 promise 了, 可以使用:
it('test', function* (){
const result = yield require(app.callback()).get('/');
assert(result.text.match(/hi, egg/));
});
- 使用
power-assert
替换掉 should , 已经内置到egg-bin
1) Array #indexOf() should return index when the value is present:
AssertionError: # path/to/test/mocha_node.js:10
assert(this.ary.indexOf(zero) === two)
| | | | |
| | | | 2
| -1 0 false
[1,2,3]
[number] two
=> 2
[number] this.ary.indexOf(zero)
=> -1
from egg.
那可以不用 supertest-as-promise 了?
from egg.
不用了
from egg.
Related Issues (20)
- extend/application.js空导出,导致接口返回404 HOT 1
- 文档链接显示错误
- 依照官网初始化项目 HOT 1
- eggjs处理服务端请求有超时时间吗 HOT 3
- 在 service 中 extends egg 暴露的 Service 项目无法启动 HOT 1
- egg-router-plus 根 router 应该支持正则 HOT 1
- 能否将依赖的urllib升级为3.25的系列,而不是现在的2.41.0 HOT 2
- 怎么在没有app上下文的文件中 获取config中的配置? HOT 4
- 使用 oxlint 代替 eslint HOT 5
- egg 运行一段时间后,就会退出 HOT 1
- Track Progress of PR #5332 Towards Merging into Master
- Follow-up on PR #5334: Allow to create httpClient from app
- Track merging PR #5336 into master branch
- 服务器 egg-scrips start 无法启动,一直提示文件找不到。但是本地能正常运行 HOT 5
- Track merging of PR #5339 into master
- Track bugfix for httpclient.safeCurl typing
- eggjs返回的响应头为什么是使用小写? HOT 4
- 初始化项目跑不起来 HOT 1
- 为什么在服务启动命令中添加参数在服务生命周期中获取不到? HOT 2
- enableH2 开启的时候使用 undici v6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from egg.