Skip to content

Commit b6cc030

Browse files
committed
docs: better organize the README
1 parent 733d2cc commit b6cc030

File tree

2 files changed

+32
-40
lines changed

2 files changed

+32
-40
lines changed

README.md

Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,60 @@
1-
# react-native-builder-bob
1+
# Bob
22

33
[![create-react-native-library][create-react-native-library-version-badge]][package]
44
[![react-native-builder-bob][react-native-builder-bob-version-badge]][package]
55
[![Build Status][build-badge]][build]
66
[![MIT License][license-badge]][license]
77

8-
👷‍♂️ Simple CLI to scaffold and build React Native libraries for different targets.
8+
👷‍♂️ Simple set of CLIs to scaffold and build React Native libraries for different targets.
99

10-
## Features
10+
## Scaffold React Native libraries
1111

12-
### Scaffold new projects
13-
14-
If you want to create your own React Native module, scaffolding the project can be a daunting task. Bob can scaffold a new project for you with the following things:
12+
If you want to create your own React Native module, scaffolding the project can be a daunting task. `create-react-native-library` can scaffold a new project for you with the following things:
1513

1614
- Simple example modules for Android and iOS which you can build upon
1715
- [Kotlin](https://kotlinlang.org/) configured for building the module on Android
1816
- C++ support for native modules on Android and iOS
1917
- [Expo](https://expo.io/) support for libraries without native code and web support
2018
- Example React Native app to manually test your modules
2119
- [ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/), [Husky](https://github.com/typicode/husky) and [Release It](https://github.com/release-it/release-it) pre-configured
22-
- Bob pre-configured to compile your files
20+
- `react-native-builder-bob` pre-configured to compile your files
2321
- [CircleCI](https://circleci.com/) pre-configured to run tests on the CI
2422

25-
<img src="assets/bob-create.gif" width="500px" height="auto">
26-
27-
### Build your projects
28-
29-
Bob can build code for following targets:
30-
31-
- Generic CommonJS build
32-
- ES modules build for bundlers such as webpack
33-
- Flow definitions (copies .js files to .flow files)
34-
- TypeScript definitions (uses `tsc` to generate declaration files)
35-
- Android AAR files
36-
37-
## Usage
38-
39-
### Creating a new project
40-
41-
To create new project with Bob, run the following:
23+
To create new project, run the following:
4224

4325
```sh
4426
npx create-react-native-library react-native-awesome-module
4527
```
4628

4729
This will ask you few questions about your project and generate a new project in a folder named `react-native-awesome-module`.
4830

49-
The difference from [create-react-native-module](https://github.com/brodybits/create-react-native-module) is that the generated project with Bob is very opinionated and configured with additional tools.
31+
<img src="assets/create-react-native-library.gif" width="500px" height="auto">
32+
33+
The difference from [create-react-native-module](https://github.com/brodybits/create-react-native-module) is that the generated project with `create-react-native-library` is very opinionated and configured with additional tools.
34+
35+
## Build your React Native libraries
36+
37+
`react-native-builder-bob` can build code in your React Native library for following targets:
5038

51-
### Configuring an existing project
39+
- Generic CommonJS build
40+
- ES modules build for bundlers such as webpack
41+
- Flow definitions (copies .js files to .flow files)
42+
- TypeScript definitions (uses `tsc` to generate declaration files)
43+
- Android AAR files
5244

53-
#### Automatic configuration
45+
### Automatic configuration
5446

55-
To automatically configure your project to use Bob, open a Terminal and run:
47+
To automatically configure your project to use `react-native-builder-bob`, open a Terminal and run:
5648

5749
```js
5850
npx react-native-builder-bob init
5951
```
6052

61-
#### Manual configuration
53+
### Manual configuration
6254

6355
To configure your project manually, follow these steps:
6456

65-
1. First, install Bob in your project. Open a Terminal in your project, and run:
57+
1. First, install `react-native-builder-bob` in your project. Open a Terminal in your project, and run:
6658

6759
```sh
6860
yarn add --dev react-native-builder-bob
@@ -127,23 +119,23 @@ To configure your project manually, follow these steps:
127119

128120
And we're done 🎉
129121

130-
## Options
122+
### Options
131123

132124
The options can be specified in the `package.json` file under the `react-native-builder-bob` property, or in a `bob.config.js` file in your project directory.
133125

134-
### `source`
126+
#### `source`
135127

136128
The name of the folder with the source code which should be compiled. The folder should include an `index` file.
137129

138-
### `output`
130+
#### `output`
139131

140132
The name of the folder where the compiled files should be output to. It will contain separate folder for each target.
141133

142-
### `targets`
134+
#### `targets`
143135

144136
Various targets to build for. The available targets are:
145137

146-
#### `commonjs`
138+
##### `commonjs`
147139

148140
Enable compiling source files with Babel and use commonjs module system.
149141

@@ -159,7 +151,7 @@ Example:
159151
["commonjs", { "babelrc": true, "copyFlow": true }]
160152
```
161153

162-
#### `module`
154+
##### `module`
163155

164156
Enable compiling source files with Babel and use ES module system. This is essentially same as the `commonjs` target and accepts the same options, but leaves the `import`/`export` statements in your code.
165157

@@ -171,7 +163,7 @@ Example:
171163
["module", { "babelrc": true, "copyFlow": true }]
172164
```
173165

174-
#### `typescript`
166+
##### `typescript`
175167

176168
Enable generating type definitions with `tsc` if your source code is written in [TypeScript](http://www.typescriptlang.org/).
177169

@@ -183,7 +175,7 @@ Example:
183175
["typescript", { "project": "tsconfig.build.json" }]
184176
```
185177

186-
#### `aar`
178+
##### `aar`
187179

188180
Enable assembling Android AAR files for a library for React Native modules including native code.
189181

@@ -198,7 +190,7 @@ Example:
198190

199191
## FAQ
200192

201-
### Why should I compile my project with Bob?
193+
### Why should I compile my project with `react-native-builder-bob`?
202194

203195
We write our library code in non-standard syntaxes such as JSX, TypeScript etc. as well as proposed syntaxes which aren't part of the standard yet. This means that our code needs to be compiled to be able to run on JavaScript engines.
204196

@@ -208,7 +200,7 @@ Currently, to handle such multiple targets, we need to have multiple babel confi
208200

209201
Just as an example, this is a command we have in one of the packages: `babel --extensions '.js,.ts,.tsx' --no-babelrc --config-file=./babel.config.publish.js src --ignore '**/__tests__/**' --copy-files --source-maps --delete-dir-on-start --out-dir dist && del-cli 'dist/**/__tests__' && yarn tsc --emitDeclarationOnly`. This isn't all, there's even a separate `babel.config.publish.js` file. And this only works for webpack and Metro, and will fail on Node due to ESM usage.
210202

211-
Bob wraps tools such as `babel` and `typescript` to simplify these common tasks across multiple projects. It's tailored specifically to React Native projects to minimize the configuration required.
203+
`react-native-builder-bob` wraps tools such as `babel` and `typescript` to simplify these common tasks across multiple projects. It's tailored specifically to React Native projects to minimize the configuration required.
212204

213205
### How do I add a react-native library containing native code as a dependency in my library?
214206

File renamed without changes.

0 commit comments

Comments
 (0)