* Specify `.xcworkspace` on run instructions instead of `.xcodeproj`
* Add `command-exists` package
* Remove unneeded space after log message
* Run `pod install` and check for cocoa pods when running `init` command
* Put pods installation directly on `init` file and verify if `Podfile` exists before running
* Revert change to space
* Remove unneeded `console.log`
* `cd` back to the directory after pod installation
* Throw with `CLIError` instead of `Error`
* Remove unneeded `try…catch`
* Fix wrong uppercased word
* Try to install `cocoapods` without sudo before trying with it
* Run pods installation only on macOS
* Check which extension for the project to print out on the run instructions for iOS
* Use `fs` instead of `fs-extra`
* Move `installPods` to separate file
* Add missing `logger` import
* Fix warnings on duplicated variable declaration
* fixups
* wip
* Finish it up
* Clean up packages
* Move files around
* Simplify regex
* Remove unused type
* Move packages around
* Fix type
* Update snapshot
* Make snapshot even smaller
* Throw unlink error
Summary:
---------
Historically, Android and iOS platform were hardcoded inside CLI and provided by default. Then, other packages could export additional platforms on top of it.
React Native as a platform was hardcoded in Metro configuration (default platforms, default extensions) and inside link. That means all new features were always developed with these platforms in mind, leaving others behind. We often used private APIs, which made things more complicated for 3rd party platform developers.
From this PR on, there's no longer concept of an out-of-tree platform inside of the CLI. In a follow up PR to React Native, I am going to configure iOS and Android platforms inside React Native, just like React Native Windows exposes Windows platform.
This will open room for improvements and should make it even easier for the CLI to welcome other platforms.
* Implement spinners for initializing flow
* Use execa module
* Change banner
* Ignore silent flag when in verbose mode
* Refactor packageManager test
* Change loader exports
* Fix e2e test
* Rename packageManager
* Add e2e test
* smaller paddings for React logo
* Cleanup tests
* fix flowfixme
* add space for post install script
* rename packageManager.test as well
Summary:
---------
This pull requests brings a new way of configuring the CLI and drops never properly standardised and documented "rnpm" configuration.
This is done in order to support new "auto-linking" feature and consolidate the configuration into a single place, that is easy to customise by developers.
### Highlights
Given the scope of this PR, it's hard to write down every tiny detail. I've tried to leave as many comments as possible throughout the code to make it easier for you to navigate and understand some of the code patterns.
Please see the highlighted changes below:
- We now use `cosmiconfig` to load user preferences. We do that by taking "react-native" out of "package.json" and reading "react-native.config.js". We still read "rnpm" for legacy purposes and print appropriate deprecation messages along the instructions on what to do in order to upgrade. Jest validation library makes this kind of things super easy.
- We validate the provided configuration by user using Jest validation library. This gives instant feedback whether the configuration is correct or not.
- We now read configuration in a single place (happens in main CLI file) and pass it down to commands. Previously, we used to call `findPlugins` multiple times w/o cache, causing expensive globs to be performed.
- Project configuration is lazy. We won't glob node_modules and/or look for native files unless you explicitly read for that package configuration.
- Better support for out-of-tree-platforms - no need to define "haste" yourself, we are able to infer it from other properties. The files are also better organised now, causing less of maintenance pain with "linkConfig"
- We consider our automatically generated configuration a set of defaults. Users can override settings for the project and each of the dependencies. Useful, especially with auto-linking feature to disable certain packages from it or when you don't want to link particular platform automatically. This has been historically really hard to implement
- Global flags (e.g. "reactNativePath") can now be defined in configuration, instead of passing every time around. This fixes issues with "packager.sh" script (starting automatically Metro when running from Xcode) when run from RNTester.xcodeproj
### Next steps
Once this PR is merged, we can concurrently start working/merging other "auto-linking" PRs. In the meantime, I'll submit a PR to move regular "link" (soon to be considered a legacy) to use the new configuration format as well.
The new configuration has been designed in the way to still include previous configuration keys to support "link" and other community packages.
For now, we print handy deprecation messages to help migrate the community from "rnpm" to "react-native" configuration.
When "link" gets deprecated/removed forever in favour of "auto-linking", we should revisit the configuration and eventually, remove extraneous keys out of it. With "auto-linking", we don't need majority of it.
Test Plan:
----------
Run `react-native config` to output the configuration.