-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Adding documentation for the CLI for 2 reasons: 1. It's not immediately clear to most how the CLI is part of `react-native` and not the node module they installed. This begins clarifying. 2. I plan on adding some additional documentation to this section pending an upcoming PR I've discussed with Mike. screen shot provided: ![image](https://cloud.githubusercontent.com/assets/997157/20574213/0640d026-b179-11e6-9bc1-4f507b2a195a.png) Closes #11097 Differential Revision: D4237028 Pulled By: mkonicek fbshipit-source-id: c1dc50fe1be7f6947a33ee6472b5862306888055
- Loading branch information
Showing
3 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
id: understanding-cli | ||
title: Understanding the CLI | ||
layout: docs | ||
category: Guides | ||
permalink: docs/understanding-cli.html | ||
next: upgrading | ||
previous: performance | ||
--- | ||
|
||
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`](https://github.com/facebook/react-native/tree/master/local-cli) folder with a file named | ||
[`cliEntry.js`](https://github.com/facebook/react-native/blob/master/local-cli/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`](https://github.com/facebook/react-native/blob/master/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 `unlink` command looks like so: | ||
|
||
```js | ||
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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters