Added support for React installed in the application via Cocoapods

Summary:
Similarly to npm-installed react, this change makes changes to the packager so that it understands that it's been installed via Cocoapods and determines the project and asset roots properly (from the main application directory).
Closes https://github.com/facebook/react-native/pull/1568
Github Author: Jarek Potiuk <jarek@potiuk.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
This commit is contained in:
Jarek Potiuk 2015-06-22 03:12:35 -07:00
parent 90aad9a610
commit 2cb0546d15
1 changed files with 5 additions and 0 deletions

View File

@ -66,6 +66,9 @@ if (options.projectRoots) {
if (__dirname.match(/node_modules\/react-native\/packager$/)) {
// packager is running from node_modules of another project
options.projectRoots = [path.resolve(__dirname, '../../..')];
} else if (__dirname.match(/Pods\/React\/packager$/)) {
// packager is running from node_modules of another project
options.projectRoots = [path.resolve(__dirname, '../../..')];
} else {
options.projectRoots = [path.resolve(__dirname, '..')];
}
@ -88,6 +91,8 @@ if (options.assetRoots) {
} else {
if (__dirname.match(/node_modules\/react-native\/packager$/)) {
options.assetRoots = [path.resolve(__dirname, '../../..')];
} else if (__dirname.match(/Pods\/React\/packager$/)) {
options.assetRoots = [path.resolve(__dirname, '../../..')];
} else {
options.assetRoots = [path.resolve(__dirname, '..')];
}