Skip to content

Commit e5aa62d

Browse files
committed
docs: update docs for the custom target
1 parent 65678c5 commit e5aa62d

File tree

1 file changed

+28
-18
lines changed

1 file changed

+28
-18
lines changed

docs/pages/build.md

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -182,24 +182,6 @@ Example:
182182

183183
Various targets to build for. The available targets are:
184184

185-
#### `codegen`
186-
187-
Generates the [React Native Codegen](https://reactnative.dev/docs/the-new-architecture/what-is-codegen) scaffold code, which is used with the New React Native Architecture.
188-
189-
You can ensure your Codegen generated scaffold code is stable through different React Native versions by shipping it with your library. You can find more in the [React Native Official Docs](https://reactnative.dev/docs/the-new-architecture/codegen-cli#including-generated-code-into-libraries).
190-
191-
#### `custom`
192-
193-
Define a custom build target. This is useful to call code generators during the build process.
194-
195-
##### `script`
196-
197-
Accepts a script name. `bob` will call the matching script defined under `package.json`'s `scripts` property. The build process **will throw and exit** if the target is defined without this option.
198-
199-
##### `clean`
200-
201-
You can pass a path to this option and `bob` will delete all the files on that path. The path is resolved relatively to where `build` was called from.
202-
203185
#### `commonjs`
204186

205187
Enable compiling source files with Babel and use CommonJS module system.
@@ -313,6 +295,34 @@ Setting this option to `true` will output 2 sets of type definitions: one for th
313295

314296
See the [ESM support](./esm.md) guide for more details.
315297

298+
#### `codegen`
299+
300+
Enable generating the [React Native Codegen](https://reactnative.dev/docs/the-new-architecture/what-is-codegen) scaffold code, which is used with the New React Native Architecture.
301+
302+
You can ensure your Codegen generated scaffold code is stable through different React Native versions by shipping it with your library. You can find more in the [React Native Official Docs](https://reactnative.dev/docs/the-new-architecture/codegen-cli#including-generated-code-into-libraries).
303+
304+
#### `custom`
305+
306+
Define a custom build target. This is useful to call custom scripts during when running `bob build`.
307+
308+
##### `script`
309+
310+
Name of the script to run. The script must be defined in the `package.json` file under the `scripts` property. This property is required.
311+
312+
This script is run asynchronously alongside the other build targets.
313+
314+
##### `clean`
315+
316+
Optionally, you can specify a path to cleanup before running the build script. The path is resolved relatively to where `build` was called from.
317+
318+
This is useful if your script generates output files. Cleaning the output folder before running the script ensures that the output doesn't contain stale files.
319+
320+
Example:
321+
322+
```json
323+
["custom", { "script": "my-custom-build", "clean": "my-output-folder/" }]
324+
```
325+
316326
## Commands
317327

318328
The `bob` CLI exposes the following commands:

0 commit comments

Comments
 (0)