- 有的项目根路径为 '' ,比如 http://xx.xxx.com
- 有的项目根路径为 '/abs' ,比如 http://xx.xxx.com/abs
基础项目中 URL_CONTEXT 设置为 '',如果实际项目中 URL_CONTEXT 不是 '',需要修改项目中对应的变量值
- /common/constants.js URL_CONTEXT
At first, generate dll file. You need to exec the following command.
npm run dll
npm start
npm run start:beta # 测试环境
npm run start:prod # 线上环境
npm run git-branch [branchAlias]
branchAlias 为可选参数,用来标示分支名称
NODE_ENV=development npm run build
NODE_ENV=beta npm run build
NODE_ENV=production npm run build
NODE_ENV=production ANALYZE=true npm run build
npm run lint
npm run lint:css
npm run lint:js
npm run fix
npm run fix:css
npm run fix:js
npm run css-prefix
npm test
If you writ unit test incremental, you should use the following command, it will save compile time.
npm run test-watch
npm run check-coverage
说明,用来查看测试通过率,后面的参数值可以修改,分别是表达式,条件分支,函数,行数 百分比
"check-coverage": "nyc check-coverage --statements 100 --branches 100 --functions 100 --lines 100"
- ava : 测试框架,类似于 mocha jest jasmine QUnit 等 官网:https://github.com/avajs/ava 中文指南:https://github.com/avajs/ava-docs/blob/master/zh_CN/readme.md
- enzyme : React 测试工具,依赖 react-addons-test-utils 可以类似 jquery 风格的 api 操作 react 节点 官网:https://github.com/airbnb/enzyme 文档:http://airbnb.io/enzyme/ http://airbnb.io/enzyme/docs/installation/index.html
- sinon : 提供 fake 数据, 替换函数调用等功能 官网:http://sinonjs.org/
- nyc : JS code coverage tool that computes statement, line, function and branch coverage(用来检测单元测试覆盖率) 官网:https://github.com/istanbuljs/nyc Note: With this configuration, the Istanbul instrumentation will only be active when NODE_ENV or BABEL_ENV is test.
- nock: 用来模拟 http 请求测试用 官网:https://github.com/node-nock/nock
- 参考文章
由于私服不能连接外网下载安装 node-sass 过程中需要的文件,故 forked 了包含 node-sass 依赖的包, 重新发布了带 vendor 的 node-sass 和依赖 node-sass 的包,新的依赖包名称对应关系如下
官方的依赖 | 加入 vendor 的依赖 | 官方当前版本 |
---|---|---|
node-sass | node-sass-vendor | 4.9.3 |
sass-loader-joy-vendor | sass-loader | 7.1.0 |
注意:如官方有新版本时,可以重新 forked 更新自定义的依赖包
https://github.com/joy-web/react-redux-router-base/issues
Please view here