{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/10626","repository_url":"https://api.github.com/repos/facebook/react-native","labels_url":"https://api.github.com/repos/facebook/react-native/issues/10626/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/10626/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/10626/events","html_url":"https://github.com/facebook/react-native/pull/10626","id":186084326,"number":10626,"title":"[cli] Use yarn when available","user":{"login":"mkonicek","id":346214,"avatar_url":"https://avatars.githubusercontent.com/u/346214?v=3","gravatar_id":"","url":"https://api.github.com/users/mkonicek","html_url":"https://github.com/mkonicek","followers_url":"https://api.github.com/users/mkonicek/followers","following_url":"https://api.github.com/users/mkonicek/following{/other_user}","gists_url":"https://api.github.com/users/mkonicek/gists{/gist_id}","starred_url":"https://api.github.com/users/mkonicek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkonicek/subscriptions","organizations_url":"https://api.github.com/users/mkonicek/orgs","repos_url":"https://api.github.com/users/mkonicek/repos","events_url":"https://api.github.com/users/mkonicek/events{/privacy}","received_events_url":"https://api.github.com/users/mkonicek/received_events","type":"User","site_admin":false},"labels":[{"id":172176599,"url":"https://api.github.com/repos/facebook/react-native/labels/GH%20Review:%20review-needed","name":"GH Review: review-needed","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":{"login":"bestander","id":2121048,"avatar_url":"https://avatars.githubusercontent.com/u/2121048?v=3","gravatar_id":"","url":"https://api.github.com/users/bestander","html_url":"https://github.com/bestander","followers_url":"https://api.github.com/users/bestander/followers","following_url":"https://api.github.com/users/bestander/following{/other_user}","gists_url":"https://api.github.com/users/bestander/gists{/gist_id}","starred_url":"https://api.github.com/users/bestander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bestander/subscriptions","organizations_url":"https://api.github.com/users/bestander/orgs","repos_url":"https://api.github.com/users/bestander/repos","events_url":"https://api.github.com/users/bestander/events{/privacy}","received_events_url":"https://api.github.com/users/bestander/received_events","type":"User","site_admin":false},"assignees":[{"login":"bestander","id":2121048,"avatar_url":"https://avatars.githubusercontent.com/u/2121048?v=3","gravatar_id":"","url":"https://api.github.com/users/bestander","html_url":"https://github.com/bestander","followers_url":"https://api.github.com/users/bestander/followers","following_url":"https://api.github.com/users/bestander/following{/other_user}","gists_url":"https://api.github.com/users/bestander/gists{/gist_id}","starred_url":"https://api.github.com/users/bestander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bestander/subscriptions","organizations_url":"https://api.github.com/users/bestander/orgs","repos_url":"https://api.github.com/users/bestander/repos","events_url":"https://api.github.com/users/bestander/events{/privacy}","received_events_url":"https://api.github.com/users/bestander/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2016-10-29T15:29:16Z","updated_at":"2016-11-01T15:16:19Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/facebook/react-native/pulls/10626","html_url":"https://github.com/facebook/react-native/pull/10626","diff_url":"https://github.com/facebook/react-native/pull/10626.diff","patch_url":"https://github.com/facebook/react-native/pull/10626.patch"},"body":"**Motivation**\r\n\r\n`react-native init` takes minutes even on a fast network. Yarn makes it much quicker.\r\n\r\nWhen yarn is not installed on the system:\r\n\r\n<img width=\"440\" alt=\"screenshot 2016-10-31 22 21 19\" src=\"https://cloud.githubusercontent.com/assets/346214/19873897/7bad5662-9fb9-11e6-85fb-ad4879949dad.png\">\r\n\r\nWhen yarn is installed:\r\n\r\n<img width=\"441\" alt=\"screenshot 2016-10-31 22 02 20\" src=\"https://cloud.githubusercontent.com/assets/346214/19873898/7baf4c56-9fb9-11e6-96b3-007f93d2438a.png\">\r\n\r\nAlso added the option `react-native init AwesomeApp --npm` as a fallback in case yarn is not stable enough for some people (I saw some Github issues that yarn hangs for example; for me it works great though).\r\n\r\n**Test plan**\r\n1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli\r\n2. `react-native init AwesomeApp`\r\n\r\n***Tested the following setups***\r\n\r\n- New CLI - uses yarn, new react-native - uses yarn\r\n- Old CLI (1.0.0) - doesn't use yarn, new react-native - uses yarn\r\n- New CLI - uses yarn, react-native 0.36.0 - doesn't use yarn\r\n\r\nNOTE: Yarn 14 failed with a _missing manifest_ error: https://github.com/yarnpkg/yarn/issues/454. Upgrading to Yarn 0.16.1 fixed it. To be safe let's check yarn version is at least 16.\r\n\r\nOutput (total time 45s):\r\n\r\n```\r\n$ react-native init ytest\r\nThis will walk you through creating a new React Native project in /Users/mkonicek/code/testapps/ytest\r\nUsing yarn v0.16.1\r\nInstalling react-native...\r\nSetting up new React Native app in /Users/mkonicek/code/testapps/ytest\r\n(node:79575) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.\r\n(node:79575) DeprecationWarning: Using Buffer without `new` will soon stop working. Use `new Buffer()`, or preferably `Buffer.from()`, `Buffer.allocUnsafe()` or `Buffer.alloc()` instead.\r\nInstalling React...\r\nInstalling Jest...\r\nwarning jest > jest-cli > istanbul-api > fileset > minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue\r\nwarning Unmet peer dependency \"whatwg-fetch@^1.0.0\".\r\nTo run your app on iOS:\r\n   cd /Users/mkonicek/code/testapps/ytest\r\n   react-native run-ios\r\n   - or -\r\n   Open /Users/mkonicek/code/testapps/ytest/ios/ytest.xcodeproj in Xcode\r\n   Hit the Run button\r\nTo run your app on Android:\r\n   Have an Android emulator running (quickest way to get started), or a device connected\r\n   cd /Users/mkonicek/code/testapps/ytest\r\n   react-native run-android\r\n```\r\n\r\nThe node DeprecationWarnings might be because I'm using node v7.0.0.\r\n\r\nRunning the generated app on iOS (reload JS works):\r\n\r\n<img width=\"487\" alt=\"screenshot 2016-10-29 17 04 37\" src=\"https://cloud.githubusercontent.com/assets/346214/19831103/e00df1f0-9df9-11e6-9bf3-a7603a0d7132.png\">\r\n"},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/257593716","html_url":"https://github.com/facebook/react-native/pull/10626#issuecomment-257593716","issue_url":"https://api.github.com/repos/facebook/react-native/issues/10626","id":257593716,"user":{"login":"mkonicek","id":346214,"avatar_url":"https://avatars.githubusercontent.com/u/346214?v=3","gravatar_id":"","url":"https://api.github.com/users/mkonicek","html_url":"https://github.com/mkonicek","followers_url":"https://api.github.com/users/mkonicek/followers","following_url":"https://api.github.com/users/mkonicek/following{/other_user}","gists_url":"https://api.github.com/users/mkonicek/gists{/gist_id}","starred_url":"https://api.github.com/users/mkonicek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkonicek/subscriptions","organizations_url":"https://api.github.com/users/mkonicek/orgs","repos_url":"https://api.github.com/users/mkonicek/repos","events_url":"https://api.github.com/users/mkonicek/events{/privacy}","received_events_url":"https://api.github.com/users/mkonicek/received_events","type":"User","site_admin":false},"created_at":"2016-11-01T15:16:19Z","updated_at":"2016-11-01T15:16:19Z","body":"Fixed nits. The function `getYarnVersionIfAvailable` is duplicated because the files are in two separate npm packages. We could try a prepublish script to copy the file over from one to another but duplicating this bit of code seems simpler and easier to understand.."}}
{"actor":{"display_login":"mkonicek"}}