Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package.json + template.config.js + dependency on @react-native-community/cli #7

Merged

Conversation

blakef
Copy link
Collaborator

@blakef blakef commented Mar 15, 2024

Background

This is part of work to remove the dependency on the @react-native-community/cli-platform-ios/native_modules.rb in the react-native package. What we want is this:
CleanShot 2024-03-15 at 14 38 22@2x

To do this, we have to split apart native-modules.rb into:

  • link_native_modules! (a platform concern of injecting PodSpecs into the Xcode workplace build), and
  • list_native_modules! (module discover is a framework concern. For example the community template depends on config's, whereas something like Expo has gone another route)

The impact of this change means that the template now has to explicitly depend on https://npmjs.com/package/@react-native-community/cli which transitively includes both platform specific dependencies:

Changes used

Here's the old and new dependency graph:
dependencies

Necessary for bootstrapping from CLI
The dependency graph looks like this for the iOS Podfile:

  [@react-native-community/cli-platforms-ios/autolinking.rb]
  |
  v
  [react-native/scripts/react_native_pods.rb]
  |
  |-+ def use_react_native!()
  | + all ./cocoapods/* libraries for codegen
  | |
  | v
  | [@react-native/core-cli-utils/autolinking/ios/link_native_modules.rb]
  | |-+ def link_native_modules!()
  |
  + def list_native_modules!()
  + def autolink_native_modules!()
  |
  v
  [legacy: native_modules.rb]
  |-+ def use_native_modules!()

We need all of the methods for codegen to work.
@blakef
Copy link
Collaborator Author

blakef commented Mar 15, 2024

This might need to depend on the new 14.0.0-alpha.

Also how are we going to keep these links current?

blakef added a commit to blakef/cli that referenced this pull request Mar 15, 2024
Instead of native_modules serving `use_native_modules!(config)`, users
should now use `autolink_native_modules!()` from autolinking.rb.

This is being used in react-native-community/template#7
@cortinico
Copy link
Member

The impact of this change means that the template now has to explicitly depend on npmjs.com/package/@react-native-community/cli which transitively includes both platform specific dependencies:

Yup this is correct and intended.

This might need to depend on the new 14.0.0-alpha.

That's ok if we need it now for working. As soon as 14.0.0 releases, we'll have to update the dependency here.

Also how are we going to keep these links current?

We'll have to udpate the dependency here as soon as the CLI releases.
Users will get this bump via the upgrade helper.

@cipolleschi cipolleschi merged commit d58acb8 into react-native-community:main Jun 12, 2024
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.

None yet

3 participants