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)
- 七牛云拉取文件始终返回404 HOT 10
- 使用ts时tsconfig.json文件配置module只能使用CommonJS,使用ES会报错 HOT 1
- 日志切割后不是 .log 后缀, vscode 不高亮啊
- 国际化用voerkai18n实现,在中间件处理切换语言时,yarn test测试环境不生效,请问会不会是eggjs影响的? HOT 1
- 如果使用AsyncLocalStorage,如何能够在不被Egg管理的类中,也能正确地拿到上下文对象 HOT 12
- 如何升级babel 7?
- jsx as tpl HOT 1
- new version available: 2.3.1 → 3.0.0, not compatible, you must update to use this. HOT 4
- egg-bin 5以上的版本设置端口无效
- 传闻Eggjs不再维护了,是真的吗? HOT 4
- new version available: 2.3.1 → 3.0.0, not compatible, you must update to use this. HOT 7
- 同一个方法在放在eggjs服务schedule 定时模块里面执行就可以获取的到inputElem,但是放到controller模块里面通过接口调用时获取不到呢,再express里面也可以成功调用,debug模式可能获取得到 HOT 3
- v3的文档多会更新,EggLogger 怎么用????? HOT 3
- 使用问题: 请问如何在egg应用下运行脚本,以及如何在脚本中使用app中的service,helper,db等能力 HOT 1
- egg-mysql能配置连接断开后自动重连吗
- eggjs 在容器通过前台启动,如何将stdout和stderr日志输出到日志文件 HOT 1
- curl返回值类型缩小 HOT 2
- docker中启动项目失败,提示"Plugin development is disabled by env unmatched, require env([ 'local' ]) but got env is prod" HOT 2
- index.d.ts关于xframe.value的声明中“ALLOW-FROM”有问题 HOT 1
- egg怎么禁止 http 转到https, 我所有的资源,请求 都在http,现在我启动egg, 304转发到了https, 我想禁掉这个 HOT 2
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.