Skip to content

Add module-windows-setup command for streamlined RNW community module integration - #15079

Closed
anupriya13 with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-15078
Closed

Add module-windows-setup command for streamlined RNW community module integration#15079
anupriya13 with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-15078

Conversation

Copilot AI commented Aug 25, 2025

Copy link
Copy Markdown
Contributor

This PR implements a new module-windows-setup command that provides a complete one-line solution for setting up React Native modules for Windows development with the New Architecture (Fabric).

What this command does

The yarn react-native module-windows-setup command automates the entire setup process:

  1. Creates TurboModule specification - Generates a comprehensive spec file with examples if one doesn't exist
  2. Updates package.json - Adds Windows codegen configuration automatically
  3. Manages dependencies - Cleans node_modules, installs dependencies, and upgrades RN/RNW to latest versions
  4. Sets up Windows project - Runs init-windows --template cpp-lib with proper configuration
  5. Generates code - Executes codegen-windows to create Windows-specific bindings
  6. Creates C++ stubs - Automatically generates complete header and implementation files with method stubs

Key features

  • Smart spec generation: Creates detailed TurboModule specs with examples for all common types (strings, numbers, booleans, promises, callbacks, constants)
  • Intelligent C++ stub creation: Parses generated spec files to extract exact method signatures and creates production-ready C++ stubs
  • Non-destructive: Only creates files that don't exist to avoid overwriting user changes
  • Comprehensive error handling: Uses standard RNW error codes and provides clear feedback
  • Integration with existing CLI: Built on the same infrastructure as other RNW commands

Usage

# Basic usage
yarn react-native module-windows-setup

# With options
yarn react-native module-windows-setup --name MyModule --logging --overwrite

Example output

For a module with methods like processString(input: string) and calculateValue(x: number, y: number), the command generates:

// MyModuleModule.h
REACT_MODULE(MyModuleModule)
struct MyModuleModule {
    using ModuleSpec = MyModuleSpec;
    
    REACT_METHOD(processString)
    std::string processString(std::string input) noexcept;
    
    REACT_METHOD(calculateValue)
    double calculateValue(double x, double y) noexcept;
};

// MyModuleModule.cpp with stub implementations
std::string MyModuleModule::processString(std::string input) noexcept {
    // TODO: Implement processString
    return "";
}

This eliminates the need for manual setup and allows developers to focus on implementing their module's functionality rather than dealing with configuration and boilerplate.

Fixes #15078.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • googlechromelabs.github.io
  • https://storage.googleapis.com/chrome-for-testing-public/130.0.6723.116/linux64/chrome-headless-shell-linux64.zip
    • Triggering command: /usr/local/bin/node install.mjs (http block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Microsoft Reviewers: Open in CodeFlow

@anupriya13 anupriya13 closed this Aug 25, 2025
Copilot AI changed the title [WIP] Streamline RNW Community Modules Integration & Creation Process Add module-windows-setup command for streamlined RNW community module integration Aug 25, 2025
Copilot AI requested a review from anupriya13 August 25, 2025 09:39
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