Skip to content

Commit f842152

Browse files
committed
Reapply "Update documentation to reflect New Architecture default (microsoft#10… (microsoft#1057)
This reverts commit afeeba4. Revert afeeba4
1 parent efd0ee1 commit f842152

File tree

4 files changed

+152
-73
lines changed

4 files changed

+152
-73
lines changed

.spelling

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
2.x
2+
5x
23
accessors
34
ActivityIndicator
45
APIs
@@ -123,4 +124,5 @@ WinGet
123124
WinRT
124125
WinUI
125126
WinUI3
127+
workstream
126128
Xcode

docs/getting-started.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ Make sure you have installed all of the [development dependencies](rnw-dependenc
1111

1212
For information around how to set up React Native, see the [React Native Getting Started Guide](https://reactnative.dev/docs/getting-started).
1313

14-
> **Interested in migrating to [React Native's New Architecture](https://reactnative.dev/architecture/landing-page)?** New Architecture support in React Native for Windows is now available to preview in 0.76. Note there are several key changes, so if you’d like to be an early adopter, check out the information in the [New Architecture Guide](new-architecture.md).
15-
1614
## Create a new React Native project
1715

1816
Call the following from the place where you want your project directory to live:
@@ -70,7 +68,9 @@ Lastly, initialize the React Native for Windows application with the [init-windo
7068
npx react-native init-windows --overwrite
7169
```
7270

73-
> **Note:** RNW templates contain a customized `metro.config.js` file, which is meant to merge cleanly into the default config provided by the standard React Native project template. If you are starting a new app, overwriting `metro.config.js` should have no impact. However, if you are adding Windows to an existing app with an already modified `metro.config.js` file, please make sure to back up and re-apply your modifications after adding RNW.
71+
> **Architecture Note:** The default React Native for Windows template for *new* projects targets [React Native's New Architecture](https://reactnative.dev/architecture/landing-page). For more information, including options for continuing to use the Old Architecture, see [New vs. Old Architecture](new-architecture.md).
72+
73+
> **Metro Note:** React Native Windows overwrites the app project's `metro.config.js` file to enable Windows support. If you are starting a new project, overwriting React Native's default `metro.config.js` should have no impact. However, if you have previously modified your `metro.config.js` file, please make sure to back up and re-apply your modifications after adding React Native Windows.
7474
7575
## Running a React Native Windows App
7676

docs/init-windows-cli.md

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,60 @@ This guide will give you more information on the `init-windows` command of the R
99

1010
## `init-windows`
1111

12-
The `init-windows` CLI command is used to initialize a new React Native for Windows project inside an existing React Native project.
12+
The `init-windows` CLI command is used to (re-)initialize a new React Native for Windows project inside an existing React Native project.
1313

1414
### Usage
15-
Initializes a new RNW project from a given template.
15+
Initializes a new React Native for Windows project from a given template.
1616

1717
```bat
1818
npx react-native init-windows
1919
```
20+
2021
### Options
2122

2223
Here are the options that `react-native init-windows` takes:
24+
2325
| Option | Input Type | Description |
2426
|-----------------------|------------|--------------------------------------------------|
2527
| `--logging` | boolean | Verbose output logging |
26-
| `--template` | string | Specify the template to use |
28+
| `--template` | string | Specify the template to use (default: `cpp-app`) |
2729
| `--name` | string | The native project name. Defaults to the name property in `app.json` or `package.json` |
2830
| `--namespace` | string | The native project namespace, expressed using dots as separators, i.e. `Level1.Level2.Level3`. Defaults to the same as name |
2931
| `--overwrite` | boolean | Overwrite any existing files without prompting |
3032
| `--no-telemetry` | boolean | Disables sending telemetry that allows analysis of usage and failures of the react-native-windows CLI |
33+
| `--list` | | Shows a list with all available templates with their descriptions. |
3134
| `-h`, `--help` | boolean | Display help for command |
3235

36+
### Default Options and Re-initializing Projects
37+
38+
After running, the `init-windows` command will save the `name`, `namespace` and `template` configuration in the project's `package.json`:
39+
40+
```json
41+
"react-native-windows": {
42+
"init-windows": {
43+
"name": "MyApp",
44+
"namespace": "MyApp",
45+
"template": "cpp-app"
46+
}
47+
}
48+
```
49+
50+
If you later repeat the `init-windows` command to re-initialize a Windows project, without specifying any of those options, the command will default to any saved values. Among other things, this means you can safely re-run `init-windows` without it automatically changing your project to a different template (i.e. if your project is an Old Architecture app, `init-windows` won't force you to migrate to the New Architecture).
51+
52+
If you *want* to change the value (say, you *do* want to migrate to a new template) just explicitly (re-)specify the option when running `init-windows`.
53+
3354
## Templates
3455

35-
The following templates are available for use with `init-windows` by replacing `--template XYZ`, where `XYZ` can be:
56+
The following templates are available to `init-windows` and can by manually specified with the `--template` option (i.e. `--template cpp-lib`):
57+
58+
| Template | Name | Description |
59+
|:-:|:--|:--|
60+
| `cpp-app` | React Native Windows Application (New Arch, WinAppSDK, C++) | `[Default]` A RNW app using RN's New Architecture, built in C++ and targeting WinAppSDK |
61+
| `cpp-lib` | React Native Windows Library (C++) | A RNW (Turbo) Native Module supporting RN's New and Old Architectures built in C++ |
62+
| `old/uwp-cpp-app` | React Native Windows Application (Old Arch, UWP, C++) | `[Legacy]` A RNW app using RN's Old Architecture, built in C++ and targeting UWP |
63+
| `old/uwp-cs-app` | React Native Windows Application (Old Arch, UWP, C#) | `[Legacy]` A RNW app using RN's Old Architecture, built in C# and targeting UWP |
3664

37-
| Template | Name |
38-
|:-:|:--|
39-
| `cpp-app` | React Native Windows Application (New Arch, WinAppSDK, C++) |
40-
| `cpp-lib` | React Native Windows Library (C++) |
41-
| `old/uwp-cpp-app` | React Native Windows Application (Old Arch, UWP, C++) |
42-
| `old/uwp-cs-app` | React Native Windows Application (Old Arch, UWP, C#) |
65+
> **Architecture Note:** When initializing React Native for Windows for the first time, the `init-windows` CLI command defaults to the `cpp-app` template, which targets [React Native's New Architecture](https://reactnative.dev/architecture/landing-page). For more information, see [New vs. Old Architecture](new-architecture.md).
4366
4467
## Telemetry Notice
4568

0 commit comments

Comments
 (0)