Skip to content

Conversation

@kraenhansen
Copy link
Collaborator

@kraenhansen kraenhansen commented Oct 27, 2025

Merging this PR will:

  • Add script to init a MacOS test app
  • Add a job in the check workflow to initialize and build the MacOS test app - fixing Initialize and run a MacOS test app on CI #296
  • Use the caller-stack when patching hermes as a heuristics for determining the correct value to pass into --react-native-package - fixing Support vendoring Hermes for out-of-tree platforms #270
  • Refactor how the the path within the Xcframework used when linking against weak-node-api is determined, to use a prioritized list of available "slice names". This allows us to prebuild only the single architecture we're interested in when testing, fixing this failure.

Note how the CI job prints this while pod installing:

[Node-API] Using overridden Hermes in "/Users/runner/work/react-native-node-api/react-native-node-api/apps/macos-test-app/node_modules/react-native-macos/sdks/node-api-hermes"

@kraenhansen kraenhansen self-assigned this Oct 27, 2025
@kraenhansen kraenhansen added CI Continuous integration Apple 🍎 Anything related to the Apple platform (iOS, macOS, Cocoapods, Xcode, XCFrameworks, etc.) Host 🏡 Our `react-native-node-api-modules` package MacOS 💻 Anything related to the Apple MacOS platform or React Native MacOS support labels Oct 27, 2025
@kraenhansen kraenhansen marked this pull request as ready for review October 27, 2025 23:36
@kraenhansen kraenhansen requested a review from Copilot October 28, 2025 00:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for macOS test apps by introducing initialization scripts, CI workflow integration, and fixes for React Native macOS compatibility. The changes enable automated testing on macOS and improve Hermes vendoring detection for react-native-macos.

Key Changes:

  • Added macOS test app initialization script with React Native macOS template setup
  • Implemented caller stack inspection in Ruby script to automatically detect react-native vs react-native-macos
  • Refactored XCFramework slice selection to use prioritized fallback lists instead of single hardcoded paths

Reviewed Changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tsconfig.scripts.json New TypeScript configuration for scripts directory
scripts/init-macos-test-app.ts Script to initialize and configure a React Native macOS test application
packages/host/scripts/patch-hermes.rb Added automatic detection of React Native package type using caller stack
packages/ferric/src/cargo.ts Changed XCFramework slice mapping from single values to prioritized arrays with fallback logic
package.json Added init-macos-test-app script and read-pkg dependency
.github/workflows/check.yml Added macOS test job with label-based triggering
.changeset/silly-mice-warn.md Changeset documenting Hermes vendoring fix for macOS

- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/jod
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'jod' to 'iron'. The Node.js LTS codename should be 'iron'.

Copilot uses AI. Check for mistakes.
Comment on lines +34 to +35
// "--platform-name",
// "react-native-macos",
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented-out code should be removed. If these options were used during development but are no longer needed, they should be deleted rather than left as comments.

Suggested change
// "--platform-name",
// "react-native-macos",

Copilot uses AI. Check for mistakes.
@kraenhansen kraenhansen marked this pull request as draft October 28, 2025 16:22
@kraenhansen
Copy link
Collaborator Author

Drafting again as I'll attempt to include running the tests in this PR as well. I believe I'm pretty far, while having difficulties initializing the host TurboModule 🤔

I'm experiencing issues (TurboModuleRegistry.getEnforcing throwing) while registering and initializing a TurboModule using the registerCxxModuleToGlobalModuleMap util from ReactCommon/react/nativemodule/core/ReactCommon/CxxTurboModuleUtils.cpp and I started wondering if this code in ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleManager.mm is ran by React Native MacOS? I have Hermes and Fabric enabled in the app, if that makes a difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Apple 🍎 Anything related to the Apple platform (iOS, macOS, Cocoapods, Xcode, XCFrameworks, etc.) CI Continuous integration Host 🏡 Our `react-native-node-api-modules` package MacOS 💻 Anything related to the Apple MacOS platform or React Native MacOS support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Initialize and run a MacOS test app on CI Support vendoring Hermes for out-of-tree platforms

2 participants