0.1.2 • Published 3 years ago
egg-crc-framework v0.1.2
egg-crc-framework
CRC专属Egg开发框架,将通用的context
、helper
、middleware
、plugin
收集到此框架内。
上手开发
$ znpm i
$ npm test
publish your framework to npm, then change app's framework config:
// {app_root}/package.json
{
"name": "projectName",
"egg": {
"framework": "egg-crc-framework"
}
}
本地测试
当修改了内容需要到项目中测试,为了避免频繁的发布包,可使用npm link
命令,具体参考链接
# 本项目
$ npm link
# 测试项目
$ npm link egg-crc-framework
发布
- 在测试没问题之后,需要先跑
test
检查。
$ npm test
# 登录账号,任意填写
$ znpm login
# 发布
$ znpm publish
其他事项
ctx.getRequestSource
来源pluginegg-zzc-detector
(同样发布到内网npm)。- 维护
index.d.ts
,有利于typescript
项目能够知道此框架扩展了哪些具体的方法。 - 使用
npm link
来测试框架时遇见项目的egg-core
和框架的egg-core
冲突。 Symbol.for('egg#eggPath') is required on Application | https://github.com/eggjs/egg/issues/3591
// node_modules/egg-core/lib/loader/egg_loader.js, L262.
if (proto === Object.prototype || proto === EggCore.prototype || proto.constructor.name === 'EggCore') {
break;
}
0.1.2
3 years ago