feat: add ability to generate a local library #469
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Currently, when we have local native modules and views, they become part of the
android
&ios
source code, this makes upgrading the project to a newer React Native version harder as we also need to consider those changes.This change lets us create a local library which is not part of the android & ios folders, but a separate directory in the repo, making it self contained. It also adds a new
--no-example
flag to generate the project without example.More details in this RFC: react-native-community/discussions-and-proposals#702
How it works
package.json
in the current folder, we ask user whether they want to create a local librarypackage.json
based on the package manager to link the native library (which creates a symlink innode_modules
)Test plan
npx react-native init
create-react-native-library
in the project to create a local libraryApp.tsx
and use the exported method to verify functionalityKapture.2023-09-22.at.17.00.37.mp4