2015-10-20 23:58:13 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var blacklist = require('../packager/blacklist');
|
|
|
|
var path = require('path');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Default configuration for the CLI.
|
|
|
|
*
|
|
|
|
* If you need to override any of this functions do so by defining the file
|
|
|
|
* `rn-cli.config.js` on the root of your project with the functions you need
|
|
|
|
* to tweak.
|
|
|
|
*/
|
|
|
|
var config = {
|
|
|
|
getProjectRoots() {
|
2015-10-24 01:47:26 +00:00
|
|
|
return getRoots();
|
2015-10-20 23:58:13 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Specify where to look for assets that are referenced using
|
|
|
|
* `image!<image_name>`. Asset directories for images referenced using
|
|
|
|
* `./<image.extension>` don't require any entry in here.
|
|
|
|
*/
|
|
|
|
getAssetRoots() {
|
2015-10-24 01:47:26 +00:00
|
|
|
return getRoots();
|
2015-10-20 23:58:13 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a regular expression for modules that should be ignored by the
|
|
|
|
* packager on a given platform.
|
|
|
|
*/
|
|
|
|
getBlacklistRE(platform) {
|
|
|
|
return blacklist(platform);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-10-24 01:47:26 +00:00
|
|
|
function getRoots() {
|
|
|
|
if (__dirname.match(/node_modules[\/\\]react-native[\/\\]local-cli$/)) {
|
2015-11-12 15:35:32 +00:00
|
|
|
// Packager is running from node_modules.
|
|
|
|
// This is the default case for all projects created using 'react-native init'.
|
2015-10-24 01:47:26 +00:00
|
|
|
return [path.resolve(__dirname, '../../..')];
|
|
|
|
} else if (__dirname.match(/Pods[\/\\]React[\/\\]packager$/)) {
|
2015-11-12 15:35:32 +00:00
|
|
|
// React Native was installed using CocoaPods.
|
2015-10-24 01:47:26 +00:00
|
|
|
return [path.resolve(__dirname, '../../..')];
|
|
|
|
} else {
|
|
|
|
return [path.resolve(__dirname, '..')];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-20 23:58:13 +00:00
|
|
|
module.exports = config;
|