|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | + |
| 5 | +- `src/` — TypeScript API and types (`functions.ts`, `Storage.ts`, `types.ts`). |
| 6 | +- `cpp/` — C++ JSI core and bundled SQLite sources; runs on iOS/Android. |
| 7 | +- `android/` — Kotlin TurboModule + JNI glue (`CMakeLists.txt`, `*.kt`). |
| 8 | +- `ios/` — Objective‑C++ TurboModule (`OPSQLite.mm`) and `.xcframework` assets. |
| 9 | +- `c_sources/` — optional SQLite tokenizers/extensions compiled into the binary. |
| 10 | +- `example/` — React Native demo for local testing (iOS/Android). |
| 11 | +- `lib/` — build output (generated by `bob`); do not commit. |
| 12 | + |
| 13 | +## Build, Test, and Development Commands |
| 14 | + |
| 15 | +- Prereqs: Node 20 (`.nvmrc`), Yarn 4 (`yarn.lock`), Ruby for iOS pods. |
| 16 | +- Install deps: `yarn install` |
| 17 | +- Type check TS: `yarn typecheck` |
| 18 | +- Build JS outputs: `yarn prepare` (runs `bob build` → `lib/`) |
| 19 | +- Format native C/C++: `yarn clang-format-check` |
| 20 | +- Example app: |
| 21 | + - Install pods: `yarn pods` (runs in `example/`) |
| 22 | + - iOS run: `cd example && yarn ios` |
| 23 | + - Android run: `cd example && yarn android` (or `yarn build:android`) |
| 24 | + |
| 25 | +## Coding Style & Naming Conventions |
| 26 | + |
| 27 | +- TypeScript: Prettier enforced via `package.json` (single quotes, 2‑space |
| 28 | + indent, trailing commas `es5`). Use camelCase for variables/functions; |
| 29 | + PascalCase for types/classes. Keep strict typing; fix unused vars/params. |
| 30 | +- C/C++: `.clang-format` (LLVM style, 4‑space indent). Run |
| 31 | + `yarn clang-format-check` before pushing. |
| 32 | +- Kotlin/Obj‑C(++): Follow platform conventions and keep methods focused and |
| 33 | + small. |
| 34 | + |
| 35 | +## Testing Guidelines |
| 36 | + |
| 37 | +- No Jest configured. Validate changes with the `example/` app. Add minimal, |
| 38 | + reproducible flows under `example/src` when fixing bugs or adding features. |
| 39 | +- Verify both platforms build cleanly. Always run `yarn typecheck` and a local |
| 40 | + `yarn prepare` before opening a PR. |
| 41 | + |
| 42 | +## Commit & Pull Request Guidelines |
| 43 | + |
| 44 | +- Commits: clear, imperative messages. Conventional prefixes encouraged |
| 45 | + (`feat:`, `fix:`, `docs:`, `chore:`) with optional scope (`android`, `ios`, |
| 46 | + `cpp`, `ts`). |
| 47 | +- PRs: include a summary, motivation, test steps (iOS/Android), linked issues, |
| 48 | + and any performance notes/screenshots or logs. |
| 49 | +- Hygiene: do not commit `lib/`, `example/ios/Pods/`, or build artifacts. Ensure |
| 50 | + `yarn prepare` succeeds locally. |
| 51 | + |
| 52 | +## Architecture Notes |
| 53 | + |
| 54 | +- JSI TurboModule: `src/` exposes the public API; native JSI lives in `cpp/`, |
| 55 | + bridged via `android/` (JNI/Kotlin) and `ios/` (Obj‑C++). Feature flags (FTS5, |
| 56 | + RTree, SQLCipher, libsql) for the demo are configured in |
| 57 | + `example/package.json` under `op-sqlite`. |
0 commit comments