Convert Figma logo to code with AI

callstack logoreact-native-builder-bob

👷‍♂️ Simple set of CLIs to scaffold and build React Native libraries for different targets

2,732
181
2,732
8

Top Related Projects

Tools for creating, running, and deploying universal Expo and React Native apps

2,365

The React Native Community CLI - command line tools to help you build RN apps

17,543

Infinite Red's battle-tested React Native project boilerplate, along with a CLI, component/model generators, and more!

A complete native navigation solution for React Native

Routing and navigation for your React Native apps

11,138

Gray box end-to-end testing and automation framework for mobile apps

Quick Overview

React Native Builder Bob is a CLI tool designed to simplify the process of creating and maintaining React Native libraries. It provides a streamlined approach to setting up, building, and testing React Native modules, making it easier for developers to create and publish high-quality libraries.

Pros

  • Simplifies the setup and configuration process for React Native libraries
  • Supports multiple platforms (iOS, Android, and web)
  • Provides built-in TypeScript support
  • Offers automatic generation of example projects for testing

Cons

  • Limited customization options for advanced use cases
  • May have a learning curve for developers new to React Native library development
  • Requires additional setup for certain native modules or complex libraries
  • Dependency on external tools and libraries

Code Examples

  1. Creating a new React Native library:
npx react-native-builder-bob create my-library

This command initializes a new React Native library project with the name "my-library".

  1. Configuring the library in package.json:
{
  "name": "my-library",
  "version": "1.0.0",
  "react-native-builder-bob": {
    "source": "src",
    "output": "lib",
    "targets": [
      "commonjs",
      "module",
      ["typescript", { "project": "tsconfig.build.json" }]
    ]
  }
}

This configuration specifies the source directory, output directory, and build targets for the library.

  1. Building the library:
yarn bob build

This command builds the library according to the configuration specified in package.json.

Getting Started

To get started with React Native Builder Bob, follow these steps:

  1. Install the CLI globally:

    npm install -g react-native-builder-bob
    
  2. Create a new library:

    npx react-native-builder-bob create my-library
    
  3. Navigate to the library directory:

    cd my-library
    
  4. Install dependencies:

    yarn install
    
  5. Start development:

    yarn example start
    

This will set up a new React Native library project and launch the example app for development and testing.

Competitor Comparisons

Tools for creating, running, and deploying universal Expo and React Native apps

Pros of expo-cli

  • Provides a comprehensive development environment with built-in tools and services
  • Offers over-the-air updates and easy deployment options
  • Supports a wide range of Expo SDK features and APIs

Cons of expo-cli

  • Limited customization options for native code and dependencies
  • Larger app size due to included Expo runtime
  • Potential performance overhead for complex applications

Code Comparison

expo-cli:

import { Camera } from 'expo-camera';

const App = () => (
  <Camera style={{ flex: 1 }} type={Camera.Constants.Type.back}>
    {/* Camera view */}
  </Camera>
);

react-native-builder-bob:

import { NativeModules } from 'react-native';

const { MyNativeModule } = NativeModules;
MyNativeModule.someMethod();

Key Differences

  • expo-cli focuses on rapid development and ease of use, while react-native-builder-bob emphasizes native module development and customization
  • expo-cli provides a managed workflow with pre-configured tools, whereas react-native-builder-bob offers more flexibility for native code integration
  • expo-cli is better suited for beginners and projects that don't require extensive native customization, while react-native-builder-bob is ideal for developers who need fine-grained control over native modules and dependencies
2,365

The React Native Community CLI - command line tools to help you build RN apps

Pros of react-native-cli

  • More comprehensive toolset for React Native development
  • Officially maintained by the React Native community
  • Supports a wider range of React Native project management tasks

Cons of react-native-cli

  • Larger and more complex, potentially slower for simple tasks
  • May include features not needed by all developers
  • Steeper learning curve for beginners

Code Comparison

react-native-cli:

npx react-native init MyApp
cd MyApp
npx react-native run-android

react-native-builder-bob:

npx create-react-native-library MyLibrary
cd MyLibrary
yarn bob build

Key Differences

  • react-native-cli is designed for full React Native app development, while react-native-builder-bob focuses on building and managing React Native libraries
  • react-native-cli offers more extensive project management features, whereas react-native-builder-bob specializes in streamlined library development
  • react-native-cli is better suited for larger, more complex projects, while react-native-builder-bob excels in creating and maintaining smaller, reusable components

Use Cases

  • Choose react-native-cli for full-scale React Native app development with comprehensive tooling
  • Opt for react-native-builder-bob when creating standalone React Native libraries or components for reuse across projects
17,543

Infinite Red's battle-tested React Native project boilerplate, along with a CLI, component/model generators, and more!

Pros of Ignite

  • Provides a full-featured boilerplate with pre-configured tools and best practices
  • Includes a CLI for generating components, screens, and other project elements
  • Offers a rich ecosystem of plugins and add-ons for extended functionality

Cons of Ignite

  • Steeper learning curve due to its opinionated structure and additional tools
  • Less flexibility for customizing the build process compared to React Native Builder Bob
  • May include unnecessary features for simpler projects

Code Comparison

Ignite (project setup):

npx ignite-cli new MyApp
cd MyApp
npm start

React Native Builder Bob (project setup):

npx react-native init MyApp
cd MyApp
npm install --save-dev react-native-builder-bob

Key Differences

  • Ignite provides a complete project structure with pre-configured tools, while React Native Builder Bob focuses on build configuration and module development
  • Ignite includes a CLI for generating project elements, whereas React Native Builder Bob is primarily used for build and release processes
  • React Native Builder Bob offers more granular control over the build process, making it suitable for library and module development

