Skip to content

Commit 5bc7888

Browse files
authored
fix: upgrade to latest react-native (#832)
1 parent 22ea74f commit 5bc7888

File tree

14 files changed

+47
-64
lines changed

14 files changed

+47
-64
lines changed

.github/workflows/build-templates.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ on:
2222
jobs:
2323
build:
2424
env:
25+
XCODE_VERSION: 16.2
2526
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
2627
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
2728

@@ -224,6 +225,12 @@ jobs:
224225
run: |
225226
yarn turbo run build:android --cache-dir=".turbo"
226227
228+
- name: Use appropriate Xcode version
229+
if: env.ios_build == 1 && env.turbo_cache_hit_ios != 1
230+
uses: maxim-lobanov/setup-xcode@v1
231+
with:
232+
xcode-version: ${{ env.XCODE_VERSION }}
233+
227234
- name: Restore cocoapods
228235
if: env.ios_build == 1 && env.turbo_cache_hit_ios != 1
229236
id: library-cocoapods-cache
@@ -238,13 +245,12 @@ jobs:
238245
${{ runner.os }}-library-cocoapods-
239246
240247
- name: Install cocoapods
241-
env:
242-
NO_FLIPPER: 1
243248
if: env.ios_build == 1 && env.turbo_cache_hit_ios != 1 && steps.library-cocoapods-cache.outputs.cache-hit != 'true'
244249
working-directory: ${{ env.work_dir }}
245250
run: |
246-
cd example/ios
247-
pod install
251+
cd example
252+
bundle install
253+
bundle exec pod install --project-directory=ios
248254
249255
- name: Cache cocoapods
250256
if: env.ios_build == 1 && env.turbo_cache_hit_ios != 1 && steps.library-cocoapods-cache.outputs.cache-hit != 'true'
@@ -255,12 +261,6 @@ jobs:
255261
${{ env.work_dir }}/**/ios/Podfile.lock
256262
key: ${{ steps.library-cocoapods-cache.outputs.cache-primary-key }}
257263

258-
- name: Use appropriate Xcode version
259-
if: env.ios_build == 1 && env.turbo_cache_hit_ios != 1
260-
uses: maxim-lobanov/setup-xcode@v1
261-
with:
262-
xcode-version: '16.2'
263-
264264
- name: Build example (iOS)
265265
if: env.ios_build == 1
266266
working-directory: ${{ env.work_dir }}

docs/pages/build.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ To configure your project manually, follow these steps:
7373
4. Configure the appropriate entry points:
7474

7575
```json
76-
"source": "./src/index.tsx",
7776
"main": "./lib/module/index.js",
7877
"types": "./lib/typescript/src/index.d.ts",
7978
"exports": {
8079
".": {
80+
"source": "./src/index.tsx",
8181
"types": "./lib/typescript/src/index.d.ts",
8282
"default": "./lib/module/index.js"
8383
},
@@ -91,7 +91,6 @@ To configure your project manually, follow these steps:
9191

9292
Here is what each of these fields mean:
9393

94-
- `source`: The path to the source code. It is used by `react-native-builder-bob` to detect the correct output files and provide better error messages.
9594
- `main`: The entry point for legacy setups that don't support the `exports` field. See [Compatibility](./esm.md#compatibility) for more details.
9695
- `types`: The entry point for the TypeScript definitions for legacy setups with `moduleResolution: node10` or `moduleResolution: node`.
9796
- `exports`: The entry points for tools that support the `exports` field in `package.json` - such as Node.js 12+, modern browsers and tools. See [the ESM support guide](./esm.md) for more details.

docs/pages/esm.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ To make use of the output files, ensure that your `package.json` file contains t
4040
"types": "./lib/typescript/src/index.d.ts",
4141
"exports": {
4242
".": {
43+
"source": "./src/index.tsx",
4344
"types": "./lib/typescript/src/index.d.ts",
4445
"default": "./lib/module/index.js"
4546
},
@@ -51,8 +52,9 @@ The `main` field is for tools that don't support the `exports` field (e.g. [Metr
5152

5253
The `exports` field is used by Node.js 12+, modern browsers and tools to determine the correct entry point. The entrypoint is specified in the `.` key and will be used when the library is imported or required directly (e.g. `import 'my-library'` or `require('my-library')`).
5354

54-
Here, we specify 2 conditions:
55+
Here, we specify 3 conditions:
5556

57+
- `source`: A custom condition used by `react-native-builder-bob` to determine the source file for the library.
5658
- `types`: Used for the TypeScript definitions.
5759
- `default`: Used for the actual JS code when the library is imported or required.
5860

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export const FALLBACK_BOB_VERSION = '0.40.8';
22
export const FALLBACK_NITRO_MODULES_VERSION = '0.22.1';
3-
export const SUPPORTED_REACT_NATIVE_VERSION = '0.78.2';
3+
export const SUPPORTED_REACT_NATIVE_VERSION = '0.79.2';

packages/create-react-native-library/src/exampleApp/generateExampleApp.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ const FILES_TO_DELETE = [
1919
'tsconfig.json',
2020
];
2121

22-
const FILES_TO_MOVE = ['.bundle', 'Gemfile'];
23-
2422
const PACKAGES_TO_REMOVE = [
2523
'@react-native/eslint-config',
2624
'@tsconfig/react-native',
@@ -119,13 +117,6 @@ export default async function generateExampleApp({
119117
await fs.remove(path.join(directory, file));
120118
}
121119

122-
// Move files to the root
123-
for (const file of FILES_TO_MOVE) {
124-
if (await fs.pathExists(path.join(directory, file))) {
125-
await fs.move(path.join(directory, file), path.join(root, file));
126-
}
127-
}
128-
129120
// Patch the example app's package.json
130121
const pkg = await fs.readJSON(path.join(directory, 'package.json'));
131122

@@ -142,7 +133,7 @@ export default async function generateExampleApp({
142133
const SCRIPTS_TO_ADD = {
143134
'build:android':
144135
'react-native build-android --extra-params "--no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a"',
145-
'build:ios': `react-native build-ios --scheme ${config.project.name}Example --mode Debug --extra-params "-sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO"`,
136+
'build:ios': `react-native build-ios --mode Debug`,
146137
};
147138

148139
if (config.example === 'vanilla') {

packages/create-react-native-library/src/input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const EXAMPLE_CHOICES = (
4747
disabled: false,
4848
},
4949
{
50-
title: 'React Native Test App by Microsoft',
50+
title: 'Test App by Microsoft',
5151
value: 'test-app',
5252
description: "app's native code is abstracted away",
5353
// The test app is disabled for now until proper

packages/create-react-native-library/templates/common/$.github/workflows/ci.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ jobs:
115115
build-ios:
116116
runs-on: macos-latest
117117
env:
118+
XCODE_VERSION: 16.2
118119
TURBO_CACHE_DIR: .turbo/ios
119120
steps:
120121
- name: Checkout
@@ -144,6 +145,12 @@ jobs:
144145
echo "turbo_cache_hit=1" >> $GITHUB_ENV
145146
fi
146147
148+
- name: Use appropriate Xcode version
149+
if: env.turbo_cache_hit != 1
150+
uses: maxim-lobanov/setup-xcode@v1
151+
with:
152+
xcode-version: ${{ env.XCODE_VERSION }}
153+
147154
- name: Restore cocoapods
148155
if: env.turbo_cache_hit != 1
149156
id: cocoapods-cache
@@ -158,10 +165,9 @@ jobs:
158165
- name: Install cocoapods
159166
if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
160167
run: |
161-
cd example/ios
162-
pod install
163-
env:
164-
NO_FLIPPER: 1
168+
cd example
169+
bundle install
170+
bundle exec pod install --project-directory=ios
165171
166172
- name: Cache cocoapods
167173
if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
@@ -171,12 +177,6 @@ jobs:
171177
**/ios/Pods
172178
key: ${{ steps.cocoapods-cache.outputs.cache-key }}
173179

174-
- name: Use appropriate Xcode version
175-
if: env.turbo_cache_hit != 1
176-
uses: maxim-lobanov/setup-xcode@v1
177-
with:
178-
xcode-version: '16.2'
179-
180180
- name: Build example for iOS
181181
run: |
182182
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"

packages/create-react-native-library/templates/common/$.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ android.iml
4646
example/ios/Pods
4747

4848
# Ruby
49-
/vendor/
49+
example/vendor/
5050

5151
# node.js
5252
#

packages/create-react-native-library/templates/common/$package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"name": "<%- project.slug -%>",
33
"version": "0.1.0",
44
"description": "<%- project.description %>",
5-
"source": "./src/index.tsx",
65
"main": "./lib/module/index.js",
76
"types": "./lib/typescript/src/index.d.ts",
87
"exports": {
98
".": {
9+
"source": "./src/index.tsx",
1010
"types": "./lib/typescript/src/index.d.ts",
1111
"default": "./lib/module/index.js"
1212
},

packages/create-react-native-library/templates/common/CONTRIBUTING.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,6 @@ To invoke **Nitrogen**, use the following command:
3535
yarn nitrogen
3636
```
3737

38-
<% } -%>
39-
<% if (project.native) { -%>
40-
You also need to install the required ruby gems for the iOS project with [bundler](https://bundler.io/). To install the gems, run the following command in the root directory:
41-
42-
```sh
43-
bundle install
44-
```
45-
46-
Now, you can install [CocoaPods](https://cocoapods.org/) for the iOS project. To do this, run the following command in the `example/ios` directory:
47-
48-
```sh
49-
bundle exec pod install
50-
```
51-
5238
<% } -%>
5339
The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make.
5440

packages/react-native-builder-bob/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"kleur": "^4.1.4",
6161
"metro-config": "^0.80.9",
6262
"prompts": "^2.4.2",
63-
"react-native-monorepo-config": "^0.1.7",
63+
"react-native-monorepo-config": "^0.1.8",
6464
"which": "^2.0.2",
6565
"yargs": "^17.5.1"
6666
},

packages/react-native-builder-bob/src/__tests__/__snapshots__/init.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ exports[`initializes the configuration 1`] = `
99
},
1010
"exports": {
1111
".": {
12+
"source": "./src/index.ts",
1213
"types": "./lib/typescript/src/index.d.ts",
1314
"default": "./lib/module/index.js"
1415
},
1516
"./package.json": "./package.json"
1617
},
17-
"source": "./src/index.ts",
1818
"main": "./lib/module/index.js",
1919
"types": "./lib/typescript/src/index.d.ts",
2020
"scripts": {

packages/react-native-builder-bob/src/init.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,13 +257,20 @@ export async function init() {
257257

258258
if (targets.includes('commonjs') && targets.includes('module')) {
259259
exportsField['.'] = {
260+
source: entries.source,
260261
import: importField,
261262
require: requireField,
262263
};
263264
} else if (targets.includes('commonjs')) {
264-
exportsField['.'] = requireField;
265+
exportsField['.'] = {
266+
source: entries.source,
267+
...requireField,
268+
};
265269
} else if (targets.includes('module')) {
266-
exportsField['.'] = importField;
270+
exportsField['.'] = {
271+
source: entries.source,
272+
...importField,
273+
};
267274
}
268275

269276
if (
@@ -288,10 +295,8 @@ export async function init() {
288295
}
289296

290297
const entryFields: {
291-
[key in 'source' | 'main' | 'module' | 'types']?: string;
292-
} = {
293-
source: entries.source,
294-
};
298+
[key in 'main' | 'module' | 'types']?: string;
299+
} = {};
295300

296301
if (targets.includes('commonjs') && targets.includes('module')) {
297302
entryFields.main = entries.commonjs;

yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12353,7 +12353,7 @@ __metadata:
1235312353
mock-fs: ^5.2.0
1235412354
mock-stdin: ^1.0.0
1235512355
prompts: ^2.4.2
12356-
react-native-monorepo-config: ^0.1.7
12356+
react-native-monorepo-config: ^0.1.8
1235712357
vitest: ^3.1.1
1235812358
which: ^2.0.2
1235912359
yargs: ^17.5.1
@@ -12362,13 +12362,13 @@ __metadata:
1236212362
languageName: unknown
1236312363
linkType: soft
1236412364

12365-
"react-native-monorepo-config@npm:^0.1.7":
12366-
version: 0.1.7
12367-
resolution: "react-native-monorepo-config@npm:0.1.7"
12365+
"react-native-monorepo-config@npm:^0.1.8":
12366+
version: 0.1.8
12367+
resolution: "react-native-monorepo-config@npm:0.1.8"
1236812368
dependencies:
1236912369
escape-string-regexp: ^5.0.0
1237012370
fast-glob: ^3.3.3
12371-
checksum: 828b8132c0121f23993b34a4a979971b80061ff8810ff1275fc26e76a264d44bad14d219990013a0f4b705ac8e64a270549fbd906bfd4217d468f6aa08ec7712
12371+
checksum: 3c9abfd2dcd7d4da0d5d8d59f1e997f68283a6dc04935c310fece2a6ab62045e2b19f976d27894243f1cba6d9b9f1c3771e9f1428cd7cb0f7e00ed9c1e7251a5
1237212372
languageName: node
1237312373
linkType: hard
1237412374

0 commit comments

Comments
 (0)