This file provides guidance to agents when working with code in this repository.
rnx-kit is a monorepo of React Native tooling created by Microsoft. It
provides battle-tested tools for dependency management, Metro bundling
enhancements, TypeScript integration, and cross-platform development (iOS,
Android, macOS, Windows).
packages/- Stable, published packages (e.g.,@rnx-kit/cli,@rnx-kit/align-deps,@rnx-kit/metro-*)incubator/- Experimental packages (marked with"experimental": truein package.json)scripts/- Internal build tooling (rnx-kit-scriptsCLI)docsite/- Documentation website (separate Yarn workspace with its ownyarn.lock; not in rootworkspaces).changeset/- Changeset configuration for versioning
Uses Nx for task orchestration with Yarn Berry workspaces. Node linker
is pnpm. Requires Node.js >=18.12.
TypeScript compilation uses @typescript/native-preview (tsgo) by default.
The --with-tsc flag falls back to standard tsc (only metro-config uses
this).
yarn # Install dependencies
yarn build # Build all packages
yarn build-scope <pkg> # Build specific package with dependencies (e.g., yarn build-scope @rnx-kit/cli)
yarn test # Build and test all packages
yarn lint # Lint all packages
yarn format # Format all packages with Prettier
yarn clean # Clean build artifacts (git clean)
yarn show-affected # Show affected projects
yarn update-readme # Regenerate API docs in READMEs (TypeDoc)yarn build # Build current package only
yarn build --dependencies # Build current package and its dependencies
yarn test # Run tests
yarn lint # Lint current package
yarn format # Format current package- Default test runner: Node.js built-in test runner (
node:test) — most packages use this - Jest: Used by ~7 packages that have
"jest"inpackage.jsonor ajest.config.js - The
rnx-kit-scripts testcommand auto-detects which runner to use - Tests live in
test/directories with.test.tsextension - Run specific test:
yarn test path/to/file.test.ts(from package directory)
Node test runner style:
import { equal } from "node:assert/strict";
import { describe, it } from "node:test";yarn build:ci # Build and test affected packages
yarn build:ci:all # Build and test ALL packages
yarn bundle:ci # Bundle affected packages
yarn change:check # Verify change files exist for modified packages- Each package uses
rnx-kit-scriptsfor build/test/lint/format commands - TypeScript source in
src/, compiled output inlib/ - Entry point typically at
src/index.ts - Standard dev dependencies:
@rnx-kit/eslint-config,@rnx-kit/scripts,@rnx-kit/tsconfig @rnx-kit/jest-presetis only added when a package uses Jest (not default)eslint.config.jsre-exports@rnx-kit/eslint-config- Published packages use a
"typescript"export condition pointing tosrc/index.tsfor development - Files named
types.tsenforce the@rnx-kit/type-definitions-onlyESLint rule (only type exports allowed)
yarn new-package <name> # Creates in packages/
yarn new-package <name> --experimental # Creates in incubator/Uses packages/template as baseline. Sets version to 0.0.1, adds experimental
banner for incubator packages.
Uses Changesets for versioning:
yarn change # Create change file for PROne change file per feature/fix; no need for multiple entries when addressing PR
feedback. Releases are automated via CI — on merge to main, the changesets
action creates a release PR or publishes to npm.
Ignored packages (no changesets needed): @rnx-kit/ignore, @rnx-kit/template,
test apps.
@rnx-kit/cli- Main CLI (rnx-cli) integrating all tools@rnx-kit/align-deps- Dependency version alignment across repos@rnx-kit/metro-*- Metro bundler plugins (TypeScript, config, tree-shaking, duplicate detection, cyclic deps)@rnx-kit/tools-*- Platform-specific utilities (android, apple, node, react-native, filesystem, shell, workspaces, etc.)@rnx-kit/config- Configuration loading frompackage.jsonrnx-kitfield@rnx-kit/eslint-plugin- Custom ESLint rules (no-foreach-with-captured-variables,type-definitions-only)@rnx-kit/typescript-react-native-resolver- TypeScript resolver for React Native
The repo uses align-deps to maintain consistent dependency versions. Run from
root:
yarn rnx-align-deps --write # Fix misaligned dependenciesThese all run in CI and should pass before merging:
yarn format # Prettier formatting
yarn lint # ESLint
yarn rnx-align-deps --write # Dependency alignment
yarn constraints --fix # Yarn constraints (consistent author, homepage, repository fields)
yarn knip # Detect unused dependencies
yarn dedupe --check # Prevent package duplicates in lockfile
node scripts/lint-tsconfig.ts # Validate TypeScript configs
yarn update-readme # Regenerate API docsCI uses suggestion-bot to post code review suggestions for format,
constraints, align-deps, and readme issues.
- Test apps:
packages/test-app(iOS/Android),packages/test-app-macos,packages/test-app-windows - Native builds require platform toolchains (Xcode, Android Studio, Visual Studio)
- CocoaPods installation is handled in CI via
microsoft/react-native-test-appGitHub actions
- Prettier for formatting, ESLint for linting
- Run
yarn formatandyarn lintbefore committing - Prettier config:
.github/prettierrc.json(usesprettier-plugin-organize-imports) - ESLint config:
packages/eslint-config/(combines@microsoft/eslint-plugin-sdlwith@rnx-kit/eslint-plugin)