Use Cases

  • Choose Ignite for rapid application development with a pre-configured environment
  • Opt for React Native Builder Bob when developing reusable modules or libraries, or when you need fine-grained control over the build process

A complete native navigation solution for React Native

Pros of react-native-navigation

  • Provides a native navigation solution with better performance and smoother transitions
  • Offers a wide range of customization options for navigation elements
  • Supports complex navigation patterns like deep linking and tab-based navigation

Cons of react-native-navigation

  • Steeper learning curve due to its more complex API and setup process
  • Requires additional native code integration, which can be challenging for some developers
  • May have compatibility issues with certain React Native versions or other libraries

Code Comparison

react-native-navigation:

Navigation.setRoot({
  root: {
    stack: {
      children: [
        { component: { name: 'Home' } }
      ]
    }
  }
});

react-native-builder-bob:

// No direct navigation code comparison available
// react-native-builder-bob is a build tool, not a navigation library

Summary

react-native-navigation is a powerful navigation solution for React Native apps, offering native performance and extensive customization options. However, it comes with a steeper learning curve and more complex setup compared to simpler navigation libraries.

react-native-builder-bob, on the other hand, is a build tool for React Native libraries and not directly comparable in terms of navigation functionality. It focuses on simplifying the development and build process for React Native modules.

When choosing between these libraries, consider your project's specific navigation requirements, development team's expertise, and the trade-offs between performance and ease of use.

Routing and navigation for your React Native apps

Pros of react-navigation

  • Comprehensive navigation solution for React Native apps
  • Large community and extensive documentation
  • Supports various navigation patterns (stack, tab, drawer)

Cons of react-navigation

  • Steeper learning curve for complex navigation scenarios
  • Potential performance issues with deeply nested navigators
  • Frequent updates may require occasional migration efforts

Code Comparison

react-navigation:

import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';

const Stack = createStackNavigator();

function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen name="Home" component={HomeScreen} />
        <Stack.Screen name="Details" component={DetailsScreen} />
      </Stack.Navigator>
    </NavigationContainer>
  );
}

react-native-builder-bob:

import { create } from 'react-native-builder-bob';

export default create({
  entry: 'src/index',
  typescript: true,
  package: {
    name: 'my-library',
  },
});

react-navigation is a comprehensive navigation library for React Native applications, offering various navigation patterns and extensive community support. However, it may have a steeper learning curve and potential performance issues with complex navigation structures.

react-native-builder-bob, on the other hand, is a build tool for creating and maintaining React Native libraries. It simplifies the setup process for library development but serves a different purpose than react-navigation.

The code examples illustrate the different focuses of these projects: react-navigation for implementing app navigation, and react-native-builder-bob for configuring library builds.

11,138

Gray box end-to-end testing and automation framework for mobile apps

Pros of Detox

  • Specialized for end-to-end testing of React Native apps
  • Provides a comprehensive testing framework with built-in synchronization
  • Supports both iOS and Android platforms

Cons of Detox

  • Steeper learning curve due to its complex setup and configuration
  • Limited to React Native projects, not suitable for other types of applications
  • Requires additional setup for CI/CD integration

Code Comparison

Detox (test example):

describe('Example', () => {
  beforeEach(async () => {
    await device.reloadReactNative();
  });

  it('should have welcome screen', async () => {
    await expect(element(by.id('welcome'))).toBeVisible();
  });
});

React Native Builder Bob (configuration example):

{
  "package": {
    "assets": ["./assets"]
  },
  "platforms": ["android", "ios"],
  "dependencies": {
    "react-native": "^0.64.0"
  }
}

While Detox focuses on end-to-end testing for React Native apps, React Native Builder Bob is a build tool for creating and managing React Native libraries. They serve different purposes in the React Native ecosystem, with Detox being more specialized for testing and React Native Builder Bob offering a streamlined approach to library development and maintenance.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Bob

create-react-native-library react-native-builder-bob MIT License

👷‍♂️ Set of CLIs to scaffold and build React Native libraries for different targets.

Documentation

Documentation is available at https://callstack.github.io/react-native-builder-bob/.

Development workflow

This project uses a monorepo using yarn. To setup the project, run yarn in the root directory to install the required dependencies.

yarn

While developing, you can run watch mode to automatically rebuild the changes:

yarn watch

To test the CLI locally, you can point to the appropriate executable:

../bob/packages/create-react-native-library/bin/create-react-native-library

Before sending a pull request, make sure your code passes TypeScript and ESLint. Run the following to verify:

yarn typecheck
yarn lint

To fix formatting errors, run the following:

yarn lint --fix

The documentation for the project is under docs directory. To run the documentation locally, run the following:

yarn docs dev

Publishing

Maintainers with write access to the GitHub repo and the npm organization can publish new versions. To publish a new version, first, you need to export a GH_TOKEN environment variable as mentioned here. Then run:

yarn lerna publish

This will automatically bump the version and publish the packages. It'll also publish the changelogs on GitHub for each package.

When releasing a pre-release version, we need to:

  • Update lerna.json to set the preId (e.g. next) and preDistTag (e.g. next) fields, and potentially the allowBranch field.
  • Run the following command:
yarn lerna publish --conventional-commits --conventional-prerelease --preid next

When releasing a stable version, we need to:

  • Remove the preId and preDistTag fields from lerna.json.
  • Run the following command:
yarn lerna publish --conventional-commits --conventional-graduate

Acknowledgments

Thanks to the authors of these libraries for inspiration:

Alternatives

There are other similar tools to scaffold React Native libraries. The difference is that the generated project with create-react-native-library is very opinionated and configured with additional tools.

LICENSE

MIT

NPM DownloadsLast 30 Days