You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-9Lines changed: 17 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,16 +57,24 @@ The difference from [create-react-native-module](https://github.com/brodybits/cr
57
57
58
58
### Configuring an existing project
59
59
60
-
First, install Bob in your project. Open a Terminal in your project, and run:
60
+
#### Automatic configuration
61
61
62
-
```sh
63
-
yarn add --dev react-native-builder-bob
62
+
To automatically configure your project to use Bob, open a Terminal and run:
63
+
64
+
```js
65
+
npx react-native-builder-bob init
64
66
```
65
67
66
-
To configure your project to use Bob, open a Terminal and run `yarn bob init` for automatic configuration.
68
+
#### Manual configuration
67
69
68
70
To configure your project manually, follow these steps:
69
71
72
+
1. First, install Bob in your project. Open a Terminal in your project, and run:
73
+
74
+
```sh
75
+
yarn add --dev react-native-builder-bob
76
+
```
77
+
70
78
1. In your `package.json`, specify the targets to build for:
71
79
72
80
```json
@@ -84,15 +92,15 @@ To configure your project manually, follow these steps:
84
92
85
93
See options below for more details.
86
94
87
-
2. Add `bob` to your `prepare` step:
95
+
1. Add `bob` to your `prepare` step:
88
96
89
97
```js
90
98
"scripts": {
91
99
"prepare":"bob build"
92
100
}
93
101
```
94
102
95
-
3. Configure the appropriate entry points:
103
+
1. Configure the appropriate entry points:
96
104
97
105
```json
98
106
"main": "lib/commonjs/index.js",
@@ -109,16 +117,16 @@ To configure your project manually, follow these steps:
109
117
110
118
It's usually good to point to your source code with the `react-native` field to make debugging easier. Metro already supports compiling a lot of new syntaxes including JSX, Flow and TypeScript and it will use this field if present.
111
119
112
-
If you're building TypeScript definition files, also make sure that the `types` field points to a correct path. Depending on the project configuration, the path can be different for you than the example snippet.
120
+
If you're building TypeScript definition files, also make sure that the `types` field points to a correct path. Depending on the project configuration, the path can be different for you than the example snippet (e.g. `lib/typescript/index.d.ts` if you have only the `src` directory).
113
121
114
-
4. Add the output directory to `.gitignore` and `.eslintignore`
122
+
1. Add the output directory to `.gitignore` and `.eslintignore`
115
123
116
124
```gitignore
117
125
# generated files by bob
118
126
lib/
119
127
```
120
128
121
-
5. Add the output directory to `jest.modulePathIgnorePatterns` if you use [Jest](https://jestjs.io)
129
+
1. Add the output directory to `jest.modulePathIgnorePatterns` if you use [Jest](https://jestjs.io)
0 commit comments