{"action":"created","issue":{"url":"https://api.github.com/repos/eggjs/egg/issues/241","repository_url":"https://api.github.com/repos/eggjs/egg","labels_url":"https://api.github.com/repos/eggjs/egg/issues/241/labels{/name}","comments_url":"https://api.github.com/repos/eggjs/egg/issues/241/comments","events_url":"https://api.github.com/repos/eggjs/egg/issues/241/events","html_url":"https://github.com/eggjs/egg/issues/241","id":200113768,"number":241,"title":"egg-scripts 部署脚本","user":{"login":"popomore","id":360661,"avatar_url":"https://avatars2.githubusercontent.com/u/360661?v=3","gravatar_id":"","url":"https://api.github.com/users/popomore","html_url":"https://github.com/popomore","followers_url":"https://api.github.com/users/popomore/followers","following_url":"https://api.github.com/users/popomore/following{/other_user}","gists_url":"https://api.github.com/users/popomore/gists{/gist_id}","starred_url":"https://api.github.com/users/popomore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/popomore/subscriptions","organizations_url":"https://api.github.com/users/popomore/orgs","repos_url":"https://api.github.com/users/popomore/repos","events_url":"https://api.github.com/users/popomore/events{/privacy}","received_events_url":"https://api.github.com/users/popomore/received_events","type":"User","site_admin":false},"labels":[{"id":548775765,"url":"https://api.github.com/repos/eggjs/egg/labels/tools:%20egg-scripts","name":"tools: egg-scripts","color":"C7DEF8","default":false}],"state":"open","locked":false,"assignee":{"login":"popomore","id":360661,"avatar_url":"https://avatars2.githubusercontent.com/u/360661?v=3","gravatar_id":"","url":"https://api.github.com/users/popomore","html_url":"https://github.com/popomore","followers_url":"https://api.github.com/users/popomore/followers","following_url":"https://api.github.com/users/popomore/following{/other_user}","gists_url":"https://api.github.com/users/popomore/gists{/gist_id}","starred_url":"https://api.github.com/users/popomore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/popomore/subscriptions","organizations_url":"https://api.github.com/users/popomore/orgs","repos_url":"https://api.github.com/users/popomore/repos","events_url":"https://api.github.com/users/popomore/events{/privacy}","received_events_url":"https://api.github.com/users/popomore/received_events","type":"User","site_admin":false},"assignees":[{"login":"popomore","id":360661,"avatar_url":"https://avatars2.githubusercontent.com/u/360661?v=3","gravatar_id":"","url":"https://api.github.com/users/popomore","html_url":"https://github.com/popomore","followers_url":"https://api.github.com/users/popomore/followers","following_url":"https://api.github.com/users/popomore/following{/other_user}","gists_url":"https://api.github.com/users/popomore/gists{/gist_id}","starred_url":"https://api.github.com/users/popomore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/popomore/subscriptions","organizations_url":"https://api.github.com/users/popomore/orgs","repos_url":"https://api.github.com/users/popomore/repos","events_url":"https://api.github.com/users/popomore/events{/privacy}","received_events_url":"https://api.github.com/users/popomore/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/eggjs/egg/milestones/2","html_url":"https://github.com/eggjs/egg/milestone/2","labels_url":"https://api.github.com/repos/eggjs/egg/milestones/2/labels","id":2249153,"number":2,"title":"1.x","description":"","creator":{"login":"dead-horse","id":985607,"avatar_url":"https://avatars0.githubusercontent.com/u/985607?v=3","gravatar_id":"","url":"https://api.github.com/users/dead-horse","html_url":"https://github.com/dead-horse","followers_url":"https://api.github.com/users/dead-horse/followers","following_url":"https://api.github.com/users/dead-horse/following{/other_user}","gists_url":"https://api.github.com/users/dead-horse/gists{/gist_id}","starred_url":"https://api.github.com/users/dead-horse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dead-horse/subscriptions","organizations_url":"https://api.github.com/users/dead-horse/orgs","repos_url":"https://api.github.com/users/dead-horse/repos","events_url":"https://api.github.com/users/dead-horse/events{/privacy}","received_events_url":"https://api.github.com/users/dead-horse/received_events","type":"User","site_admin":false},"open_issues":22,"closed_issues":9,"state":"open","created_at":"2017-01-13T05:47:15Z","updated_at":"2017-03-24T10:07:33Z","due_on":"2017-02-28T08:00:00Z","closed_at":null},"comments":50,"created_at":"2017-01-11T14:52:56Z","updated_at":"2017-03-27T02:54:42Z","closed_at":null,"body":"## 功能\r\n\r\n- [ ] 构建\r\n  - [ ] 支持 nodeinstall\r\n  - [ ] 支持语言层编译，如 typescript, babel\r\n  - [ ] 自定义构建，如静态文件编译\r\n- [ ] 启动\r\n\r\n## 构建\r\n\r\n环境依赖 cnpm，cnpm 会根据配置自动安装 node 到应用包中（[需要实现](https://github.com/cnpm/cnpm/issues/165)）。\r\n\r\n应用添加 `install-node` 配置 node 版本，并添加 egg-scripts 依赖\r\n\r\n```json\r\n{\r\n  \"dependencies\": {\r\n    \"egg-scripts\": \"*\"\r\n  },\r\n  \"engines\": {\r\n    \"install-node\": \"6.9.1\"\r\n  }\r\n}\r\n```\r\n\r\n构建顺序\r\n\r\n1. 下载应用代码\r\n1. 在应用代码执行 `cnpm install --production`\r\n1. 执行 `egg-scripts build`\r\n    1. 预编译处理（ts，babel 等）\r\n    1. 调用应用的 scripts.build（一般常用于处理静态文件构建）\r\n    1. 修改 scripts.start/scripts.stop 指向 egg-scripts\r\n\r\n## 启动\r\n\r\negg 构建出的应用包没有任何依赖，可直接部署\r\n\r\n1. 设置环境变量 `PATH={app_root}/node_modules/.bin:$PATH`\r\n1. 启动 `npm start` 或 `egg-scripts start`\r\n\r\n## 扩展\r\n\r\n如果框架想提供部署功能，那么可以在框架层依赖 `egg-scripts`，这样应用就不需要添加了。但是层级比较深，可以在 postinstall 修改 `./node_modules/.bin/egg-scripts`.\r\n\r\negg-scritps 主要提供 build 扩展，可以继承 egg-scritps 处理自定义逻辑。\r\n"},"comment":{"url":"https://api.github.com/repos/eggjs/egg/issues/comments/289342135","html_url":"https://github.com/eggjs/egg/issues/241#issuecomment-289342135","issue_url":"https://api.github.com/repos/eggjs/egg/issues/241","id":289342135,"user":{"login":"leonardodream","id":25942638,"avatar_url":"https://avatars0.githubusercontent.com/u/25942638?v=3","gravatar_id":"","url":"https://api.github.com/users/leonardodream","html_url":"https://github.com/leonardodream","followers_url":"https://api.github.com/users/leonardodream/followers","following_url":"https://api.github.com/users/leonardodream/following{/other_user}","gists_url":"https://api.github.com/users/leonardodream/gists{/gist_id}","starred_url":"https://api.github.com/users/leonardodream/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leonardodream/subscriptions","organizations_url":"https://api.github.com/users/leonardodream/orgs","repos_url":"https://api.github.com/users/leonardodream/repos","events_url":"https://api.github.com/users/leonardodream/events{/privacy}","received_events_url":"https://api.github.com/users/leonardodream/received_events","type":"User","site_admin":false},"created_at":"2017-03-27T02:54:42Z","updated_at":"2017-03-27T02:54:42Z","body":"哦哦哦 @atian25 "}}
{"actor":{"display_login":"leonardodream"}}