Skip to content

feat: add config command #19

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

Merged
merged 7 commits into from
Nov 5, 2024
Merged

feat: add config command #19

merged 7 commits into from
Nov 5, 2024

Conversation

szymonrybczak
Copy link
Contributor

Summary

Inside this Pull Request I added config command which calls loadConfig function from @react-native-community/cli-config package.

As part of recent migration parts of autolinking code to React Native core, there's a possibility for Frameworks to pass a custom command for Android/iOS native builds.

Test plan

  1. create-app
  2. npm install react-native-pager-view
  3. rnef config should include new package under dependencies field.

@szymonrybczak
Copy link
Contributor Author

Hm, it looks like there's an issue with finding platforms and then calling .depdencyConfig functions which are for RNC CLI implemented in cli-platform-apple and cli-platform-android, because of it dependencies in final config object don't contain appropriate platforms fields. Not sure if we can plug into these 🤔

@szymonrybczak
Copy link
Contributor Author

szymonrybczak commented Oct 30, 2024

After adding @react-native-community/cli-config-apple as a dependency for @callstack/rnef-cli package and creating react-native.config.js file with platform definition and proper function calling it seems to be working and properly collecting the config.

The only thing that's left to fix is that because we keep react-native.config.js inside a ESM package we cannot require @react-native-community/cli-config-apple. However we can change the file extension to .cjs and then this file would be treated as CJS, but current logic in cli-config doesn't take into account react-native.config.cjs.

We'd need to land react-native-community/cli#2453 and then we'd be able to call dynamic import instead of require() from react-native.config.js (even react-native.config.ts would work then 👀).

@thymikee thymikee merged commit 09fb1da into main Nov 5, 2024
1 check passed
@thymikee thymikee deleted the feat/add-config-command branch November 5, 2024 15:03
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.

2 participants