From f1cc3ac75ad7ec00fe12689865d4fd5477d54e93 Mon Sep 17 00:00:00 2001 From: Adam Miskiewicz Date: Thu, 8 Jun 2017 22:07:16 -0700 Subject: [PATCH] Remove unused default.config.js --- local-cli/core/default.config.js | 111 ------------------------------- 1 file changed, 111 deletions(-) delete mode 100644 local-cli/core/default.config.js diff --git a/local-cli/core/default.config.js b/local-cli/core/default.config.js deleted file mode 100644 index ecfbed982c7..00000000000 --- a/local-cli/core/default.config.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * 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. - * - * @flow - */ -'use strict'; - -const path = require('path'); -const flatten = require('lodash').flatten; -const android = require('./android'); -const findAssets = require('./findAssets'); -const ios = require('./ios'); -const windows = require('./windows'); -const wrapCommands = require('./wrapCommands'); -const findPlugins = require('./findPlugins'); -const findSymlinksPaths = require('../util/findSymlinksPaths'); - -function getProjectPath() { - if (__dirname.match(/node_modules[\/\\]react-native[\/\\]local-cli[\/\\]core$/)) { - // Packager is running from node_modules. - // This is the default case for all projects created using 'react-native init'. - return path.resolve(__dirname, '../../../..'); - } else if (__dirname.match(/Pods[\/\\]React[\/\\]packager$/)) { - // React Native was installed using CocoaPods. - return path.resolve(__dirname, '../../../..'); - } - return path.resolve(__dirname, '../..'); -} - -const getRNPMConfig = (folder) => - // $FlowFixMe non-literal require - require(path.join(folder, './package.json')).rnpm || {}; - -const attachPackage = (command, pkg) => Array.isArray(command) - ? command.map(cmd => attachPackage(cmd, pkg)) - : { ...command, pkg }; - -const resolveSymlink = (roots) => - roots.concat( - findSymlinksPaths( - path.join(getProjectPath(), 'node_modules'), - roots - ) - ); - -/** - * 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. - */ -const config = { - getProjectCommands() { - const appRoot = process.cwd(); - const plugins = findPlugins([appRoot]) - .map(pathToCommands => { - const name = pathToCommands.split(path.sep)[0]; - - return attachPackage( - // $FlowFixMe non-literal require - require(path.join(appRoot, 'node_modules', pathToCommands)), - // $FlowFixMe non-literal require - require(path.join(appRoot, 'node_modules', name, 'package.json')) - ); - }); - - return flatten(plugins); - }, - getProjectConfig() { - const folder = process.cwd(); - const rnpm = getRNPMConfig(folder); - - return Object.assign({}, rnpm, { - ios: ios.projectConfig(folder, rnpm.ios || {}), - android: android.projectConfig(folder, rnpm.android || {}), - windows: windows.projectConfig(folder, rnpm.windows || {}), - assets: findAssets(folder, rnpm.assets), - }); - }, - getDependencyConfig(packageName: string) { - const folder = path.join(process.cwd(), 'node_modules', packageName); - const rnpm = getRNPMConfig( - path.join(process.cwd(), 'node_modules', packageName) - ); - - return Object.assign({}, rnpm, { - ios: ios.dependencyConfig(folder, rnpm.ios || {}), - android: android.dependencyConfig(folder, rnpm.android || {}), - windows: windows.dependencyConfig(folder, rnpm.windows || {}), - assets: findAssets(folder, rnpm.assets), - commands: wrapCommands(rnpm.commands), - params: rnpm.params || [], - }); - }, - getProjectRoots() { - const root = process.env.REACT_NATIVE_APP_ROOT; - if (root) { - return resolveSymlink([path.resolve(root)]); - } - - return resolveSymlink([getProjectPath()]); - }, -}; - -module.exports = config;