diff --git a/.circleci/config.yml b/.circleci/config.yml
index 44da460f09a..78e8352dcff 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -236,7 +236,7 @@ aliases:
- &build-js-bundle
name: Build JavaScript Bundle
- command: node local-cli/cli.js bundle --max-workers 2 --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
+ command: node cli.js bundle --max-workers 2 --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
- &compile-native-libs
name: Compile Native Libs for Unit and Integration Tests
diff --git a/ContainerShip/scripts/run-android-docker-instrumentation-tests.sh b/ContainerShip/scripts/run-android-docker-instrumentation-tests.sh
index 63ee31b47cf..2062b547e2b 100644
--- a/ContainerShip/scripts/run-android-docker-instrumentation-tests.sh
+++ b/ContainerShip/scripts/run-android-docker-instrumentation-tests.sh
@@ -31,7 +31,7 @@ watchman shutdown-server
# integration tests
# build JS bundle for instrumentation tests
-node local-cli/cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
+node cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
# build test APK
# shellcheck disable=SC1091
diff --git a/RNTester/android/app/build.gradle b/RNTester/android/app/build.gradle
index 209fa2d1e4c..1a6628286e3 100644
--- a/RNTester/android/app/build.gradle
+++ b/RNTester/android/app/build.gradle
@@ -65,7 +65,7 @@ import com.android.build.OutputFile
*/
project.ext.react = [
- cliPath: "$rootDir/local-cli/cli.js",
+ cliPath: "$rootDir/cli.js",
bundleAssetName: "RNTesterApp.android.bundle",
entryFile: file("../../js/RNTesterApp.android.js"),
root: "$rootDir",
diff --git a/ReactAndroid/src/androidTest/buck-runner/BUCK b/ReactAndroid/src/androidTest/buck-runner/BUCK
index 61848a4977a..f0247e2e060 100644
--- a/ReactAndroid/src/androidTest/buck-runner/BUCK
+++ b/ReactAndroid/src/androidTest/buck-runner/BUCK
@@ -3,7 +3,7 @@ load("//tools/build_defs/oss:rn_defs.bzl", "KEYSTORE_TARGET", "react_native_dep"
# We are running instrumentation tests in simple mode: app code and instrumentation are in the same APK
# Currently you need to run these commands to execute tests:
#
-# node local-cli/cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
+# node cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
# gradle :ReactAndroid:packageReactNdkLibsForBuck
# buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests
# ./scripts/run-android-instrumentation-tests.sh com.facebook.react.tests
diff --git a/cli.js b/cli.js
index a78c9994081..4f4b1769029 100644
--- a/cli.js
+++ b/cli.js
@@ -9,4 +9,10 @@
'use strict';
-module.exports = require('./local-cli/cli.js');
+var cli = require('react-native-local-cli');
+
+if (require.main === module) {
+ cli.run();
+}
+
+module.exports = cli;
diff --git a/jest/preprocessor.js b/jest/preprocessor.js
index 2bb532f58a4..583cf0d65ca 100644
--- a/jest/preprocessor.js
+++ b/jest/preprocessor.js
@@ -25,7 +25,6 @@ const generate = require('@babel/generator').default;
const nodeFiles = new RegExp(
[
- '/local-cli/',
'/metro(?:-[^/]*)?/', // metro, metro-core, metro-source-map, metro-etc
].join('|'),
);
diff --git a/local-cli/cli.js b/local-cli/cli.js
index 1a49f68dc03..4f4b1769029 100644
--- a/local-cli/cli.js
+++ b/local-cli/cli.js
@@ -7,10 +7,12 @@
* @format
*/
-var cliEntry = require('react-native-local-cli');
+'use strict';
+
+var cli = require('react-native-local-cli');
if (require.main === module) {
- cliEntry.run();
+ cli.run();
}
-module.exports = cliEntry;
+module.exports = cli;
diff --git a/local-cli/templates/README.md b/local-cli/templates/README.md
deleted file mode 100644
index 1180ad1c2be..00000000000
--- a/local-cli/templates/README.md
+++ /dev/null
@@ -1,48 +0,0 @@
-# App templates
-
-This folder contains basic app templates. These get expanded by 'react-native init' when creating a new app to make it easier for anyone to get started.
-
-# Chat Example
-
-This is an example React Native app demonstrates ListViews, text input and
-navigation between a few screens.
-
-
-
-
-## Purpose
-
-One problem with React Native is that it is not trivial to get started: `react-native init` creates a very simple app that renders some text. Everyone then has to figure out how to do very basic things such as adding a list of items fetched from a server, navigating to a screen when a list item is tapped, or handling text input.
-
-This app is a template used by `react-native init` so it is easier for anyone to get up and running quickly by having an app with a few screens, a `ListView` and a `TextInput` that works well with the software keyboard.
-
-## Best practices
-
-Another purpose of this app is to define best practices such as:
-- The folder structure of a standalone React Native app
-- A style guide for JavaScript and React - for this we use the [AirBnb style guide](https://github.com/airbnb/javascript)
-- Naming conventions
-
-We need your feedback to settle on a good set of best practices. Have you built React Native apps? If so, please use the issues in the repo [mkonicek/ChatExample](https://github.com/mkonicek/ChatExample) to discuss what you think are the best practices that this example should be using.
-
-## Running the app locally
-
-```
-cd ChatExample
-yarn
-react-native run-ios
-react-native run-android
-```
-
----
-(In case you want to use react-navigation master):
-
-```
-# Install dependencies:
-cd react-navigation
-yarn
-yarn pack --filename react-navigation-1.0.0-alpha.tgz
-cd ChatExample
-yarn
-yarn add ~/code/react-navigation/react-navigation-1.0.0-alpha.tgz
-```
diff --git a/package.json b/package.json
index b14f9cbbd07..8cb1ece9bae 100644
--- a/package.json
+++ b/package.json
@@ -116,10 +116,8 @@
"jest",
"lib",
"rn-get-polyfills.js",
- "setupBabel.js",
"Libraries",
"LICENSE",
- "local-cli",
"packager",
"react.gradle",
"React.podspec",
@@ -130,7 +128,7 @@
"third-party-podspecs"
],
"scripts": {
- "start": "node ./local-cli/cli.js start",
+ "start": "node cli.js start",
"test": "jest",
"test-ci": "JEST_JUNIT_OUTPUT=\"reports/junit/js-test-results.xml\" jest --maxWorkers=2 --ci --testResultsProcessor=\"jest-junit\"",
"flow": "flow",
diff --git a/react-native-cli/index.js b/react-native-cli/index.js
index f3bd48f3347..a196fa7b5a1 100755
--- a/react-native-cli/index.js
+++ b/react-native-cli/index.js
@@ -246,7 +246,7 @@ function createProject(name, options) {
version: '0.0.1',
private: true,
scripts: {
- start: 'node node_modules/react-native/local-cli/cli.js start',
+ start: 'node node_modules/react-native/cli.js start',
ios: 'react-native run-ios',
android: 'react-native run-android',
},
diff --git a/react.gradle b/react.gradle
index ecc990772b4..b1d4a838073 100644
--- a/react.gradle
+++ b/react.gradle
@@ -7,7 +7,7 @@ import org.apache.tools.ant.taskdefs.condition.Os
def config = project.hasProperty("react") ? project.react : [];
-def cliPath = config.cliPath ?: "node_modules/react-native/local-cli/cli.js"
+def cliPath = config.cliPath ?: "node_modules/react-native/cli.js"
def bundleAssetName = config.bundleAssetName ?: "index.android.bundle"
def entryFile = config.entryFile ?: "index.android.js"
def bundleCommand = config.bundleCommand ?: "bundle"
diff --git a/scripts/launchPackager.bat b/scripts/launchPackager.bat
index bd3381e99eb..d33f31ee600 100644
--- a/scripts/launchPackager.bat
+++ b/scripts/launchPackager.bat
@@ -6,6 +6,6 @@
@echo off
title Metro Bundler
call .packager.bat
-node "%~dp0..\local-cli\cli.js" start
+node "%~dp0..\cli.js" start
pause
exit
diff --git a/scripts/packager.sh b/scripts/packager.sh
index 976f059a37b..b9ea61523d0 100755
--- a/scripts/packager.sh
+++ b/scripts/packager.sh
@@ -7,4 +7,4 @@
THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
source "${THIS_DIR}/.packager.env"
cd "$THIS_DIR/.."
-node "./local-cli/cli.js" start "$@"
+node "./cli.js" start "$@"
diff --git a/scripts/react-native-xcode.sh b/scripts/react-native-xcode.sh
index fc842ba006c..e7bbec599b9 100755
--- a/scripts/react-native-xcode.sh
+++ b/scripts/react-native-xcode.sh
@@ -84,7 +84,7 @@ fi
[ -z "$NODE_ARGS" ] && export NODE_ARGS=""
-[ -z "$CLI_PATH" ] && export CLI_PATH="$REACT_NATIVE_DIR/local-cli/cli.js"
+[ -z "$CLI_PATH" ] && export CLI_PATH="$REACT_NATIVE_DIR/cli.js"
[ -z "$BUNDLE_COMMAND" ] && BUNDLE_COMMAND="bundle"
diff --git a/scripts/run-android-local-integration-tests.sh b/scripts/run-android-local-integration-tests.sh
index 80286b00c8f..9fd5fb63a04 100755
--- a/scripts/run-android-local-integration-tests.sh
+++ b/scripts/run-android-local-integration-tests.sh
@@ -17,7 +17,7 @@ echo "Compiling native code..."
./gradlew :ReactAndroid:packageReactNdkLibsForBuck
echo "Building JS bundle..."
-node local-cli/cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
+node cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
echo "Installing test app on the device..."
buck fetch ReactAndroid/src/androidTest/buck-runner:instrumentation-tests
diff --git a/setupBabel.js b/setupBabel.js
deleted file mode 100644
index f047a7e442f..00000000000
--- a/setupBabel.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- * @format
- */
-
-'use strict';
-
-const babelRegisterOnly = require('metro-babel-register');
-
-const BABEL_ENABLED_PATHS = ['local-cli'];
-
-/**
- * Centralized place to register all the directories that need a Babel
- * transformation before being fed to Node.js. Notably, this is necessary to
- * support Flow type annotations.
- */
-function setupBabel() {
- babelRegisterOnly(
- babelRegisterOnly.buildRegExps(__dirname, BABEL_ENABLED_PATHS),
- );
-}
-
-module.exports = setupBabel;