Skip to content

Commit fea39e6

Browse files
committed
docs: document yarn 4 + workspaces setup
Update CLAUDE.md's "Common Commands" section for the Yarn 4 workspaces world: - Explain the committed Yarn 4 binary + yarnPath dispatch (no Corepack required). - Replace `cd package && yarn ...` examples with root-level `yarn lint`, `yarn build`, `yarn test:unit` (forwarded via `yarn workspace`). - Drop the `yarn install --frozen-lockfile` / `yarn install-all` snippets; explain the single-root `yarn install` with its postinstall (husky install + shared-native sync). - Note that Lerna is gone and the release pipeline runs via `yarn workspaces foreach`. Update examples/README.md to clarify that the three example apps in this repo are now workspaces wired via `workspace:^`; keep the existing `link:` guidance scoped to "consuming the SDK from an app outside this monorepo," which is its actual use case.
1 parent aefbd8e commit fea39e6

2 files changed

Lines changed: 33 additions & 22 deletions

File tree

CLAUDE.md

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,50 +6,56 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
66

77
Stream Chat React Native SDK monorepo. The main SDK code lives in `package/` (published as `stream-chat-react-native-core`). Built on top of the `stream-chat` JS client library.
88

9+
This is a **Yarn 4 (Berry)** workspace monorepo. The Yarn binary lives in `.yarn/releases/yarn-4.14.1.cjs` and is invoked via `yarnPath` in `.yarnrc.yml`; any globally-installed Yarn launcher (e.g. the Homebrew Yarn 1.x) auto-delegates to it. No Corepack required.
10+
11+
Workspaces: `package`, `package/native-package`, `package/expo-package`, `examples/SampleApp`, `examples/ExpoMessaging`, `examples/TypeScriptMessaging`. There is a single root `yarn.lock`.
12+
913
## Common Commands
1014

11-
All commands below run from the repo root unless noted otherwise.
15+
All commands below run from the repo root.
16+
17+
### Install
18+
19+
```bash
20+
yarn install # Set up every workspace (single root lockfile)
21+
yarn install --immutable # CI-style; fail if yarn.lock would change
22+
```
23+
24+
The root `package/`'s `postinstall` runs `husky install` and `yarn shared-native:sync` automatically.
1225

1326
### Build
1427

1528
```bash
16-
yarn build # Build all packages (runs in package/)
17-
cd package && yarn build # Build SDK directly
29+
yarn build # SDK build (commonjs + esm + types)
30+
yarn workspace stream-chat-react-native-core build # Same, explicit form
1831
```
1932

2033
### Lint & Format
2134

2235
```bash
23-
cd package && yarn lint # Check prettier + eslint + translation validation (max-warnings 0)
24-
cd package && yarn lint-fix # Auto-fix lint and formatting issues
36+
yarn lint # prettier + eslint + translation validation (max-warnings 0)
37+
yarn lint-fix # Auto-fix lint and formatting issues
2538
```
2639

2740
### Test
2841

2942
```bash
30-
cd package && yarn test:unit # Run all unit tests (sets TZ=UTC)
31-
cd package && yarn test:coverage # Run with coverage report
32-
cd package && TZ=UTC npx jest path/to/test.test.tsx # Run a single test file
43+
yarn test:unit # All unit tests (sets TZ=UTC)
44+
yarn test:coverage # With coverage report
45+
yarn workspace stream-chat-react-native-core test:unit # Same as `yarn test:unit`
46+
cd package && TZ=UTC npx jest path/to/test.test.tsx # Single test file
3347
```
3448

3549
Tests use Jest with `react-native` preset and `@testing-library/react-native`. Test files live alongside source at `src/**/__tests__/*.test.ts(x)`. Mock builders are in `src/mock-builders/`.
3650

3751
To run a single test, you can also temporarily add the file path to the `testRegex` array in `package/jest.config.js`.
3852

39-
### Install
40-
41-
```bash
42-
yarn install --frozen-lockfile # Root dependencies
43-
cd package && yarn install-all # SDK + native-package + expo-package
44-
```
45-
4653
### Sample App
4754

4855
```bash
49-
cd examples/SampleApp && yarn install
50-
cd examples/SampleApp && yarn start # Metro bundler
51-
cd examples/SampleApp && yarn ios # Run iOS
52-
cd examples/SampleApp && yarn android # Run Android
56+
yarn workspace sampleapp start # Metro bundler (alias: cd examples/SampleApp && yarn start)
57+
yarn workspace sampleapp ios # Run iOS
58+
yarn workspace sampleapp android # Run Android
5359
```
5460

5561
## Architecture
@@ -153,4 +159,5 @@ Translation JSON files live in `src/i18n/`. `validate-translations` (run as part
153159
- **Prettier**: single quotes, trailing commas, 100 char width (see `.prettierrc`)
154160
- **TypeScript strict mode** with platform-specific module suffixes (`.ios`, `.android`, `.web`)
155161
- Git branches: PRs target `develop`, `main` is production releases only
156-
- **Shared native sync**: Run `yarn shared-native:sync` from `package/` after modifying shared native code to copy to native-package and expo-package
162+
- **Shared native sync**: Root `yarn install`'s postinstall runs `yarn shared-native:sync` automatically. Re-run manually with `yarn workspace stream-chat-react-native-core shared-native:sync` after modifying `package/shared-native/`.
163+
- **No Lerna**: the release pipeline uses `yarn workspaces foreach` directly. Release-participating workspaces (core SDK + SampleApp) are hardcoded in `release/release.config.js`.

examples/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
This directory contains all the example apps that uses our Stream Chat React Native SDK components.
1+
This directory contains all the example apps that use our Stream Chat React Native SDK components.
22

3-
On RN <= 0.72, symlink was not supported by default so the setup has to be done locally through metro config to run the project within the monorepo. The guide below addresses the same.
3+
The three apps -- `SampleApp`, `ExpoMessaging`, `TypeScriptMessaging` -- are Yarn 4 workspaces of the repo root. A single `yarn install` at the repo root sets all of them up; their SDK dependencies (`stream-chat-react-native-core`, `stream-chat-react-native`, `stream-chat-expo`) are wired via `workspace:^`, and each app's `metro.config.js` adds the SDK source to Metro's watch folders and resolution table.
4+
5+
On RN <= 0.72, symlink was not supported by default so the setup has to be done locally through metro config to run the project within the monorepo. The guide below addresses the same -- it remains useful when you want to consume a locally-cloned SDK from an app that lives **outside** this monorepo.
46

57
### Running a local SDK clone on your app
68
@@ -19,6 +21,8 @@ Replace the `stream-chat-react-native` dependency with following:
1921
"stream-chat-expo": "link:../stream-chat-react-native/package/expo-package", // If youre using expo
2022
```
2123

24+
(Within this repo, the in-monorepo apps use `"workspace:^"` instead of `link:` -- the snippet above is for an app that lives outside the monorepo.)
25+
2226
Here I am assuming that the clone of `stream-chat-react-native` and your app are under common directory. For example,
2327

2428
```

0 commit comments

Comments
 (0)