react-native/docs/UnderstandingCLI.md
Hector Ramos f42f2dff37 New Handling Touches Tutorial
Summary:
Finally, a place where `Button` is properly introduced. This is based on the old Handling Touches guide, which has been simplified (with some content moved over to the scroll views tutorial).

I've also updated the ordering of the guides into something that makes more sense to someone just getting started with React Native.
Closes https://github.com/facebook/react-native/pull/14371

Differential Revision: D5201127

Pulled By: hramos

fbshipit-source-id: 819192e2db9febb8a315f51693dae557752b6002
2017-06-07 11:51:21 -07:00

1.8 KiB

id title layout category permalink banner next previous
understanding-cli Understanding the CLI docs Guides docs/understanding-cli.html ejected native-modules-ios testing

Though you may have installed the react-native-cli via npm as a separate module, it is a shell for accessing the CLI embedded in the React Native of each project. Your commands and their effects are dependent on the version of the module of react-native in context of the project. This guide will give a brief overview of the CLI in the module.

The local CLI

React Native has a local-cli folder with a file named cliEntry.js. Here, the commands are read from commands.js and added as possible CLI commands. E.G. the react-native link command, exists in the react-native/local-cli/link folder, and is required in commands.js, which will register it as a documented command to be exposed to the CLI.

Command definitions

At the end of each command entry is an export. The export is an object with a function to perform, description of the command, and the command name. The object structure for the link command looks like so:

module.exports = {
  func: link,
  description: 'links all native dependencies',
  name: 'link [packageName]',
};

Parameters

The command name identifies the parameters that a command would expect. When the command parameter is surrounded by greater-than, less-than symbols < >, this indicates that the parameter is expected. When a parameter is surrounded by brackets [ ], this indicates that the parameter is optional.