{"action":"created","issue":{"url":"https://api.github.com/repos/zuiidea/antd-admin/issues/770","repository_url":"https://api.github.com/repos/zuiidea/antd-admin","labels_url":"https://api.github.com/repos/zuiidea/antd-admin/issues/770/labels{/name}","comments_url":"https://api.github.com/repos/zuiidea/antd-admin/issues/770/comments","events_url":"https://api.github.com/repos/zuiidea/antd-admin/issues/770/events","html_url":"https://github.com/zuiidea/antd-admin/pull/770","id":308493572,"number":770,"title":"Refact/migrate to umi","user":{"login":"sorrycc","id":35128,"avatar_url":"https://avatars1.githubusercontent.com/u/35128?v=4","gravatar_id":"","url":"https://api.github.com/users/sorrycc","html_url":"https://github.com/sorrycc","followers_url":"https://api.github.com/users/sorrycc/followers","following_url":"https://api.github.com/users/sorrycc/following{/other_user}","gists_url":"https://api.github.com/users/sorrycc/gists{/gist_id}","starred_url":"https://api.github.com/users/sorrycc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sorrycc/subscriptions","organizations_url":"https://api.github.com/users/sorrycc/orgs","repos_url":"https://api.github.com/users/sorrycc/repos","events_url":"https://api.github.com/users/sorrycc/events{/privacy}","received_events_url":"https://api.github.com/users/sorrycc/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":23,"created_at":"2018-03-26T09:22:11Z","updated_at":"2018-03-29T03:41:49Z","closed_at":"2018-03-29T02:17:07Z","author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/zuiidea/antd-admin/pulls/770","html_url":"https://github.com/zuiidea/antd-admin/pull/770","diff_url":"https://github.com/zuiidea/antd-admin/pull/770.diff","patch_url":"https://github.com/zuiidea/antd-admin/pull/770.patch"},"body":"Close #769 \r\n\r\n## 好处\r\n\r\n1. 大量配置和 package.json 依赖减少\r\n1. 无需手动注册 models\r\n1. 无需 router.js，以及手动处理 model 和 route component 按需加载等\r\n1. [duck 模式](https://medium.freecodecamp.org/scaling-your-redux-app-with-ducks-6115955638be)的目录结构，更清晰写\r\n1. query-string 无需引入和使用\r\n1. PWA 等性能优化方案\r\n\r\n## 前后对比\r\n\r\n1. 启动时间，umi 启动并自动打开 dashboard 32s（开 dll 16s），关闭按需编译并自动打开 dashboard 41s（开 dll 21s），roadhog 版本启动 42s，开 dll 17s\r\n1. 构建时间，umi 105.90s，开 eslint 校验 108.49s, roadhog 96.21s\r\n1. 构建产物，js + css 部分，umi 6.32M, roadhog 6.67M\r\n1. 构建产物文件数，umi 25 个，多了几个动态加载的 model，roadhog 23 个\r\n\r\n<img src='https://shipusercontent.com/f39d1a12f6efd6259bde1adb3d738fc9/Pasted%20Image%201.png' title='Pasted Image 1.png' width=541>\r\n\r\n## 其他调整\r\n\r\n1. 把一些 dependencies 和 devDependencies 调整了位置，devDependencies 是工具，dependencies 是运行时依赖，比如 less-vars-to-js，dva-model-extend、cross-env\r\n1. version 的发布机制换成 hash\r\n1. alias 配在 .babelrc，这样 test 也可以用\r\n1. /src/public -> /public，框架自动会 copy\r\n1. /src/mock -> /mock，/mock 才会自动 reload\r\n1. babel-polyfill -> `@babel/polyfill`\r\n1. 全局 layout 放 layouts/index.js，基于约定\r\n1. routers/error -> pages/404.js，基于约定\r\n1. polyfill 放在 global.js，基于约定\r\n1. test 随着文件走，比如 a.js，那么建个 a.test.js 做测试，而不要单独建一个 test 文件夹\r\n"},"comment":{"url":"https://api.github.com/repos/zuiidea/antd-admin/issues/comments/377111487","html_url":"https://github.com/zuiidea/antd-admin/pull/770#issuecomment-377111487","issue_url":"https://api.github.com/repos/zuiidea/antd-admin/issues/770","id":377111487,"user":{"login":"superlbr","id":8142164,"avatar_url":"https://avatars0.githubusercontent.com/u/8142164?v=4","gravatar_id":"","url":"https://api.github.com/users/superlbr","html_url":"https://github.com/superlbr","followers_url":"https://api.github.com/users/superlbr/followers","following_url":"https://api.github.com/users/superlbr/following{/other_user}","gists_url":"https://api.github.com/users/superlbr/gists{/gist_id}","starred_url":"https://api.github.com/users/superlbr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superlbr/subscriptions","organizations_url":"https://api.github.com/users/superlbr/orgs","repos_url":"https://api.github.com/users/superlbr/repos","events_url":"https://api.github.com/users/superlbr/events{/privacy}","received_events_url":"https://api.github.com/users/superlbr/received_events","type":"User","site_admin":false},"created_at":"2018-03-29T03:41:49Z","updated_at":"2018-03-29T03:41:49Z","author_association":"COLLABORATOR","body":"@sorrycc model的复用改如何处理，比如一个page对应多个model"}}
{"actor":{"display_login":"superlbr"}}