React Native OTA Bundler CLI
raw JSON →rn-ota-bundler is a command-line interface (CLI) tool designed to streamline Over-The-Air (OTA) updates for React Native applications that utilize a multi-bundle architecture. It provides a comprehensive suite of commands to bundle, optionally obfuscate using `javascript-obfuscator`, zip, and manage React Native modules, then upload them to a remote server for distribution. The current stable version is 1.0.15. While a specific release cadence isn't published, the tool appears actively maintained as a solution for modern React Native development. Key differentiators include its end-to-end CLI workflow for managing the entire OTA lifecycle, from local bundling and obfuscation to server interaction for authentication, module/variant management, and release deployment, catering specifically to multi-bundle React Native setups. It simplifies version detection for both Android and iOS platforms by parsing `build.gradle` or `Info.plist`/`project.pbxproj` and integrates optional JavaScript obfuscation for deployed bundles.
Common errors
error Error: Command not found: rn-ota-bundler ↓
npx (e.g., npx rn-ota-bundler login) or that the package is globally installed if you intend to use it without npx (npm install -g rn-ota-bundler). error Error: Module '<module_name>' not found. Please add it first. ↓
modules --add command: npx rn-ota-bundler modules --add <module_name>. error Error: Not authenticated. Please login first. ↓
npx rn-ota-bundler login to authenticate and save your JWT token locally before attempting server-interacting commands like release or bundles. error Error: Missing required option: --module <name> ↓
-m or --module option. For example: npx rn-ota-bundler bundle -m homepage -p android. Warnings
gotcha The CLI expects a specific project structure, including `src/<module_name>/index.js` as the entry point for modules and standard React Native `android/` and `ios/` directories for app version detection. Deviations can lead to bundling failures or incorrect versioning. ↓
gotcha By default, the CLI attempts to connect to an OTA server at `http://localhost:3000`. For production use, or if your server is elsewhere, this default must be overridden by modifying `src/default-config.json` before building the tool, or through environment variables/configuration if available. ↓
gotcha Obfuscation, when enabled with the `--obfuscate` flag, relies on the presence of an `obfuscator.config.json` file in the root directory of your project. If this file is missing, obfuscation will not be applied, even if the flag is set. ↓
gotcha Commands such as `release`, `bundles`, `history`, and `edit-bundle` that interact with the remote OTA server require prior authentication. Failure to log in will result in authorization errors. ↓
Install
npm install rn-ota-bundler yarn add rn-ota-bundler pnpm add rn-ota-bundler Imports
- CLI Execution wrong
const rnOtaBundler = require('rn-ota-bundler');correctnpx rn-ota-bundler <command> [options] - Named Exports (N/A) wrong
import { bundle, release } from 'rn-ota-bundler';correct(N/A) - Default Export (N/A) wrong
import rnOtaBundler from 'rn-ota-bundler';correct(N/A)
Quickstart
// First, install the CLI tool as a dev dependency
npm install -D rn-ota-bundler
// Login to the OTA server. By default, it attempts to connect to http://localhost:3000.
// This command opens a browser for authentication and saves the JWT token locally.
npx rn-ota-bundler login
// Add a new module named 'myAppModule'. This registers it with the OTA system.
npx rn-ota-bundler modules --add myAppModule
// Add a new environment/variant named 'staging' for organizing releases.
npx rn-ota-bundler variants --add staging
// Add a local app version '1.0.0' for tracking compatibility with bundles.
npx rn-ota-bundler versions --add 1.0.0
// Bundle the 'myAppModule' for the Android platform, enabling obfuscation.
// For obfuscation to take effect, an 'obfuscator.config.json' file must be present in your project's root directory.
npx rn-ota-bundler bundle -m myAppModule -p android --obfuscate
// Release (bundle and upload) the 'myAppModule' for the iOS platform to the configured server.
// This command performs bundling and then uploads the generated zip file.
npx rn-ota-bundler release -m myAppModule -p ios
// List all remote bundles that have been uploaded.
npx rn-ota-bundler bundles
// Edit properties of a previously released bundle (e.g., bundle ID '123').
// Here, we activate the bundle and set its minimum compatible app version.
npx rn-ota-bundler edit-bundle 123 --active true --min-app 1.0.0