Skip to content

Commit c217402

Browse files
committed
chore(deps): update dependencies and code structure for improved readability and maintainability
1 parent e61c567 commit c217402

File tree

11 files changed

+25687
-14368
lines changed

11 files changed

+25687
-14368
lines changed

.github/copilot-instructions.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ yarn test --coverage
122122
cd example/
123123

124124
# Install dependencies
125-
yarn install
126-
# or
127125
npm install
128126

129127
# Start Expo development server
@@ -140,15 +138,15 @@ expo start --web
140138
<commands>
141139
```bash
142140
# Build package for distribution
143-
yarn prepare
141+
npm run prepare
144142

145143
# This runs:
146144
# 1. bob build (creates dist files)
147145
# 2. node scripts/dist.js (finalizes distribution)
148146

149147
# Lint and format code
150-
yarn prettify # Prettier formatting
151-
yarn lint # ESLint checking
148+
npm run prettify # Prettier formatting
149+
npm run lint # ESLint checking
152150

153151
# Pre-commit hooks run lint-staged automatically
154152
```

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
#
33
.DS_Store
44

5-
package-lock.json
6-
75
node_modules
86

97
# Xcode

example/metro.config.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
const { getDefaultConfig } = require('expo/metro-config');
2+
// Use the exported private path so Node respects the package "exports" map
3+
// (requiring `metro-config/src/...` can fail under newer Node/npm due to exports restrictions).
4+
const exclusionList = require('metro-config/private/defaults/exclusionList');
5+
const path = require('path');
6+
7+
/**
8+
* Custom Metro configuration for the example app.
9+
*
10+
* Important: We intentionally DO NOT include the parent (repo root) node_modules
11+
* path in nodeModulesPaths anymore because the root devDependencies use a newer
12+
* React / React Native (0.81.x) version than the example (Expo SDK 51 with
13+
* React Native 0.74.x). Allowing Metro to resolve modules from the root caused
14+
* it to pick up the newer react-native implementation which currently ships
15+
* TypeScript-only syntax (e.g. `} as ReactNativePublicAPI;`) that the example
16+
* Babel preset (SDK 51) was not configured to parse, triggering a syntax error.
17+
*
18+
* By constraining resolution to the example's own node_modules we guarantee the
19+
* correct (0.74.x) React Native code path is bundled. We still alias the
20+
* library source so changes to the `lib` folder are reflected live.
21+
*/
22+
const config = getDefaultConfig(__dirname);
23+
24+
// Only watch the library source for live development to avoid pulling in root node_modules versions.
25+
config.watchFolders = [path.resolve(__dirname, '..', 'lib')];
26+
27+
// Allow dependencies from both local and root node_modules (library dev deps) while we block root RN.
28+
config.resolver.nodeModulesPaths = [
29+
path.resolve(__dirname, 'node_modules'),
30+
path.resolve(__dirname, '..', 'node_modules'),
31+
];
32+
33+
// Alias the library to its source entry to ensure it resolves correctly without needing the root node_modules.
34+
config.resolver.alias = {
35+
'react-native-big-list': path.resolve(__dirname, '..', 'lib', 'index.js'),
36+
// Force React Native to resolve to the example's version
37+
'react-native': path.resolve(__dirname, 'node_modules', 'react-native'),
38+
};
39+
40+
// Block the root react-native (0.81.x) to avoid TS-only syntax errors
41+
const rootReactNativePath = path.resolve(__dirname, '..', 'node_modules', 'react-native');
42+
config.resolver.blockList = exclusionList([
43+
new RegExp(`${rootReactNativePath.replace(/[-/\\^$*+?.()|[\]{}]/g, r => `\\${r}`)}.*`),
44+
]);
45+
46+
// Remove any explicit extraNodeModules overrides (not needed with isolated resolution).
47+
delete config.resolver.extraNodeModules;
48+
49+
module.exports = config;

0 commit comments

Comments
 (0)