Skip to content

Commit 6f69806

Browse files
committed
docs: update README
1 parent 2c03e3c commit 6f69806

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

README.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ This will ask you few questions about your project and generate a new project in
4040
- TypeScript definitions (uses `tsc` to generate declaration files)
4141
- Android AAR files
4242

43+
If you created a project with `create-react-native-library`, `react-native-builder-bob` is already pre-configured to build your project. You don't need to configure it again.
44+
45+
The following configuration steps are for projects not created with `create-react-native-library`.
46+
4347
### Automatic configuration
4448

4549
To automatically configure your project to use `react-native-builder-bob`, open a Terminal and run:
@@ -204,13 +208,26 @@ Just as an example, this is a command we have in one of the packages: `babel --e
204208

205209
If your library depends on another react-native library containing native code, you should do the following:
206210

207-
- Add the native library to `peerDependencies`: This makes sure that there are no conflicts between the version you have specified and the version user has installed (in case they also want to use that library). By deferring the installation to the user, it also makes sure the package manager installs it in correct location and that autolinking can work properly.
208-
- Add the native library to `devDependencies`: This makes sure that you can use it for tests, and there are no other errors such as type errors due to the missing module.
209-
- Add the native library to `dependencies` under `example`: This is equivalent to the consumer of the library installing the dependency, and is needed so that this module is also available to the example app.
211+
- **Add the native library to `peerDependencies`**
212+
213+
This means that the user will need to install the native library and add it to their `package.json`. It makes sure that:
214+
215+
- There are no version conflicts if another package also happens to use the same library, or if the user wants to use the library in their app. While there can be multiple versions of a JavaScript-only library, there can only be one version of a native library - so avoiding version conflicts is important.
216+
- The package manager installs it in correct location so that autolinking can work properly.
217+
218+
Don't add the native library to `dependencies`, otherwise it may cause issues for the user even if it seems to work.
219+
220+
- **Add the native library to `devDependencies`**
221+
222+
This makes sure that you can use it for tests, and there are no other errors such as type errors due to the missing module.
223+
224+
- **Add the native library to `dependencies` in the `package.json` under `example`**
225+
226+
This is equivalent to the consumer of the library installing the dependency, and is needed so that this module is also available to the example app.
210227

211228
## Development workflow
212229

213-
To get started with the project, run `yarn` in the root directory to install the required dependencies.
230+
This project uses a monorepo using `yarn`. To setup the project, run `yarn` in the root directory to install the required dependencies.
214231

215232
```sh
216233
yarn
@@ -247,6 +264,7 @@ Thanks to the authors of these libraries for inspiration:
247264

248265
- [create-react-native-module](https://github.com/brodybits/create-react-native-module)
249266
- [react-native-webview](https://github.com/react-native-community/react-native-webview)
267+
- [RNNewArchitectureLibraries](https://github.com/react-native-community/RNNewArchitectureLibraries)
250268

251269
## Alternatives
252270

0 commit comments

Comments
 (0)