Skip to content

Commit 20da02b

Browse files
committed
chore: tier-1 monorepo cleanups
Move .editorconfig from package/ to the repo root so it covers every workspace. Drop dead code: - package/rollup-react-native-image.js: no callers, no rollup dep, no rollup.config; carried over from a pre-builder-bob layout. - package/metro-dev-helpers/: not in core's published `files` allowlist (would 404 for any npm consumer following the README recipe), no in-repo users, recipe used the legacy Metro `blacklistRE` API that examples/SampleApp/metro.config.js already supersedes. README updated to point at the live SampleApp metro config. - examples/{SampleApp,TypeScriptMessaging}/__tests__/App-test.tsx and their jest.config.js: unmodified RN scaffold smoke tests; CI never runs example tests (root test:coverage proxies to core), SampleApp's own test:unit script was literally `echo Skipping...`. Drops jest, react-test-renderer, @types/jest, @types/react-test-renderer from both example apps. - babel-eslint@10.1.0 from package/devDependencies: deprecated package and the source of a recurring peer-warning during install. Sync version pins: - root resolutions: @types/react ^19.0.0 -> ^19.1.0 to match actual usage across workspaces. - examples/{SampleApp,TypeScriptMessaging}: @types/jest ^29.5.14 -> ^30.0.0 to match the jest 30 already installed. ESLint flat-config future-proofing: - Drop the legacy `/* eslint-env node */` comment in package/metro-dev-helpers/extract-linked-packages.js (the file was deleted) and there are no others left. Removes the deprecation warning that ESLint 10 will turn into an error. Add engines.node `>=20.19.4` to root package.json (mirrors the floor SampleApp already declared).
1 parent c2153f0 commit 20da02b

17 files changed

Lines changed: 15 additions & 425 deletions
File renamed without changes.

examples/README.md

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -34,50 +34,11 @@ Here I am assuming that the clone of `stream-chat-react-native` and your app are
3434

3535
### Metro config
3636

37-
If you run your app at this point, you will run into some issues related to `dependency collision`.
38-
Since metro bundler will have `node_module` dependencies from your `app` folder, `stream-chat-react-native`
39-
folder and `stream-chat-react-native/native-package` folder. And it doesn't know how to resolve those
40-
dependencies.
37+
If you run your app at this point, you'll hit `dependency collision` errors -- Metro doesn't know how to resolve modules (`react`, `react-native`, etc.) that appear both under your app's `node_modules` and under the cloned SDK's. You need to teach Metro which copy of each shared package to use and where to watch for SDK source changes.
4138

42-
So you need to modify `metro.config.js`. We added some helpers for that inside of our package.
43-
You can copy-paste the following config:
39+
The cleanest reference is the in-repo example: [`examples/SampleApp/metro.config.js`](./SampleApp/metro.config.js). It uses `@react-native/metro-config` + `@rnx-kit/metro-config`'s `resolveUniqueModule` to handle deduplication, then adds the SDK directories to Metro's `watchFolders`. Copy that file into your app and adjust the paths to point at your local clone of `stream-chat-react-native`.
4440

45-
:::note
46-
If you're using an older `metro-config` version, you may need to replace
47-
48-
```js
49-
const blacklist = require('metro-config/src/defaults/exclusionList');
50-
```
51-
52-
with
53-
54-
```js
55-
const blacklist = require('metro-config/src/defaults/blackList');
56-
```
57-
58-
:::
59-
60-
```js
61-
const PATH = require('path');
62-
const blacklist = require('metro-config/src/defaults/exclusionList');
63-
64-
const extractLinkedPackages = require('stream-chat-react-native-core/metro-dev-helpers/extract-linked-packages');
65-
66-
const projectRoot = PATH.resolve(__dirname);
67-
68-
const { alternateRoots, extraNodeModules, moduleBlacklist } = extractLinkedPackages(projectRoot);
69-
70-
module.exports = {
71-
resolver: {
72-
blacklistRE: blacklist(moduleBlacklist),
73-
extraNodeModules,
74-
useWatchman: false,
75-
},
76-
watchFolders: [projectRoot].concat(alternateRoots),
77-
};
78-
```
79-
80-
And as last step, clean install your app.
41+
Then clean-install:
8142

