Inspector proxy for React Native and dev tools integration that bridges React Native apps and Chrome DevTools.
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Command line tool for quickly starting an inspector proxy server with configurable options. The CLI provides a simple way to launch a complete debugging infrastructure for React Native development.
The CLI accepts the following options for configuring the inspector proxy server:
interface CLIOptions {
port: number; // Port to run inspector proxy on
root: string; // Root folder of metro project
}# Install globally to use as command
npm install -g metro-inspector-proxy
# Start with default settings (port 8081, current directory as root)
metro-inspector-proxy
# Specify custom port
metro-inspector-proxy --port 9090
metro-inspector-proxy -p 9090
# Specify project root directory
metro-inspector-proxy --root /path/to/my/react/native/project
metro-inspector-proxy -r /path/to/my/react/native/project
# Combined options
metro-inspector-proxy --port 9090 --root /path/to/projectThe CLI is implemented using the yargs library for argument parsing:
const yargs = require('yargs');
const { runInspectorProxy } = require('./index');
const argv = yargs
.option('port', {
alias: 'p',
describe: 'port to run inspector proxy on',
type: 'number',
default: 8081,
})
.option('root', {
alias: 'r',
describe: 'root folder of metro project',
type: 'string',
default: '',
})
.parseSync();
runInspectorProxy(argv.port, argv.root);When started via CLI, the inspector proxy server automatically:
GET /json - List of inspectable pagesGET /json/list - Alternative pages endpointGET /json/version - Chrome DevTools protocol version/inspector/device - For React Native devices to connect/inspector/debug - For Chrome DevTools to connectThe CLI tool integrates seamlessly with React Native development:
# Terminal 1: Start Metro bundler
npx react-native start
# Terminal 2: Start inspector proxy (if not using Metro's built-in proxy)
metro-inspector-proxy --port 8081 --root /path/to/MyReactNativeApp
# Terminal 3: Start React Native app
npx react-native run-ios
# or
npx react-native run-androidOnce running, developers can:
chrome://inspectlocalhost:8081 to the target discovery settingsThe CLI tool runs as a persistent process that:
To stop the server, use Ctrl+C (SIGINT) in the terminal where it's running.
The CLI provides basic error handling:
The inspector proxy CLI is designed for development environments and: