Skip to content

Commit 9aca455

Browse files
authored
fix: correct package.json exports, update to 0.76 (#257)
BREAKING CHANGE: new setup instructions, fixed package.json exports
1 parent aa9e43d commit 9aca455

28 files changed

+27019
-18562
lines changed

.github/actions/setup/action.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,8 @@ runs:
99
with:
1010
node-version: 'lts/*'
1111

12-
- name: Get yarn cache directory path
13-
id: yarn-cache-dir-path
14-
shell: bash
15-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
16-
17-
- uses: actions/cache@v3
18-
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
19-
with:
20-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
21-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock', '**/package.json') }}
22-
restore-keys: |
23-
${{ runner.os }}-yarn-
24-
2512
- name: Install dependencies
2613
run: |
27-
yarn install --cwd example --frozen-lockfile
28-
yarn install --frozen-lockfile
14+
yarn --cwd example install --immutable
15+
yarn install --immutable
2916
shell: bash

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,9 @@ android/keystores/debug.keystore
6868

6969
# generated by bob
7070
lib/
71+
72+
# https://github.com/yarnpkg/berry/issues/454#issuecomment-530312089
73+
.yarn/*
74+
!.yarn/releases
75+
!.yarn/plugins
76+
!.yarn/patches

.watchmanconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
{}

.yarn/releases/yarn-4.5.2.cjs

Lines changed: 934 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
nodeLinker: node-modules
2+
3+
yarnPath: .yarn/releases/yarn-4.5.2.cjs

CONTRIBUTING.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ Remember to add tests for your change if possible. Run the unit tests by:
5959
yarn test
6060
```
6161

62-
6362
### Commit message convention
6463

6564
We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:

INSTALL.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,35 @@
11
# Installation & Setup
22

3-
Version >= 12 requires React Native 0.73 / Expo 50 or newer (because of `unstable_enablePackageExports`). Use version 11 if you're on older version of RN / Expo.
3+
Version >= 12 requires React Native 0.73 / Expo 50 or newer (because of [`unstable_enablePackageExports`](https://metrobundler.dev/docs/configuration/#unstable_enablepackageexports-experimental)). Use version 11 if you're on older version of RN / Expo.
44

55
Version >= 11 requires React Native 0.71 / Expo 48 or newer. Use version 10 if you're on older version of RN / Expo.
66

7-
1. In your `tsconfig.json`, make sure you have [`"moduleResolution": "NodeNext"`](https://www.typescriptlang.org/tsconfig#moduleResolution) set. This is required for TS to see the typings exported via [package.json `exports`](https://reactnative.dev/blog/2023/06/21/package-exports-support).
7+
1. In your `tsconfig.json`, make sure you set up `module` and `moduleResolution` like this:
8+
9+
```
10+
"module": "ESNext",
11+
"moduleResolution": "Bundler",
12+
```
13+
14+
[source 1](https://twitter.com/mattpocockuk/status/1724462050288587123), [source 2](https://callstack.github.io/react-native-builder-bob/esm). This is required for TS to see the typings exported via [package.json `exports`](https://reactnative.dev/blog/2023/06/21/package-exports-support).
815

916
2. add [`unstable_enablePackageExports`](https://metrobundler.dev/docs/configuration/#unstable_enablepackageexports-experimental) to your metro config (in `metro.config.js`). This field will default to `true` in a future version of RN so don't need to worry about it. This allows us to do some bundle size savings.
1017

11-
```js
12-
// if you use Expo:
13-
const config = getDefaultConfig(__dirname);
14-
// unstable_enablePackageExports: true,
15-
config.resolver.unstable_enablePackageExports = true;
16-
module.exports = config;
17-
18-
// if you use bare React Native:
19-
const config = {
20-
resolver: {
21-
unstable_enablePackageExports: true,
22-
},
23-
};
24-
module.exports = mergeConfig(getDefaultConfig(__dirname), config);
25-
```
18+
```js
19+
// if you use Expo:
20+
const config = getDefaultConfig(__dirname);
21+
// unstable_enablePackageExports: true,
22+
config.resolver.unstable_enablePackageExports = true;
23+
module.exports = config;
24+
25+
// if you use bare React Native:
26+
const config = {
27+
resolver: {
28+
unstable_enablePackageExports: true,
29+
},
30+
};
31+
module.exports = mergeConfig(getDefaultConfig(__dirname), config);
32+
```
2633

2734
3. `yarn add react-navigation-header-buttons`
2835

example/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,7 @@ yarn-error.log
7373
# generated by tests
7474
requires-android.txt
7575
requires-ios.txt
76+
77+
# prebuild
78+
android/
79+
ios/

example/.yarn/install-state.gz

1.26 MB
Binary file not shown.

example/.yarn/releases/yarn-4.5.2.cjs

Lines changed: 934 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)