8243
```
8344
rm -rf node_modules
@@ -87,7 +48,7 @@ watchman watch-del-all
8748
yarn start --reset-cache
8849
```
8950

90-
And that's all. If you make code changes in `stream-chat-react-native`, they should reflect in your application.
51+
Changes you make in your local SDK clone will be reflected in your application.
9152

9253
## Samples repository
9354

examples/SampleApp/__tests__/App-test.tsx

Lines changed: 0 additions & 20 deletions
This file was deleted.

examples/SampleApp/jest.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/SampleApp/package.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414
"ios": "react-native run-ios",
1515
"prestart": "yarn sync-native",
1616
"start": "react-native start",
17-
"test": "jest",
1817
"extract-changelog": "FILTER_PATH='examples/SampleApp' TAG_FORMAT=$npm_package_name'@v${version}' node ../../release/extract-changelog.js",
1918
"bootstrap": "yarn install",
2019
"release": "FILTER_PATH='examples/SampleApp' TAG_FORMAT=$npm_package_name'@v${version}' node ../../release/prod",
2120
"release-next": "echo \"Skipping next release for SampleApp\"",
22-
"test:unit": "echo \"Skipping unit tests for SampleApp\"",
2321
"clean": "watchman watch-del-all && yarn cache clean && rm -rf ios/build && pod cache clean --all && rm -rf android/build && cd android && ./gradlew clean && cd -",
2422
"clean-all": "yarn clean && rm -rf node_modules && rm -rf ios/Pods && rm -rf vendor && bundle install && yarn install && cd ios && bundle exec pod install && cd -",
2523
"fastlane:android-build": "bundle exec fastlane android firebase_build_and_upload deploy:false",
@@ -85,13 +83,9 @@
8583
"@react-native/metro-config": "0.81.6",
8684
"@react-native/typescript-config": "0.81.6",
8785
"@rnx-kit/metro-config": "^2.1.0",
88-
"@types/jest": "^29.5.14",
8986
"@types/lodash.mergewith": "^4.6.9",
9087
"@types/react": "^19.1.4",
91-
"@types/react-test-renderer": "^19.1.0",
9288
"babel-plugin-react-compiler": "^1.0.0",
93-
"jest": "^30.4.2",
94-
"react-test-renderer": "19.1.0",
9589
"typescript": "5.8.3"
9690
},
9791
"engines": {

examples/TypeScriptMessaging/__tests__/App-test.tsx

Lines changed: 0 additions & 20 deletions
This file was deleted.

examples/TypeScriptMessaging/jest.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/TypeScriptMessaging/package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"ios": "react-native run-ios",
1111
"prestart": "yarn sync-native",
1212
"start": "react-native start",
13-
"test": "jest",
1413
"clean": "watchman watch-del-all && yarn cache clean && rm -rf ios/build && pod cache clean --all && rm -rf android/build && cd android && ./gradlew clean && cd -",
1514
"clean-all": "yarn clean && rm -rf node_modules && rm -rf ios/Pods && rm -rf vendor && bundle install && yarn install && cd ios && bundle exec pod install && cd -"
1615
},
@@ -48,11 +47,7 @@
4847
"@react-native/metro-config": "0.80.2",
4948
"@react-native/typescript-config": "0.80.2",
5049
"@rnx-kit/metro-config": "^2.1.0",
51-
"@types/jest": "^29.5.14",
5250
"@types/react": "^19.1.0",
53-
"@types/react-test-renderer": "^19.1.0",
54-
"jest": "^30.4.2",
55-
"react-test-renderer": "19.1.0",
5651
"typescript": "5.8.3"
5752
}
5853
}

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
"examples/TypeScriptMessaging"
1111
],
1212
"resolutions": {
13-
"@types/react": "^19.0.0"
13+
"@types/react": "^19.1.0"
14+
},
15+
"engines": {
16+
"node": ">=20.19.4"
1417
},
1518
"dependenciesMeta": {
1619
"@swc/core": {

package/.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ yarn-error.log
1010
.DS_Store
1111
dist/
1212
lib/
13-
# lib/ ignores metro-dev-helpers/lib so:
14-
!metro-dev-helpers/lib
1513
.env*
1614
examples/SampleApp/ios/vendor/
1715
vendor

0 commit comments

Comments
 (0)