microsoft / microsoft/react-native-windows

Streamline RNW Community Modules Integration & Creation Process

Open
#15,078 0 comments 1 reaction 2 assignees View on GitHub

Nobody has claimed this yet.

Area: Native Modules Area: Turbo Modules enhancement Extensions New Architecture Old Architecture Workstream: Module Support
Dominant language
C++
Stars
17.3k
Forks
1.2k
Avg merge
1d 13h
Merged PRs (30d)
33

Description

Add some script or AI prompts to speed up integration and API creation of community module in Windows for New Architecture Fabric.

End goal is to automate steps from creation of spec file to C++ API definitions so that we only need to work on API implementation and not spend time debugging or fixing other cases.

The outcome should be to add windows code in any react native module - For example: https://github.com/react-native-webview/react-native-webview

There can be a 1 line command yarn react-native setup-module-windows that would do everything:

  1. Check if TurboModule Spec exists, if not return with error "Create Spec File" to user and end.
  2. Check the package.json file and update the codegen part if missing with spec file path.
  3. Delete node_modules folder first from root directory if already there
  4. Run yarn in the root directory
  5. Upgrade RNW and RN to latest versions available in npm and upgrade other dependencies too.
  6. Run yarn again
  7. Upgrade the windows library implementation -yarn react-native init-windows --template cpp-lib. Note: This command creates/updates the windows folder and all the relevant files to the latest implementation.
  8. Codegen Windows: npx react-native codegen-windows
  9. Add CPP and .H stub versions of all the methods in the spec file.
  10. Build the .sln and should work fine.

The 1 line command can be "yarn react-native setup-module-windows" which only works for new architecture cpp-lib for now and internally calls init-windows in step 7.

Some work is already done here: PR Please fix it with updated point 1 and below feedbacks:

  • rename to setup-module-windows
  • instead of removing multiply function keep it with a comment to take it as a reference only: Consider adding some kind of Hello, world as a replacement for the old multiply. It’s there for a newbie module author to know that things worked when they deploy a module. For instance, the first react app screen shows something meaningful when things work.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.