Skip to content

Conversation

anupriya13
Copy link
Contributor

@anupriya13 anupriya13 commented Aug 29, 2025

Description

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Automation (AI changes or Github Actions to reduce effort of manual tasks)

Why

What is the motivation for this change? Add a few sentences describing the context and overall goals of the pull request's commits.

Resolves #15078

What

What changes were made to the codebase to solve the bug, add the functionality, etc. that you specified above.

Section A. Current Steps to integrate new arch windows template into a native module:

  1. Create a TurboModule Spec File (js/ts) that lists all the APIs to be exposed by the library.
  2. If Spec file already exists then refer that.
  3. Update the package.json file with correct codegenConfig windows section with namespace, outputDirectory, etc.
  4. Run “yarn react-native init-windows --template cpp-lib"
  5. Update the .h and .cpp files with correct APIs defined in codegen/....g.h generated header file from spec file. The .h and .cpp main files should have all the APIs stubs defined that are defined in .g.h codegen file.
  6. Implement those APIs

Section B. What are the issues?

Section C. How to make it easier?

  • For Step 1 – we might want manual intervention on what APIs do we need in windows only add those APIs in TurboModule Spec File. This can be done separately using below copilot prompt:
convert this file to codegen spec file using turbomodule <ADD .H FILE CODE> refer below

// @flow 

import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport'; 

import { TurboModuleRegistry } from 'react-native'; 

export interface Spec extends TurboModule { 

} 

export default (TurboModuleRegistry.get<Spec>('RNPrint'): ?Spec); 
  • Automate steps 2 to 5 in section A using a single command from cli i.e. “yarn react-native module-windows-setup –logging"

  • Step 6 is out of scope and can be done by developers

  • Introduce a new flag --no-example in yarn react-native init-windows cli command that ignores the creation of example file directory. There can be cases where we don't want the example directory to be created on every init windows having a flag to ignore this would be very useful. Add --no-example flag to init-windows CLI command #15092

Screenshots

Add any relevant screen captures here from before or after your changes.

CLI.module-windows-setup.mp4

CLI with other APIs after generating spec file from prompt:

CLI.module-windows-setup.mp4

Testing

If you added tests that prove your changes are effective or that your feature works, add a few sentences here detailing the added test scenarios.

Optional: Describe the tests that you ran locally to verify your changes.

Changelog

Should this change be included in the release notes: yes

Add a brief summary of the change to use in the release notes for the next release.
Introduce a new cli command module-windows-setup

…urate project directory detection and file path generation (#15080)

* Initial plan

* Implement module-windows-setup command for streamlined RNW community module integration

Co-authored-by: anupriya13 <[email protected]>

* Add comprehensive error handling, validation, and enhanced output to module-windows-setup

Co-authored-by: anupriya13 <[email protected]>

* Complete module-windows-setup implementation with tests and comprehensive documentation

Co-authored-by: anupriya13 <[email protected]>

* Enhance module-windows-setup with intelligent API discovery and spec mapping

Co-authored-by: anupriya13 <[email protected]>

* Add comprehensive testing guide for module-windows-setup command

Co-authored-by: anupriya13 <[email protected]>

* Run yarn lint:fix and yarn format equivalent commands

Co-authored-by: anupriya13 <[email protected]>

* Fix build errors: correct telemetry codes, Node.js compatibility, and API usage

Co-authored-by: anupriya13 <[email protected]>

* Change files

* Fix spec file discovery to exclude node_modules and validate TurboModule files

Co-authored-by: anupriya13 <[email protected]>

* Improve module-windows-setup to extract actual module names from existing spec files

Co-authored-by: anupriya13 <[email protected]>

* Add change file for module naming consistency improvements

Co-authored-by: anupriya13 <[email protected]>

* Fix Windows permission error and simplify dependency management

Co-authored-by: anupriya13 <[email protected]>

* Fix build error: make ModuleWindowsSetup properties public for testing

Co-authored-by: anupriya13 <[email protected]>

* Fix API extraction to generate correct method signatures from spec files instead of generic multiply method

Co-authored-by: anupriya13 <[email protected]>

* Add old architecture Windows directory cleanup before new arch setup

Co-authored-by: anupriya13 <[email protected]>

* Fix module name display in success message to show actual module name instead of generic ModuleName

Co-authored-by: anupriya13 <[email protected]>

* Fix TypeScript build error: use actualModuleName variable in codegenNamespace

Co-authored-by: anupriya13 <[email protected]>

* Fix eslint warnings: remove unnecessary escape characters in regex

Co-authored-by: anupriya13 <[email protected]>

* Remove vnext/codegen changes and add to .gitignore to prevent future commits

Co-authored-by: anupriya13 <[email protected]>

* Fix module-windows-setup to use correct package root instead of example directory

Co-authored-by: anupriya13 <[email protected]>

* Change Windows directory handling to always rename existing windows directory to windows_old

Co-authored-by: anupriya13 <[email protected]>

* Remove .gitignore changes - revert vnext/codegen entry and comment

Co-authored-by: anupriya13 <[email protected]>

* Comment updating package for now

* Fix Node.js compatibility and TypeScript compilation issues

Co-authored-by: anupriya13 <[email protected]>

* Fix TypeScript syntax error in moduleWindowsSetup.ts - uncomment catch block

Co-authored-by: anupriya13 <[email protected]>

* Fix deprecation warnings in module-windows-setup command by suppressing Node.js warnings

Co-authored-by: anupriya13 <[email protected]>

* Fix module-windows-setup to parse actual API methods from codegen C++ header files

Co-authored-by: anupriya13 <[email protected]>

* Fix module-windows-setup to parse actual API methods from codegen files and provide WebView-like default methods

Co-authored-by: anupriya13 <[email protected]>

* Expand default WebView methods to include comprehensive API coverage

Co-authored-by: anupriya13 <[email protected]>

* Remove hardcoded WebView default methods to make module-windows-setup generic

Co-authored-by: anupriya13 <[email protected]>

* Fix TypeScript compilation errors by removing unused helper methods

Co-authored-by: anupriya13 <[email protected]>

* Enhance module-windows-setup to strictly follow codegen-driven API generation and improve logging clarity

Co-authored-by: anupriya13 <[email protected]>

* Fix module-windows-setup to find codegen files in windows subdirectories

Co-authored-by: anupriya13 <[email protected]>

* Update moduleWindowsSetup.ts

* Fix module-windows-setup to read codegen files after they are written with better logging and timing

Co-authored-by: anupriya13 <[email protected]>

* Fix file paths in module-windows-setup to use correct subdirectory structure

Co-authored-by: anupriya13 <[email protected]>

* Fix module-windows-setup to use actual Windows project directory structure instead of codegen spec names

Co-authored-by: anupriya13 <[email protected]>

* Fix module-windows-setup to use codegenConfig.windows.outputDirectory for correct project directory detection

Co-authored-by: anupriya13 <[email protected]>

* Fix TypeScript compilation issues in moduleWindowsSetup

Co-authored-by: anupriya13 <[email protected]>

* Update moduleWindowsSetup.ts

* Update moduleWindowsSetup.ts

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: anupriya13 <[email protected]>
@anupriya13 anupriya13 changed the title Fix module-windows-setup to use codegenConfig outputDirectory for acc… Introduce a new cli command module-windows-setup Aug 29, 2025
@anupriya13 anupriya13 changed the title Introduce a new cli command module-windows-setup [DRAFT] Introduce a new cli command module-windows-setup Sep 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Streamline RNW Community Modules Integration & Creation Process
2 participants