diff --git a/.codex/environments/environment.toml b/.codex/environments/environment.toml new file mode 100644 index 000000000..3a07c2b1c --- /dev/null +++ b/.codex/environments/environment.toml @@ -0,0 +1,17 @@ +# THIS IS AUTOGENERATED. DO NOT EDIT MANUALLY +version = 1 +name = "repack" + +[setup] +script = ''' +# mise setup +mise trust +mise use node@24 + +# copy git ignored files +wt step copy-ignored + +# repo setup +pnpm i +pnpm build +''' diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..93227d931 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,33 @@ +# AGENTS.md + +Re.Pack is a toolkit for building and developing React Native applications with Webpack or Rspack instead of Metro. This repository contains the core bundling/runtime packages, integration plugins, and validation apps/tests used to verify behavior across supported setups. + +## Repository Shape + +- This is a JavaScript/TypeScript monorepo for Re.Pack (React Native bundling with Webpack/Rspack). +- `packages/` contains core libraries and integrations. +- `apps/` contains runnable validation applications. +- `tests/` contains compatibility and regression suites. + +## Package Map (Relatively Stable Context) + +- `packages/repack/`: Core toolkit with CLI commands, bundler plugins/loaders, and runtime modules. +- `packages/dev-server/`: Bundler-agnostic React Native development server. +- `packages/init/`: Initialization tooling for integrating Re.Pack into React Native projects. +- `packages/plugin-expo-modules/`: Re.Pack integration for Expo Modules. +- `packages/plugin-nativewind/`: Re.Pack integration for NativeWind. +- `packages/plugin-reanimated/`: Re.Pack integration for react-native-reanimated. + +## Validation Surfaces + +### Apps + +- `apps/tester-app/`: Primary manual/integration validation app. +- `apps/tester-federation/`: Module Federation v1 validation app. +- `apps/tester-federation-v2/`: Module Federation v2 validation app. + +### Tests + +- `tests/integration/`: Integration-level automated coverage. +- `tests/metro-compat/`: Metro compatibility behavior coverage. +- `tests/resolver-cases/`: Resolver behavior and edge-case coverage. diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index ea117bb9a..000000000 --- a/CLAUDE.md +++ /dev/null @@ -1,78 +0,0 @@ -# CLAUDE.md - -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. - -## Development Commands - -This is a pnpm monorepo using Turborepo for task orchestration. The root package.json contains the most important commands: - -**Build & Development:** -- `pnpm build` - Run a Turborepo build across workspace packages -- `pnpm dev` - Run Turborepo watch mode for build across workspace packages -- `pnpm lint` - Run Biome linter with auto-fix -- `pnpm lint:ci` - Run Biome linter without auto-fix (CI mode) -- `pnpm typecheck` - Run TypeScript checking across all packages -- `pnpm test` - Run tests across all packages - -**iOS Development:** -- `pnpm pods` - Install CocoaPods dependencies for all apps -- `pnpm pods:update` - Update CocoaPods dependencies - -**Testing with specific configurations:** -Use the test apps in the `apps/` directory to verify functionality: -- `apps/tester-app` - Main test application -- `apps/tester-federation-v2` - Module Federation v2 testing -- `apps/tester-federation` - Module Federation v1 testing - -**Individual package commands:** -Navigate to specific packages and use their local scripts. For example, in `packages/repack/`: -- `pnpm test` - Run Jest tests -- `pnpm build` - Build the package -- `pnpm clang-format` - Format native code (iOS and Android) - -## Architecture Overview - -Re.Pack is a React Native bundler that provides webpack/rspack bundling as an alternative to Metro. The codebase is organized as follows: - -**Core Packages:** -- `packages/repack/` - Main bundler package with CLI commands, webpack plugins, and runtime modules -- `packages/dev-server/` - Development server implementation -- `packages/init/` - CLI tool for initializing Re.Pack in React Native projects -- `packages/plugin-*` - Various plugins (expo-modules, nativewind, reanimated) - -**Key Architecture Components:** -- **Commands** (`packages/repack/src/commands/`) - CLI implementations for rspack and webpack bundling -- **Plugins** (`packages/repack/src/plugins/`) - Webpack/Rspack plugins for React Native bundling -- **Loaders** (`packages/repack/src/loaders/`) - Custom webpack loaders (assets, babel, flow, react-refresh) -- **Modules** (`packages/repack/src/modules/`) - Runtime modules including ScriptManager for chunk loading -- **Native Code** - iOS (Swift/Objective-C) and Android (Kotlin) implementations in `packages/repack/ios/` and `packages/repack/android/` - -**Development Server:** -The development server supports both single-platform (webpack CLI) and multi-platform (repack commands) modes with features like HMR, symbolication, and debugging. - -**Module Federation:** -Re.Pack provides first-class support for Module Federation for microfrontend architectures, with plugins for both v1 and v2. - -## Code Style & Standards - -- **Biome:** Uses Biome (configured in `biome.jsonc`) for import organization, formatting, and linting with specific rules for different file types -- **TypeScript:** Strict TypeScript configuration with path mapping -- **Formatting:** 2-space indentation, single quotes, trailing commas (ES5), semicolons always -- **Import Organization:** Biome automatically organizes imports when running `pnpm lint` -- **Native Code:** Use clang-format for iOS/Android C++/Swift/Kotlin code formatting - -## Testing Strategy - -- Jest for unit tests with specific configurations per package -- Metro compatibility tests in `tests/metro-compat/` -- Resolver test cases in `tests/resolver-cases/` -- Integration testing via tester apps - -## Key Development Notes - -- This is a monorepo managed by pnpm workspaces with Turborepo orchestration -- The project supports both Webpack and Rspack as bundling engines -- Native modules require building iOS and Android code when making changes -- Always run `pnpm lint` and `pnpm typecheck` before committing changes -- Use the tester apps to verify functionality across different React Native configurations -- When working with native code, run `pnpm clang-format` to ensure consistent formatting diff --git a/CLAUDE.md b/CLAUDE.md new file mode 120000 index 000000000..47dc3e3d8 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +AGENTS.md \ No newline at end of file