Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from react-native-windows-init to react-native init-windows for new RNW projects #11920

Open
11 of 21 tasks
Tracked by #12042
jonthysell opened this issue Jul 20, 2023 · 3 comments
Open
11 of 21 tasks
Tracked by #12042
Assignees
Labels
Area: Developer Experience Deliverable Major item tracked for top-level planning in ADO Developer First Experience Issues that are going to be hit by a new developer as they first try out RNW Documentation enhancement New Architecture Broad category for issues that apply to the RN "new" architecture of Turbo Modules + Fabric
Milestone

Comments

@jonthysell
Copy link
Contributor

jonthysell commented Jul 20, 2023

This item tracks all the work necessary to build a new simpler path for creating new RNW projects, with a primary focus of enabling the React Native New Architecture and golden-path supported scenarios.

Tasks

Create named "old architecture" templates from existing UWP templates (in /vnext)

  1. Area: CLI enhancement
    jonthysell
  2. Area: CLI enhancement
    jonthysell
  3. Area: CLI enhancement
  4. Area: CLI enhancement
    jonthysell

Create named "new architecture" templates (in /vnext)

  1. Area: App Template Area: CLI Area: Fabric New Architecture enhancement
    jonthysell
  2. Area: Fabric New Architecture enhancement
    jonthysell
  3. Area: Fabric Area: Native Modules Invalid Triage New Architecture
    jonthysell

Create RNW CLI init-windows command (in /packages/@react-native-windows/cli)

  1. Area: CLI enhancement
    jonthysell
  2. Area: CLI enhancement
    jonthysell

Stop using react-native-windows-init

Documentation / Samples

Deprecate and remove old code

  1. Area: Infrastructure Platform: WinAppSDK enhancement
    jonthysell
@jonthysell jonthysell added enhancement Documentation Developer First Experience Issues that are going to be hit by a new developer as they first try out RNW Deliverable Major item tracked for top-level planning in ADO Area: Developer Experience labels Jul 20, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Triage 🔍 New issue that needs to be reviewed by the issue management team (label applied by bot) label Jul 20, 2023
@jonthysell
Copy link
Contributor Author

jonthysell commented Jul 20, 2023

Background context:

RNW Init v1

RNW Init v1: Basics

  • Customers start with a React Native app, typically having been created by the npx react-native init command
    • This includes the JS app code and native app hosts for iOS / Android
  • To add Windows support via RNW, customers use the npx react-native-windows-init command
    • This adds our RNW dependencies and a native app host for Windows
  • This new project functionality is primarily accomplished by these three RNW packages:
    1. react-native-windows-init
    2. react-native-windows
    3. @react-native-windows/cli

RNW Init v1: Package Versioning

image

RNW Init v1: CLI Arguments

Argument Type Default Req. Hidden Description
--help bool False N N Show Help
--version string Auto¹ N Specify RNW version
--namespace string Auto² N Specify namespace for native code
--language string "cpp" Y N Specify programming language C++ or C#
--projectType string "app" N N Specify app or library (0.64+)
--useWinUI3 bool False N Y Target WinUI 3.0 instead of UWP XAML
--useHermes bool False N Y Use Hermes instead of Chakra (0.64+)
--experimentalNuGetDependency bool False N Y Build against Microsoft.ReactNative NuGet instead of source
--verbose bool False N N Verbose output
--overwrite bool False N N Overwrite files without prompting
--telemetry bool False N N Send usage telemetry to MSFT
--useDevMode bool False N Y Use local RNW clone
--nuGetTestFeed string "" N Y Use specified NuGet test feed
--nuGetTestVersion string "" N Y Use specified NuGet test version

¹: If unspecified, calculated based on existing project RN version
²: If unspecified, calculated based on existing project name

RNW Init v1: Code Flow

image

@jonthysell
Copy link
Contributor Author

jonthysell commented Jul 20, 2023

More background context:

The Problems

  1. The latest RNW Init must support all past versions of RNW
    1. The ABI between the packages is static
  2. There are too many CLI arguments
    1. Produces a rather large matrix of combinations (not all supported)
    2. Not every argument is supported by every RNW version
    3. Experimental Features as args means we can’t deprecate args
  3. Important changes to experimental features in the near/medium term
    1. Removing the WinUI3 template project
    2. Switch to Hermes as the default engine
    3. Switch to Fabric as the default architecture
    4. Switch to consuming NuGet instead of source
  4. No way to invoke project init without RNW Init

