react-native/local-cli
Antony Chan 1031872784 check isAvailable key on simulator object (#21557)
Summary:
With the new xcode command line tools (10.1 beta2), running `xcrun simctl list --json devices` seems to gives us a slightly different format than what we were expecting. More specifically, the `availability` key is changed to `isAvailable` and returns `'YES'` if the simulator is available:

Before:
```js
devices: {
  'iOS 9.2': [
    {
      state: 'Shutdown',
      availability: '(unavailable, runtime profile not found)',
      name: 'iPhone 4s',
      udid: 'B9B5E161-416B-43C4-A78F-729CB96CC8C6',
    },
    {
      state: 'Shutdown',
      availability: '(unavailable, runtime profile not found)',
      name: 'iPhone 5',
      udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB',
    },
    ...
   ]
}
```
After:
```js
devices: {
  'iOS 12.1': [
    {
      state: 'Shutdown',
      isAvailable: 'YES',
      name: 'iPhone 6s',
      udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508',
    },
    {
      state: 'Shutdown',
      isAvailable: 'YES',
      name: 'iPhone 6',
      udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C',
    },
    ...
   ]
}
```

Without this fix, `npm run ios` is not able to launch the simulator correctly and returns the following error:

```
Could not find iPhone 6 simulator

Error: Could not find iPhone 6 simulator
    at resolve (/Users/antonyc/Projects/AwesomeProject/node_modules/react-native/local-cli/runIOS/runIOS.js:148:13)
    at new Promise (<anonymous>)
    at runOnSimulator (/Users/antonyc/Projects/AwesomeProject/node_modules/react-native/local-cli/runIOS/runIOS.js:134:10)
    at Object.runIOS [as func] (/Users/antonyc/Projects/AwesomeProject/node_modules/react-native/local-cli/runIOS/runIOS.js:106:12)
    at Promise.resolve.then (/Users/antonyc/Projects/AwesomeProject/node_modules/react-native/local-cli/cliEntry.js:117:22)
```
Pull Request resolved: https://github.com/facebook/react-native/pull/21557

Differential Revision: D10248115

Pulled By: TheSavior

fbshipit-source-id: 37197bbf828e4a6e254270d46411a6716a91afe3
2018-10-08 23:17:37 -07:00
..
__mocks__ react-native-github: set path mock to posix by default 2018-09-24 06:32:24 -07:00
bundle Prettify remaining unprettified files (#21327) 2018-09-25 19:50:08 -07:00
core Remove unused suppressions in xplat/js 2018-09-27 11:47:04 -07:00
dependencies Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
eject Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
generator Prettify remaining unprettified files (#21327) 2018-09-25 19:50:08 -07:00
info Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
init Prettify remaining unprettified files (#21327) 2018-09-25 19:50:08 -07:00
install Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
library Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
link Fix copyright headers 2018-09-28 17:33:12 -07:00
logAndroid Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
logIOS Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
runAndroid Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
runIOS check isAvailable key on simulator object (#21557) 2018-10-08 23:17:37 -07:00
server Make config object read-only 2018-09-26 16:48:48 -07:00
templates Upgrade xplat/js to Flow v0.82 2018-10-01 22:23:18 -07:00
upgrade Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
util Pass the maxWorkers config param correctly to Metro 2018-09-18 08:19:38 -07:00
.npmignore npmignore: ignore tests and fixtures 2018-02-27 08:42:14 -08:00
cli.js Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
cliEntry.js Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
commands.js Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
setup_env.bat Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
setup_env.sh Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
wrong-react-native.js Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00