CtrlK
BlogDocsLog inGet started
Tessl Logo

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

Command line tools to interact with React Native projects

Pending
Overview
Eval results
Files

cli-commands.mddocs/

CLI Commands

Complete command-line interface providing project initialization, configuration management, diagnostics, and maintenance tools. Commands are categorized as either project commands (requiring React Native project configuration) or detached commands (working standalone).

Capabilities

Project Commands

Commands that require a React Native project configuration and only work within a React Native project directory.

Config Command

Outputs the current CLI configuration as JSON for debugging and inspection.

npx react-native config [options]

Options:
  --platform <platform>    Output configuration for a specific platform (ios, android, etc.)
  --verbose               Increase logging verbosity

Usage Examples:

# Display full configuration
npx react-native config

# Display iOS-specific configuration
npx react-native config --platform ios

# Display Android-specific configuration  
npx react-native config --platform android

Clean Command

Cleans the project by removing React Native related caches and modules to resolve build and dependency issues.

npx react-native clean [options]

Options:
  --include <string>         Comma-separated flag of caches to clear
  --project-root <string>    Root path to React Native project (default: current directory)
  --verify-cache            Whether to verify the cache (npm only)
  --verbose                 Increase logging verbosity

Supported cache types:

  • metro: Metro bundler cache
  • watchman: Watchman file watching cache (macOS/Linux)
  • android: Android build cache and gradle cache
  • cocoapods: CocoaPods cache (macOS only)
  • yarn: Yarn cache
  • npm: npm cache
  • bun: Bun cache

Usage Examples:

# Clean all caches
npx react-native clean

# Clean specific caches
npx react-native clean --include metro,android

# Clean with cache verification
npx react-native clean --verify-cache

# Clean from specific project root
npx react-native clean --project-root /path/to/project

Info Command

Displays system information including React Native version, platform tools, and development environment details.

npx react-native info [options]

Options:
  --verbose    Increase logging verbosity

Usage Examples:

# Display system information
npx react-native info

Sample output includes:

  • React Native version and installation path
  • Node.js version
  • npm/Yarn version
  • Platform-specific tools (Android SDK, Xcode, etc.)
  • Development environment status

Detached Commands

Commands that work without requiring a React Native project configuration and can be run from any directory.

Init Command

Initializes a new React Native project with the specified name and configuration options.

npx react-native init [projectName] [options]

Arguments:
  projectName              Name of the new React Native project (optional)

Options:
  --version <string>       React Native version to install in the template
  --template <string>      Uses a custom template (npm package name or path)
  --pm <string>           Use specific package manager (yarn, npm, bun). Default: npm
  --directory <string>     Uses a custom directory instead of <projectName>
  --title <string>         Uses a custom app title name for application
  --skip-install          Skips dependencies installation step
  --install-pods [boolean] Determine if CocoaPods should be installed (iOS)
  --package-name <string>  Custom package name (Android) and bundle ID (iOS)
  --platform-name <string> Name of out of tree platform (e.g., react-native-macos)
  --skip-git-init         Skip git repository initialization
  --replace-directory [boolean] Replaces the directory if it already exists
  --yarn-config-options <string> Extra options for .yarnrc.yml file (key=value,key2=value2)
  --verbose               Increase logging verbosity

Usage Examples:

# Create new project with default settings
npx react-native init MyApp

# Create project with TypeScript template
npx react-native init MyApp --template react-native-template-typescript

# Create project with specific React Native version
npx react-native init MyApp --version 0.72.0

# Create project with custom package name
npx react-native init MyApp --package-name com.company.myapp

# Create project with Yarn
npx react-native init MyApp --pm yarn

# Create project without installing dependencies
npx react-native init MyApp --skip-install

# Create project in custom directory
npx react-native init MyApp --directory my-custom-directory

# Create project for out-of-tree platform
npx react-native init MyApp --platform-name macos

# Replace existing directory
npx react-native init MyApp --replace-directory true

Doctor Command

Diagnoses and optionally fixes common Node.js, iOS, Android, and React Native development environment issues.

npx react-native doctor [options]

Options:
  --fix                   Attempt to fix all diagnosed issues automatically
  --contributor          Add healthchecks for React Native contributors
  --verbose              Increase logging verbosity

Usage Examples:

# Run diagnostics only
npx react-native doctor

# Run diagnostics and attempt fixes
npx react-native doctor --fix

# Include contributor-specific checks
npx react-native doctor --contributor

Diagnostic checks include:

  • Node.js version compatibility
  • Android development environment (SDK, tools, paths)
  • iOS development environment (Xcode, simulators, CocoaPods)
  • Common configuration issues
  • Development server accessibility

Command Architecture

Command Registration

Commands are automatically registered with the following features:

  • Error Handling: Automatic error catching and user-friendly error messages
  • Verbose Logging: Optional detailed logging with --verbose flag
  • Help Generation: Automatic help text with examples and option descriptions
  • Option Parsing: Type-safe option parsing and validation

Command Types

type ProjectCommand = {
  name: "config" | "clean" | "info";
  detached: false;
  requiresProject: true;
};

type DetachedCommand = {
  name: "init" | "doctor";  
  detached: true;
  requiresProject: false;
};

Global Options

All commands support these global options:

  • --verbose: Increase logging verbosity for debugging
  • --help: Display command-specific help information
  • --version: Display CLI version (when used without command)

Install with Tessl CLI

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

docs

cli-commands.md

index.md

main-api.md

typescript-types.md

tile.json