Skip to content

Commit 8d12a6b

Browse files
authored
Update to expo 53 (#115)
* Update to expo 53 * Update actions * Use corepack * Update deps and fix tests
1 parent 8969d4b commit 8d12a6b

18 files changed

+13811
-16655
lines changed

.github/workflows/actions.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,25 @@ jobs:
1010
lint:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
14-
- uses: actions/setup-node@v2
13+
- uses: actions/checkout@v4
14+
- name: Enable Corepack
15+
run: corepack enable
16+
- uses: actions/setup-node@v4
1517
with:
1618
node-version: '20'
17-
- run: yarn bootstrap --frozen-lockfile
19+
- run: yarn install --frozen-lockfile
20+
- run: yarn prepare
1821
- run: yarn lint
1922
- run: yarn typescript
2023
- run: yarn prettier
2124
unit-test:
2225
runs-on: ubuntu-latest
2326
steps:
24-
- uses: actions/checkout@v2
25-
- uses: actions/setup-node@v2
27+
- uses: actions/checkout@v4
28+
- name: Enable Corepack
29+
run: corepack enable
30+
- uses: actions/setup-node@v4
2631
with:
2732
node-version: '20'
28-
- run: yarn bootstrap --frozen-lockfile
33+
- run: yarn install --frozen-lockfile
2934
- run: yarn test --coverage

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,11 @@ android/keystores/debug.keystore
5959

6060
# generated by bob
6161
lib/
62+
63+
# Yarn
64+
.yarn/*
65+
!.yarn/patches
66+
!.yarn/plugins
67+
!.yarn/releases
68+
!.yarn/sdks
69+
!.yarn/versions

.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+
nmHoistingLimits: workspaces
3+
enableTelemetry: false

babel.config.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
module.exports = {
2-
presets: ['module:metro-react-native-babel-preset'],
3-
plugins: [['@babel/plugin-proposal-private-methods', { loose: true }]],
2+
overrides: [
3+
{
4+
exclude: /\/node_modules\//,
5+
presets: ['module:react-native-builder-bob/babel-preset'],
6+
},
7+
{
8+
include: /\/node_modules\//,
9+
presets: ['module:@react-native/babel-preset'],
10+
},
11+
],
412
};

eslint.config.mjs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { fixupConfigRules } from '@eslint/compat';
2+
import { FlatCompat } from '@eslint/eslintrc';
3+
import js from '@eslint/js';
4+
import prettier from 'eslint-plugin-prettier';
5+
import { defineConfig } from 'eslint/config';
6+
import path from 'node:path';
7+
import { fileURLToPath } from 'node:url';
8+
9+
const __filename = fileURLToPath(import.meta.url);
10+
const __dirname = path.dirname(__filename);
11+
const compat = new FlatCompat({
12+
baseDirectory: __dirname,
13+
recommendedConfig: js.configs.recommended,
14+
allConfig: js.configs.all,
15+
});
16+
17+
export default defineConfig([
18+
{
19+
extends: fixupConfigRules(compat.extends('@react-native', 'prettier')),
20+
plugins: { prettier },
21+
rules: {
22+
'react/react-in-jsx-scope': 'off',
23+
'prettier/prettier': [
24+
'error',
25+
{
26+
quoteProps: 'consistent',
27+
singleQuote: true,
28+
tabWidth: 2,
29+
trailingComma: 'es5',
30+
useTabs: false,
31+
},
32+
],
33+
},
34+
},
35+
{
36+
ignores: ['node_modules/', 'lib/', 'coverage/'],
37+
},
38+
]);

example/babel.config.js

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
const path = require('path');
2-
const pak = require('../package.json');
2+
const { getConfig } = require('react-native-builder-bob/babel-config');
3+
const pkg = require('../package.json');
4+
5+
const root = path.resolve(__dirname, '..');
36

47
module.exports = function (api) {
58
api.cache(true);
69

7-
return {
8-
presets: ['babel-preset-expo'],
9-
plugins: [
10-
[
11-
'module-resolver',
12-
{
13-
alias: {
14-
// For development, we want to alias the library to the source
15-
[pak.name]: path.join(__dirname, '..', pak.source),
16-
},
17-
},
18-
],
19-
],
20-
};
10+
return getConfig(
11+
{
12+
presets: ['babel-preset-expo'],
13+
},
14+
{ root, pkg }
15+
);
2116
};

example/metro.config.js

Lines changed: 12 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,16 @@
1-
/**
2-
* Metro configuration for React Native
3-
* https://github.com/facebook/react-native
4-
*
5-
* @format
6-
*/
71
const path = require('path');
8-
const exclusionList = require('metro-config/src/defaults/exclusionList');
9-
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
10-
const escape = require('escape-string-regexp');
11-
const pak = require('../package.json');
12-
const root = path.resolve(__dirname, '..');
2+
const { getDefaultConfig } = require('@expo/metro-config');
3+
const { getConfig } = require('react-native-builder-bob/metro-config');
134

14-
const defaultConfig = getDefaultConfig(__dirname);
15-
const {
16-
resolver: { sourceExts, assetExts },
17-
} = getDefaultConfig(__dirname);
5+
const root = path.resolve(__dirname, '..');
186

19-
const modules = Object.keys({
20-
...pak.peerDependencies,
7+
/**
8+
* Metro configuration
9+
* https://facebook.github.io/metro/docs/configuration
10+
*
11+
* @type {import('metro-config').MetroConfig}
12+
*/
13+
module.exports = getConfig(getDefaultConfig(__dirname), {
14+
root,
15+
project: __dirname,
2116
});
22-
23-
const config = {
24-
projectRoot: __dirname,
25-
watchFolders: [root],
26-
// We need to make sure that only one version is loaded for peerDependencies
27-
// So we exclude them at the root, and alias them to the versions in example's node_modules
28-
resolver: {
29-
blacklistRE: exclusionList(
30-
modules.map(
31-
(m) =>
32-
new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`)
33-
)
34-
),
35-
extraNodeModules: modules.reduce((acc, name) => {
36-
acc[name] = path.join(__dirname, 'node_modules', name);
37-
return acc;
38-
}, {}),
39-
assetExts,
40-
sourceExts: [...sourceExts, 'cjs'],
41-
},
42-
transformer: {
43-
getTransformOptions: async () => ({
44-
transform: {
45-
experimentalImportSupport: false,
46-
inlineRequires: true,
47-
},
48-
}),
49-
},
50-
};
51-
52-
module.exports = mergeConfig(defaultConfig, config);

example/package.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,17 @@
1212
"test": "jest"
1313
},
1414
"dependencies": {
15-
"@apollo/client": "^3.8.8",
16-
"expo": "~51.0.38",
17-
"graphql": "^16.6.0",
18-
"react": "~18.2.0",
19-
"react-native": "0.74.5"
15+
"@apollo/client": "^3.13.8",
16+
"expo": "~53.0.9",
17+
"graphql": "^16.11.0",
18+
"react": "~19.0.0",
19+
"react-native": "0.79.2"
2020
},
2121
"devDependencies": {
22-
"@babel/core": "^7.25.8",
23-
"@babel/runtime": "^7.25.7",
24-
"@react-native/metro-config": "^0.75.4",
25-
"babel-plugin-module-resolver": "^5.0.2",
26-
"babel-preset-expo": "^11.0.15"
22+
"@babel/core": "^7.27.1",
23+
"@babel/runtime": "^7.27.1",
24+
"@react-native/metro-config": "^0.79.2",
25+
"react-native-builder-bob": "^0.40.10"
2726
},
2827
"resolutions": {
2928
"semver": "^7.5.4"

0 commit comments

Comments
 (0)