|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | +This repository is a `pnpm` workspace with two main packages: |
| 5 | + |
| 6 | +- `packages/react-native`: the published SDK (`@formbricks/react-native`). Source lives in `src/`, grouped by domain under `src/lib/`, with React components in `src/components/` and shared types in `src/types/`. |
| 7 | +- `apps/playground`: an Expo app for manual testing and integration checks. App code is in `src/`, with static assets in `assets/`. |
| 8 | + |
| 9 | +GitHub Actions under `.github/workflows/` enforce build, lint, type-check, test, and release steps. |
| 10 | + |
| 11 | +## Build, Test, and Development Commands |
| 12 | +Run commands from the repository root unless package-scoped work is needed. |
| 13 | + |
| 14 | +- `pnpm install --frozen-lockfile`: install workspace dependencies. |
| 15 | +- `pnpm dev`: run Turbo watchers across packages. |
| 16 | +- `pnpm build`: build the SDK and playground. |
| 17 | +- `pnpm lint`: enforce exact dependency versions, then run Biome checks. |
| 18 | +- `pnpm check-types`: run TypeScript checks across the workspace. |
| 19 | +- `pnpm test`: run unit tests with Vitest. |
| 20 | +- `pnpm test:coverage`: generate coverage reports used in release validation. |
| 21 | +- `pnpm --filter playground ios` / `pnpm --filter playground android`: launch the Expo playground on a device target. |
| 22 | + |
| 23 | +## Coding Style & Naming Conventions |
| 24 | +Use TypeScript with strict compiler settings. Biome is the formatter and linter; run `pnpm format` before large refactors. The repo uses spaces for indentation, double quotes, and semicolons. |
| 25 | + |
| 26 | +Follow existing naming patterns: React components in lowercase kebab-style filenames such as `survey-web-view.tsx`, domain modules in concise lowercase names such as `state.ts`, and tests as `*.test.ts`. Keep imports using the `@/` alias inside `packages/react-native` when referencing `src/`. |
| 27 | + |
| 28 | +## Testing Guidelines |
| 29 | +Unit tests live beside each domain under `src/lib/**/tests/`. Prefer small, focused Vitest suites and place reusable doubles in local `__mocks__/` folders. Add or update tests with every behavior change; there is no published coverage threshold, but `test:coverage` is part of the release workflow, so changed code should stay covered. |
| 30 | + |
| 31 | +## Commit & Pull Request Guidelines |
| 32 | +Recent history mostly follows Conventional Commit-style subjects such as `feat:`, `fix:`, and `chore:` with short imperative summaries. Keep commits narrowly scoped and descriptive. |
| 33 | + |
| 34 | +PRs should include a clear summary, linked issue if applicable, and the commands you ran locally (`pnpm lint`, `pnpm check-types`, relevant tests). Include screenshots or screen recordings when a playground or UI behavior changes. Avoid loose dependency ranges: this repo enforces exact versions in every `package.json`. |
0 commit comments