or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

cli-commands.mdindex.mdmain-api.mdtypescript-types.md
tile.json

tessl/npm-react-native-community--cli

Command line tools to interact with React Native projects

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@react-native-community/cli@20.0.x

To install, run

npx @tessl/cli install tessl/npm-react-native-community--cli@20.0.0

index.mddocs/

React Native CLI

React Native CLI is the official command-line interface for React Native development. It provides essential commands for project initialization, configuration management, debugging, and development workflow automation. The CLI serves as both a programmatic API and a comprehensive set of command-line tools that handle the complete React Native development lifecycle.

Package Information

  • Package Name: @react-native-community/cli
  • Package Type: npm
  • Language: TypeScript
  • Installation: npm install @react-native-community/cli

Core Imports

import { run, loadConfig, loadConfigAsync, createDevServerMiddleware, bin } from "@react-native-community/cli";

For CommonJS:

const { run, loadConfig, loadConfigAsync, createDevServerMiddleware, bin } = require("@react-native-community/cli");

Basic Usage

Programmatic Usage

import { run, loadConfigAsync } from "@react-native-community/cli";

// Load React Native project configuration
const config = await loadConfigAsync();
console.log("Project root:", config.root);
console.log("Available platforms:", Object.keys(config.platforms));

// Run CLI programmatically (typically not needed)
await run();

Command Line Usage

# Initialize a new React Native project
npx react-native init MyApp

# Get project information  
npx react-native info

# Clean project caches
npx react-native clean

# Display current configuration
npx react-native config

# Run diagnostics and fix issues
npx react-native doctor

Architecture

The React Native CLI is built around several key components:

  • Command System: Unified command registration using Commander.js with automatic error handling
  • Configuration Loading: Async/sync configuration discovery and loading from React Native projects
  • Plugin Architecture: Extensible command system through external packages and project configuration
  • Multi-Platform Support: Android, iOS, and out-of-tree platform support with conditional command availability
  • Development Integration: Metro bundler middleware and development server integration

Capabilities

Main API Functions

Core programmatic interface for running the CLI, loading configurations, and integrating with development tools.

function run(platformName?: string): Promise<void>;
function loadConfig(): Config;
function loadConfigAsync(options?: {selectedPlatform?: string}): Promise<Config>;
function createDevServerMiddleware(options: MiddlewareOptions): DevServerMiddleware;

Main API Functions

CLI Commands

Complete command-line interface providing project initialization, configuration management, diagnostics, and maintenance tools.

// Project Commands (require React Native project)
type ProjectCommand = "config" | "clean" | "info";

// Detached Commands (work standalone)  
type DetachedCommand = "init" | "doctor";

CLI Commands

TypeScript Types

Comprehensive type system covering CLI configuration, commands, platform definitions, and development tool integration.

interface Config {
  root: string;
  reactNativePath: string;
  platforms: Record<string, PlatformConfig>;
  commands: Command[];
  dependencies: Record<string, DependencyConfig>;
}

interface Command<IsDetached extends boolean = boolean> {
  name: string;
  description?: string;
  func: IsDetached extends true ? DetachedCommandFunction : CommandFunction;
  detached?: IsDetached;
  options?: CommandOption[];
  examples?: Array<{desc: string; cmd: string}>;
}

TypeScript Types