@chrisglein chrisglein added this to the 0.73 milestone Jul 31, 2023
@chrisglein chrisglein removed the Needs: Triage 🔍 New issue that needs to be reviewed by the issue management team (label applied by bot) label Jul 31, 2023
jonthysell added a commit that referenced this issue Sep 6, 2023
## Description

The CLI package has grown since its original `run-windows` focus.

This PR refactors every top-level command `run-windows`, `autolink-windows`, and `codegen-windows` into a new commands folder, and breaks out the options for each command into its own file.

### Type of Change
- New feature (non-breaking change which adds functionality)

### Why

As part of the prep for creating an `init-windows` command (see #11920) I wanted to make it easier and more obvious as to "where" to put new commands for the CLI, without cluttering future PRs.

### What

This PR refactors every top-level command `run-windows`, `autolink-windows`, and `codegen-windows` into a new commands folder, and breaks out the options for each command into its own file.

## Screenshots
N/A

## Testing
Verified tests still run.

## Changelog
Should this change be included in the release notes: no
jonthysell added a commit to jonthysell/react-native-windows that referenced this issue Sep 18, 2023
## Description

This PR implements a new, named template-based `react-native
init-windows` command as described by microsoft#11920.

Note, this does not change or deprecate the existing
`react-native-windows-init` / `generateWindows` infrastructure or
templates.

### Type of Change
- New feature (non-breaking change which adds functionality)

### Why

This is part of restructuring how users can add RNW support to their RN
projects.

### What

1. Creates a new `init-windows` RN CLI command that creates a new
   windows project based on a given template
2. The first CLI templates under `old/`, which are just wrappers which
   call the existing templating code in `generateWindows`

Closes microsoft#12152
Closes microsoft#12151
Closes microsoft#12150
Closes microsoft#12149
Closes microsoft#12148
Closes microsoft#12147

## Screenshots
N/A

## Testing
Ran existing tests, created base `initWindows` tests.

## Changelog
Should this change be included in the release notes: yes

Created a new `init-windows` command
jonthysell added a commit that referenced this issue Sep 21, 2023
* Create new CLI init-windows command

## Description

This PR implements a new, named template-based `react-native
init-windows` command as described by #11920.

Note, this does not change or deprecate the existing
`react-native-windows-init` / `generateWindows` infrastructure or
templates.

### Type of Change
- New feature (non-breaking change which adds functionality)

### Why

This is part of restructuring how users can add RNW support to their RN
projects.

### What

1. Creates a new `init-windows` RN CLI command that creates a new
   windows project based on a given template
2. The first CLI templates under `old/`, which are just wrappers which
   call the existing templating code in `generateWindows`

Closes #12152
Closes #12151
Closes #12150
Closes #12149
Closes #12148
Closes #12147

## Screenshots
N/A

## Testing
Ran existing tests, created base `initWindows` tests.

## Changelog
Should this change be included in the release notes: yes

Created a new `init-windows` command

* fix generateWrapper

* remove sample apps package.json

* update yarn.lock

* Rename old templates
@jonthysell jonthysell modified the milestones: 0.73, Next Nov 7, 2023
@jonthysell jonthysell added the New Architecture Broad category for issues that apply to the RN "new" architecture of Turbo Modules + Fabric label Mar 8, 2024
@jonthysell jonthysell changed the title React Native Windows Init v2 Migrate from react-native-windows-init to react-native init-windows for new RNW projects May 31, 2024
@chrisglein chrisglein modified the milestones: Next, 0.75 Jun 5, 2024
@chrisglein
Copy link
Member

@jonthysell FYI adding link to #13362. Resolve when appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Developer Experience Deliverable Major item tracked for top-level planning in ADO Developer First Experience Issues that are going to be hit by a new developer as they first try out RNW Documentation enhancement New Architecture Broad category for issues that apply to the RN "new" architecture of Turbo Modules + Fabric
Projects
Status: No status
Development

No branches or pull requests

2 participants