{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/7899","repository_url":"https://api.github.com/repos/facebook/react-native","labels_url":"https://api.github.com/repos/facebook/react-native/issues/7899/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/7899/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/7899/events","html_url":"https://github.com/facebook/react-native/pull/7899","id":158230970,"number":7899,"title":"Merge `rnpm cli` into react-native","user":{"login":"grabbou","id":2464966,"avatar_url":"https://avatars.githubusercontent.com/u/2464966?v=3","gravatar_id":"","url":"https://api.github.com/users/grabbou","html_url":"https://github.com/grabbou","followers_url":"https://api.github.com/users/grabbou/followers","following_url":"https://api.github.com/users/grabbou/following{/other_user}","gists_url":"https://api.github.com/users/grabbou/gists{/gist_id}","starred_url":"https://api.github.com/users/grabbou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grabbou/subscriptions","organizations_url":"https://api.github.com/users/grabbou/orgs","repos_url":"https://api.github.com/users/grabbou/repos","events_url":"https://api.github.com/users/grabbou/events{/privacy}","received_events_url":"https://api.github.com/users/grabbou/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/react-native/labels/CLA%20Signed","name":"CLA Signed","color":"e7e7e7"},{"url":"https://api.github.com/repos/facebook/react-native/labels/GH%20Review:%20review-needed","name":"GH Review: review-needed","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2016-06-02T20:22:32Z","updated_at":"2016-06-03T10:17:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/facebook/react-native/pulls/7899","html_url":"https://github.com/facebook/react-native/pull/7899","diff_url":"https://github.com/facebook/react-native/pull/7899.diff","patch_url":"https://github.com/facebook/react-native/pull/7899.patch"},"body":"This is an initial step of rewriting the CLI interface to use `rnpm` one (commander, plugins etc.). \r\n\r\nIt's scope is to move all existing commands to use rnpm CLI interface, so that we get plugins, flags and our existing ecosystem working out of the box.\r\n\r\nThis is still WIP and some of the commands are left commented out.\r\n\r\nFor the `config` of `rnpm` (functions get info about project and dependency), I am thinking we can merge them with [`default.config.js`](https://github.com/grabbou/react-native/blob/e57683e420210749a5a6b802b4e70adb69675786/local-cli/default.config.js#L33), so they are available on the `new Config()` [instance](https://github.com/grabbou/react-native/blob/e57683e420210749a5a6b802b4e70adb69675786/local-cli/cliEntry.js#L59) (which means we don't have to change anything and current plugins, like runIOS and runAndroid can just start using it [w/o depending on any extra argument](https://github.com/grabbou/react-native/blob/e57683e420210749a5a6b802b4e70adb69675786/local-cli/runIOS/runIOS.js#L17)).\r\n\r\nRoadmap:\r\n- [ ] Unit test all the things\r\n- [ ] Bring back plugins\r\n- [ ] Port missing commands\r\n- [ ] Once the API surface is done, fix the tests that likely fail because of these changes\r\n\r\nTest plan:\r\n1. Clone the project\r\n2. npm install\r\n3. node ./local-cli/cli.js --help\r\n4. View the diff with `?w=0` to ignore indents \r\n\r\nBreaking changes for current `rnpm` developers:\r\n- the interface for a `command` did change to align with what is currently in React Native (partially to reduce the diff). See the flow definition for a final list of options allowed,\r\n- the `default` option for a flag can now be a function that receives an instance of a Config. I found it a common pattern, e.g. [here](https://github.com/grabbou/react-native/blob/e57683e420210749a5a6b802b4e70adb69675786/local-cli/server/server.js#L85-L88). If we decide to merge rnpm config into `Config`, then e.g. [here](https://github.com/grabbou/react-native/blob/e57683e420210749a5a6b802b4e70adb69675786/local-cli/runIOS/runIOS.js#L91) we can just swap default value from `ios` to `(config) => config.getProjectConfig().ios.sourceDir`\r\n- the order of arguments did change a bit (reasoning the same + some of the commands are plain no-config ones), the first one is now `argv`, the 2nd one is `config`, which means they are swapped.\r\n\r\nQuestions:\r\n- Commander requires us to specify a name for the flag value, e.g. `--path [string]` where `[ ]` indicates its optional. I don't have strong opinion on that and for now decided to go with a name of the type, e.g. string, list, boolean, number. I am thinking we can name them e.g. path, host, relativePath, absolutePath etc. for better DX."},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/223543513","html_url":"https://github.com/facebook/react-native/pull/7899#issuecomment-223543513","issue_url":"https://api.github.com/repos/facebook/react-native/issues/7899","id":223543513,"user":{"login":"facebook-github-bot-7","id":8397364,"avatar_url":"https://avatars.githubusercontent.com/u/8397364?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook-github-bot-7","html_url":"https://github.com/facebook-github-bot-7","followers_url":"https://api.github.com/users/facebook-github-bot-7/followers","following_url":"https://api.github.com/users/facebook-github-bot-7/following{/other_user}","gists_url":"https://api.github.com/users/facebook-github-bot-7/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook-github-bot-7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook-github-bot-7/subscriptions","organizations_url":"https://api.github.com/users/facebook-github-bot-7/orgs","repos_url":"https://api.github.com/users/facebook-github-bot-7/repos","events_url":"https://api.github.com/users/facebook-github-bot-7/events{/privacy}","received_events_url":"https://api.github.com/users/facebook-github-bot-7/received_events","type":"User","site_admin":false},"created_at":"2016-06-03T10:17:15Z","updated_at":"2016-06-03T10:17:15Z","body":"@grabbou updated the pull request."}}
{"actor":{"display_login":"facebook-github-bot-7"}}