From ef4117822390648a9228ee1d365bc056d095138b Mon Sep 17 00:00:00 2001 From: Abhishek Soni Date: Thu, 16 Mar 2017 18:32:19 +0530 Subject: [PATCH 1/6] Added Known Issues section --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 1151522f..3c8a0417 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Create React Native App allows you to work with all of the [Components and APIs] * [Getting Started](#getting-started) * [Philosophy](#philosophy) +* [Known Issues](#known-issues) * [Support and Contact](#support-and-contact) * [FAQs](#faqs) * [Contributing](#contributing) @@ -88,6 +89,15 @@ This will start the process of "ejecting" from Create React Native App's build s * **One Build Tool**: If you just want to get started with React Native, you shouldn't need to install Xcode, Android Studio, NDKs, or mess with environment variables. * **No Lock-In**: You can always "eject" to your own build setup if you need to write custom native code or modify how your app is built. +## Known Issues + +There are some issues that have been identified by us and are documented here: + +* **QR code can't be scanned when using Webstorm's built-in terminal** [#49](https://github.com/react-community/create-react-native-app/issues/49) + + That's because Webstorm's `built-in terminal` renders the bash color codes differently, thereby obscuring the QR code generated by the `CLI`. Please **use your OS's terminal(cmd in windows)**, to resolve this issue. + + ## Support and Contact If you're having issues with Create React Native App, please make sure: From 932858a3ca8788bd5ba4a327867e5d4e97923d55 Mon Sep 17 00:00:00 2001 From: Abhishek Soni Date: Fri, 17 Mar 2017 10:06:15 +0530 Subject: [PATCH 2/6] Revert "Prevent 'yarnpkg not found' error from displaying to users." This reverts commit a52eac9eb57ef4c54eedaf769d607e2de04a9af3. Reset last commit --- create-react-native-app/package.json | 2 +- create-react-native-app/src/index.js | 63 +++++++++++++--------------- 2 files changed, 30 insertions(+), 35 deletions(-) diff --git a/create-react-native-app/package.json b/create-react-native-app/package.json index 37ed7610..89a7799a 100644 --- a/create-react-native-app/package.json +++ b/create-react-native-app/package.json @@ -1,6 +1,6 @@ { "name": "create-react-native-app", - "version": "0.0.6", + "version": "0.0.5", "description": "Create React Native apps with no build configuration.", "license": "BSD-3-Clause", "keywords": ["react-native", "react"], diff --git a/create-react-native-app/src/index.js b/create-react-native-app/src/index.js index be88ccfd..20b38beb 100755 --- a/create-react-native-app/src/index.js +++ b/create-react-native-app/src/index.js @@ -40,19 +40,6 @@ if (commands.length === 0) { createApp(commands[0], !!argv.verbose, argv['scripts-version']).then(() => {}); -// use yarn if it's available, otherwise use npm -function shouldUseYarn() { - try { - const result = spawn.sync('yarnpkg', ['--version'], { stdio: 'ignore' }); - if (result.error || result.status !== 0) { - return false; - } - return true; - } catch (e) { - return false; - } -} - async function createApp(name: string, verbose: boolean, version: ?string): Promise { const root = path.resolve(name); const appName = path.basename(root); @@ -91,37 +78,45 @@ function install( verbose: boolean, callback: (code: number, command: string, args: Array) => Promise ): void { - const useYarn = shouldUseYarn(); - let args, cmd, result; - - if (useYarn) { - cmd = 'yarnpkg'; - args = ['add']; + let args = ['add', '--dev', '--exact', '--ignore-optional', packageToInstall]; + const proc = spawn('yarnpkg', args, { stdio: 'inherit' }); - if (verbose) { - args.push('--verbose'); + let yarnExists = true; + proc.on('error', function(err) { + if (err.code === 'ENOENT') { + yarnExists = false; } + }); - args = args.concat(['--dev', '--exact', '--ignore-optional', packageToInstall]); - result = spawn.sync(cmd, args, { stdio: 'inherit' }); - } else { + proc.on('close', function(code) { + if (yarnExists) { + callback(code, 'yarnpkg', args).then( + () => {}, + e => { + throw e; + } + ); + return; + } + // No Yarn installed, continuing with npm. args = ['install']; if (verbose) { args.push('--verbose'); } - cmd = 'npm'; - args = args.concat(['--save-dev', '--save-exact', packageToInstall]); - result = spawn.sync(cmd, args, { stdio: 'inherit' }); - } + args = args.concat(['--save-dev', '--save-exact', packageToInstall]); - callback(result.status, cmd, args).then( - () => {}, - e => { - throw e; - } - ); + const npmProc = spawn('npm', args, { stdio: 'inherit' }); + npmProc.on('close', function(code) { + callback(code, 'npm', args).then( + () => {}, + e => { + throw e; + } + ); + }); + }); } async function run( From f53bee308bf49459b2212fac1761a6ed05096bc6 Mon Sep 17 00:00:00 2001 From: Abhishek Soni Date: Fri, 17 Mar 2017 10:09:43 +0530 Subject: [PATCH 3/6] Revert "Added Known Issues section" This reverts commit ef4117822390648a9228ee1d365bc056d095138b. Undo Last Commit --- README.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/README.md b/README.md index 3c8a0417..1151522f 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,6 @@ Create React Native App allows you to work with all of the [Components and APIs] * [Getting Started](#getting-started) * [Philosophy](#philosophy) -* [Known Issues](#known-issues) * [Support and Contact](#support-and-contact) * [FAQs](#faqs) * [Contributing](#contributing) @@ -89,15 +88,6 @@ This will start the process of "ejecting" from Create React Native App's build s * **One Build Tool**: If you just want to get started with React Native, you shouldn't need to install Xcode, Android Studio, NDKs, or mess with environment variables. * **No Lock-In**: You can always "eject" to your own build setup if you need to write custom native code or modify how your app is built. -## Known Issues - -There are some issues that have been identified by us and are documented here: - -* **QR code can't be scanned when using Webstorm's built-in terminal** [#49](https://github.com/react-community/create-react-native-app/issues/49) - - That's because Webstorm's `built-in terminal` renders the bash color codes differently, thereby obscuring the QR code generated by the `CLI`. Please **use your OS's terminal(cmd in windows)**, to resolve this issue. - - ## Support and Contact If you're having issues with Create React Native App, please make sure: From 4f3ea78781b98124ec44002f8d6a2bdcab1311e8 Mon Sep 17 00:00:00 2001 From: Abhishek Soni Date: Fri, 17 Mar 2017 10:12:01 +0530 Subject: [PATCH 4/6] Revert "Revert "Added Known Issues section"" This reverts commit f53bee308bf49459b2212fac1761a6ed05096bc6. UNDO --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 1151522f..3c8a0417 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Create React Native App allows you to work with all of the [Components and APIs] * [Getting Started](#getting-started) * [Philosophy](#philosophy) +* [Known Issues](#known-issues) * [Support and Contact](#support-and-contact) * [FAQs](#faqs) * [Contributing](#contributing) @@ -88,6 +89,15 @@ This will start the process of "ejecting" from Create React Native App's build s * **One Build Tool**: If you just want to get started with React Native, you shouldn't need to install Xcode, Android Studio, NDKs, or mess with environment variables. * **No Lock-In**: You can always "eject" to your own build setup if you need to write custom native code or modify how your app is built. +## Known Issues + +There are some issues that have been identified by us and are documented here: + +* **QR code can't be scanned when using Webstorm's built-in terminal** [#49](https://github.com/react-community/create-react-native-app/issues/49) + + That's because Webstorm's `built-in terminal` renders the bash color codes differently, thereby obscuring the QR code generated by the `CLI`. Please **use your OS's terminal(cmd in windows)**, to resolve this issue. + + ## Support and Contact If you're having issues with Create React Native App, please make sure: From 08693effec00bfbce61713f5b03a99afc9fb43af Mon Sep 17 00:00:00 2001 From: Abhishek Soni Date: Fri, 17 Mar 2017 10:12:58 +0530 Subject: [PATCH 5/6] Revert "Revert "Prevent 'yarnpkg not found' error from displaying to users."" This reverts commit 932858a3ca8788bd5ba4a327867e5d4e97923d55. Correct Error Revert --- create-react-native-app/package.json | 2 +- create-react-native-app/src/index.js | 63 +++++++++++++++------------- 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/create-react-native-app/package.json b/create-react-native-app/package.json index 89a7799a..37ed7610 100644 --- a/create-react-native-app/package.json +++ b/create-react-native-app/package.json @@ -1,6 +1,6 @@ { "name": "create-react-native-app", - "version": "0.0.5", + "version": "0.0.6", "description": "Create React Native apps with no build configuration.", "license": "BSD-3-Clause", "keywords": ["react-native", "react"], diff --git a/create-react-native-app/src/index.js b/create-react-native-app/src/index.js index 20b38beb..be88ccfd 100755 --- a/create-react-native-app/src/index.js +++ b/create-react-native-app/src/index.js @@ -40,6 +40,19 @@ if (commands.length === 0) { createApp(commands[0], !!argv.verbose, argv['scripts-version']).then(() => {}); +// use yarn if it's available, otherwise use npm +function shouldUseYarn() { + try { + const result = spawn.sync('yarnpkg', ['--version'], { stdio: 'ignore' }); + if (result.error || result.status !== 0) { + return false; + } + return true; + } catch (e) { + return false; + } +} + async function createApp(name: string, verbose: boolean, version: ?string): Promise { const root = path.resolve(name); const appName = path.basename(root); @@ -78,45 +91,37 @@ function install( verbose: boolean, callback: (code: number, command: string, args: Array) => Promise ): void { - let args = ['add', '--dev', '--exact', '--ignore-optional', packageToInstall]; - const proc = spawn('yarnpkg', args, { stdio: 'inherit' }); + const useYarn = shouldUseYarn(); + let args, cmd, result; - let yarnExists = true; - proc.on('error', function(err) { - if (err.code === 'ENOENT') { - yarnExists = false; - } - }); + if (useYarn) { + cmd = 'yarnpkg'; + args = ['add']; - proc.on('close', function(code) { - if (yarnExists) { - callback(code, 'yarnpkg', args).then( - () => {}, - e => { - throw e; - } - ); - return; + if (verbose) { + args.push('--verbose'); } - // No Yarn installed, continuing with npm. + + args = args.concat(['--dev', '--exact', '--ignore-optional', packageToInstall]); + result = spawn.sync(cmd, args, { stdio: 'inherit' }); + } else { args = ['install']; if (verbose) { args.push('--verbose'); } - + cmd = 'npm'; args = args.concat(['--save-dev', '--save-exact', packageToInstall]); - const npmProc = spawn('npm', args, { stdio: 'inherit' }); - npmProc.on('close', function(code) { - callback(code, 'npm', args).then( - () => {}, - e => { - throw e; - } - ); - }); - }); + result = spawn.sync(cmd, args, { stdio: 'inherit' }); + } + + callback(result.status, cmd, args).then( + () => {}, + e => { + throw e; + } + ); } async function run( From c13e40e231f668f1212b90379745cc7c3610453a Mon Sep 17 00:00:00 2001 From: Abhishek Soni Date: Fri, 17 Mar 2017 10:14:21 +0530 Subject: [PATCH 6/6] Revert "Revert "Revert "Added Known Issues section""" This reverts commit 4f3ea78781b98124ec44002f8d6a2bdcab1311e8. Remove Known Issues Section --- README.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/README.md b/README.md index 3c8a0417..1151522f 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,6 @@ Create React Native App allows you to work with all of the [Components and APIs] * [Getting Started](#getting-started) * [Philosophy](#philosophy) -* [Known Issues](#known-issues) * [Support and Contact](#support-and-contact) * [FAQs](#faqs) * [Contributing](#contributing) @@ -89,15 +88,6 @@ This will start the process of "ejecting" from Create React Native App's build s * **One Build Tool**: If you just want to get started with React Native, you shouldn't need to install Xcode, Android Studio, NDKs, or mess with environment variables. * **No Lock-In**: You can always "eject" to your own build setup if you need to write custom native code or modify how your app is built. -## Known Issues - -There are some issues that have been identified by us and are documented here: - -* **QR code can't be scanned when using Webstorm's built-in terminal** [#49](https://github.com/react-community/create-react-native-app/issues/49) - - That's because Webstorm's `built-in terminal` renders the bash color codes differently, thereby obscuring the QR code generated by the `CLI`. Please **use your OS's terminal(cmd in windows)**, to resolve this issue. - - ## Support and Contact If you're having issues with Create React Native App, please make sure: