Skip to content

Commit bf94f69

Browse files
authored
feat: add ability to generate a local library (#469)
### 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 - If we detect a `package.json` in the current folder, we ask user whether they want to create a local library - If the project is a react-native project, we add entries to `package.json` based on the package manager to link the native library (which creates a symlink in `node_modules`) - If the project is not a react-native project, we don't modify package.json, but ask user to link based on the project setup - this is relevant for monorepo scenario ### Test plan - Create a new project with `npx react-native init` - Run `create-react-native-library` in the project to create a local library - Import the library in `App.tsx` and use the exported method to verify functionality - Install dependencies and pods, then run the app on Android & iOS to verify that it works https://github.com/callstack/react-native-builder-bob/assets/1174278/d1da73f7-8a57-4911-9200-07c937d3b940
1 parent c6fc8e7 commit bf94f69

File tree

12 files changed

+278
-91
lines changed

12 files changed

+278
-91
lines changed

.github/workflows/build-templates.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ jobs:
112112
--author-url https://test.test \
113113
--repo-url https://test.test \
114114
--type ${{ matrix.type }} \
115-
--languages ${{ matrix.language }}
115+
--languages ${{ matrix.language }} \
116+
--no-local
116117
117118
- name: Cache dependencies of library
118119
id: library-yarn-cache

0 commit comments

Comments
 (0)