cli icon indicating copy to clipboard operation
cli copied to clipboard

feat: autolink native peer dependencies

Open patrickkabwe opened this issue 2 months ago • 0 comments

Summary

Add opt-in support for autolinking native peer dependencies (closes #870). At the moment the CLI only autolinks packages that are listed directly in an app’s package.json, so native peers declared by a library remain invisible unless every app developer installs them manually. This change introduces a dependency.autolinkTransitiveDependencies flag that a library can set in its react-native.config.js. When enabled, the CLI reads the library’s own package.json, discovers its peer dependencies, and links any native peers that are already present in node_modules.

The approach stays entirely inside the autolinking pipeline unlike PR #2054’s --dependency-check, which mutates app dependencies so it avoids surprise installs, CI failures, and extra workflow steps. Once a library opts in, every app automatically benefits. The updates touch the config loader, schema, public types, documentation, and add loadConfigAsync test coverage.

Test Plan

yarn test packages/cli-config/src/__tests__/index-test.ts

Checklist

  • [x] Documentation is up to date.
  • [x] Follows commit message convention described in CONTRIBUTING.md.
  • [ ] For functional changes, my test plan has linked these CLI changes into a local react-native checkout (instructions).

patrickkabwe avatar Oct 25 '25 11:10 patrickkabwe