Skip to content

Commit 9739b56

Browse files
authored
chore(docs): document our CLI commands (#2755)
1 parent 7781a97 commit 9739b56

File tree

2 files changed

+70
-8
lines changed

2 files changed

+70
-8
lines changed

docsite/docs/cli-commands.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
sidebar_position: 3
3+
title: CLI Commands
4+
---
5+
6+
# CLI Commands
7+
8+
React Native for macOS provides several command-line tools to help you develop, build, and run your macOS applications.
9+
10+
## Overview
11+
12+
The React Native CLI for macOS extends the standard React Native CLI with macOS-specific commands. These commands help you build and run your React Native applications on macOS.
13+
14+
## Available Commands
15+
16+
### `run-macos`
17+
18+
Builds your React Native macOS app and launches it on your local machine.
19+
20+
```bash
21+
npx react-native run-macos [options]
22+
```
23+
24+
#### Options
25+
26+
| Option | Description | Default |
27+
|--------|-------------|---------|
28+
| `--mode [string]` | Set the build configuration (Debug, Release) | Debug |
29+
| `--scheme [string]` | Explicitly set the Xcode scheme to use | `{ProjectName}-macOS` |
30+
| `--project-path [string]` | Path relative to project root where the Xcode project lives | `macos` |
31+
| `--no-packager` | Do not launch Metro bundler while building | `false` |
32+
| `--port [number]` | Port for the Metro bundler | `8081` |
33+
| `--terminal [string]` | Terminal to use for launching Metro bundler | System default |
34+
| `--verbose` | Show detailed build output (disable xcpretty) | `false` |
35+
36+
### `build-macos`
37+
38+
Builds your React Native macOS app without launching it.
39+
40+
```bash
41+
npx react-native build-macos [options]
42+
```
43+
44+
#### Options
45+
46+
| Option | Description | Default |
47+
|--------|-------------|---------|
48+
| `--mode [string]` | Set the build configuration (Debug, Release) | Debug |
49+
| `--scheme [string]` | Explicitly set the Xcode scheme to use | `{ProjectName}-macOS` |
50+
| `--project-path [string]` | Path relative to project root where the Xcode project lives | `macos` |
51+
| `--verbose` | Show detailed build output (disable xcpretty) | `false` |

docsite/docs/getting-started.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,25 @@ npx react-native-macos-init
3737

3838
## Running a React Native macOS App
3939

40-
- **Without using Xcode**:
41-
In your React Native macOS project directory, run:
40+
### Quick Start
4241

43-
```
44-
npx react-native run-macos
45-
```
42+
In your React Native macOS project directory, run:
4643

47-
- **Using Xcode**:
48-
Open `macos\test.xcworkspace` in Xcode or run `xed -b macos`; `yarn start`. Hit the Run button.
44+
```bash
45+
npx react-native run-macos
46+
```
47+
48+
This will build your app and launch it automatically. A Metro bundler window will also open to serve your JavaScript code.
49+
50+
### Alternative Methods
51+
52+
- **Using Xcode**: Open `macos/{YourProject}.xcworkspace` in Xcode or run `xed -b macos`, then hit the Run button.
53+
- **Build only**: Use `npx react-native build-macos` to build without launching.
54+
55+
:::tip
56+
The first run may take a while since it involves building the entire project and all dependencies. Subsequent runs will be much faster!
57+
:::
58+
59+
For more detailed information about CLI commands and build options, see the [CLI Commands](./cli-commands.md).
4960

50-
A new Command Prompt window will open with the React packager as well as a `react-native-macos` app. This step may take a while during first run since it involves building the entire project and all dependencies. You can now start developing! 🎉
61+
Happy coding! 🎉

0 commit comments

Comments
 (0)