Skip to content

Conversation

@kraenhansen
Copy link
Collaborator

@kraenhansen kraenhansen commented Nov 3, 2025

This fixes #260 by moving the weak-node-api specifics from the host package into a separate package of the mono-repo.

Merging this PR will:

  • Move the weak-node-api and its related package scripts from packages/host into packages/weak-node-api and update the host to link against it.
  • Embrace the find_package function as the recommended way of importing the weak-node-api target, over the include(...) pattern introduced in Explicit weak-node-api linkage #249.
  • Add the weak-node-api package to the test app. This is the biggest drawback of a separate package in my opinion - and the decision is driven by a few limiting factors:
    • An Xcframework must be co-located with the podspec adding it via vendored_frameworks (it's located using a glob expression relative to the pod root).
    • Podspecs cannot specify the source of dependencies. I.e. the :path can be used in the app's Podfile but not in a podspec, so we cannot simply locate and reference the weak-node-api pod "manually".
    • The React Native Community CLI doesn't (yet) consider transitive dependencies when auto-linking.

TODO

  • Add a README.md to the weak-node-api package.
  • Experiment with referencing the weak-node-api podspec by path instead of relying on React Native autolinking to find it. This will mean we can get rid of the test app's dependency on weak-node-api and rely on a direct dependency from the host package - which I think is desirable?

@kraenhansen kraenhansen self-assigned this Nov 3, 2025
@kraenhansen kraenhansen force-pushed the kh/weak-node-api-package branch 2 times, most recently from 5b1fb6e to 7ccdc2d Compare November 3, 2025 16:51
@kraenhansen kraenhansen added Apple 🍎 Anything related to the Apple platform (iOS, macOS, Cocoapods, Xcode, XCFrameworks, etc.) Android 🤖 Anything related to the Android platform (Gradle, NDK, Android SDK) Host 🏡 Our `react-native-node-api-modules` package weak-node-api labels Nov 3, 2025
@kraenhansen kraenhansen force-pushed the kh/weak-node-api-package branch 3 times, most recently from 46488d6 to b07067e Compare November 4, 2025 12:48
@kraenhansen kraenhansen force-pushed the kh/weak-node-api-package branch from b07067e to 0748c90 Compare November 4, 2025 15:30
@kraenhansen kraenhansen marked this pull request as ready for review November 4, 2025 19:21
@kraenhansen
Copy link
Collaborator Author

Finally - on the 5th (!!!) attempt, this passed without the Android emulator failing to launch or Gradle crashing. I'm suspecting the runner is running out-of-memory 🙃

@kraenhansen kraenhansen requested a review from Copilot November 4, 2025 21:23
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 separates the weak-node-api functionality from the host package into a dedicated weak-node-api package, addressing issue #260. The change promotes better modularity and establishes find_package as the recommended CMake integration pattern.

Key Changes:

  • Created new packages/weak-node-api package with its own build configuration, scripts, and TypeScript project structure
  • Updated all CMake integrations to use find_package(weak-node-api REQUIRED CONFIG) instead of include(${WEAK_NODE_API_CONFIG})
  • Reorganized dependencies so that host and other packages import from the new weak-node-api package

Reviewed Changes

Copilot reviewed 38 out of 43 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/weak-node-api/* New package containing weak-node-api library, build scripts, CMake config, and TypeScript sources
packages/host/package.json Removed weak-node-api build scripts and added dependency on new weak-node-api package
packages/host/src/node/weak-node-api.ts Deleted (functionality moved to weak-node-api package)
packages/host/android/build.gradle Updated to reference weak-node-api from node_modules and use find_package
packages/host/android/CMakeLists.txt Simplified to use find_package instead of manual library configuration
packages/host/scripts/generate-weak-node-api-injector.mts Updated to import from weak-node-api package
packages/cmake-rn/src/weak-node-api.ts Updated to import paths from weak-node-api package
packages/ferric/src/cargo.ts Updated to import prebuild paths from weak-node-api package
packages/gyp-to-cmake/src/transformer.ts Updated to use find_package instead of include
apps/test-app/package.json Added weak-node-api as a dependency
.github/workflows/check.yml Updated build commands to target weak-node-api workspace

@kraenhansen kraenhansen force-pushed the kh/weak-node-api-package branch from 0748c90 to 81ffa78 Compare November 4, 2025 21:57
@kraenhansen kraenhansen force-pushed the kh/weak-node-api-package branch from 81ffa78 to 46d5be1 Compare November 4, 2025 22:00
@kraenhansen kraenhansen force-pushed the kh/weak-node-api-package branch from 46d5be1 to f46c595 Compare November 4, 2025 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Android 🤖 Anything related to the Android platform (Gradle, NDK, Android SDK) Apple 🍎 Anything related to the Apple platform (iOS, macOS, Cocoapods, Xcode, XCFrameworks, etc.) Host 🏡 Our `react-native-node-api-modules` package weak-node-api

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a README.md for the weak-node-api package. Move weak-node-api into its own package

2 participants