2016-09-23 14:59:59 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
|
|
|
'use strict';
|
2015-10-20 23:58:13 +00:00
|
|
|
|
|
|
|
var blacklist = require('../packager/blacklist');
|
|
|
|
var path = require('path');
|
2016-08-22 15:56:14 +00:00
|
|
|
var rnpmConfig = require('./core/config');
|
2015-10-20 23:58:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 = {
|
2016-11-24 13:28:29 +00:00
|
|
|
getProjectRoots,
|
2015-10-20 23:58:13 +00:00
|
|
|
|
2016-07-30 15:59:16 +00:00
|
|
|
getProjectConfig: rnpmConfig.getProjectConfig,
|
|
|
|
getDependencyConfig: rnpmConfig.getDependencyConfig,
|
|
|
|
|
2016-08-02 17:13:13 +00:00
|
|
|
/**
|
|
|
|
* Specify any additional asset extentions to be used by the packager.
|
|
|
|
* For example, if you want to include a .ttf file, you would return ['ttf']
|
|
|
|
* from here and use `require('./fonts/example.ttf')` inside your app.
|
|
|
|
*/
|
|
|
|
getAssetExts() {
|
|
|
|
return [];
|
|
|
|
},
|
|
|
|
|
2016-12-02 17:41:28 +00:00
|
|
|
/**
|
|
|
|
* Specify any additional platforms to be used by the packager.
|
|
|
|
* For example, if you want to add a "custom" platform, and use modules
|
|
|
|
* ending in .custom.js, you would return ['custom'] here.
|
|
|
|
*/
|
|
|
|
getPlatforms() {
|
|
|
|
return [];
|
|
|
|
},
|
|
|
|
|
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.
|
|
|
|
*/
|
2016-09-23 14:59:59 +00:00
|
|
|
getBlacklistRE() {
|
|
|
|
return blacklist();
|
2016-06-22 15:08:28 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the path to a custom transformer. This can also be overridden
|
|
|
|
* with the --transformer commandline argument.
|
|
|
|
*/
|
|
|
|
getTransformModulePath() {
|
|
|
|
return require.resolve('../packager/transformer');
|
|
|
|
},
|
2015-10-20 23:58:13 +00:00
|
|
|
};
|
|
|
|
|
2016-11-24 13:28:29 +00:00
|
|
|
function getProjectRoots() {
|
2016-04-07 14:38:23 +00:00
|
|
|
var root = process.env.REACT_NATIVE_APP_ROOT;
|
|
|
|
if (root) {
|
|
|
|
return [path.resolve(root)];
|
|
|
|
}
|
2015-10-24 01:47:26 +00:00
|
|
|
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;
|