Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: upgrade to Expo SDK 50 #107

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
steps:
- name: 🏗 Setup repository
uses: actions/checkout@v3
with:
# Checkout branch instead of automatic merge commit
ref: ${{ github.event.pull_request.head.ref }}

- name: 🏗 Setup monorepo
uses: ./.github/actions/setup-monorepo
Expand Down
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

54 changes: 36 additions & 18 deletions apps/mobile/metro.config.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,44 @@
// Learn more https://docs.expo.dev/guides/monorepos
// Learn more https://docs.expo.dev/guides/customizing-metro/
const { getDefaultConfig } = require('expo/metro-config');
const { FileStore } = require('metro-cache');
const path = require('path');

const projectRoot = __dirname;
const workspaceRoot = path.resolve(projectRoot, '../..');
module.exports = withTurborepoManagedCache(withMonorepoPaths(getDefaultConfig(__dirname)));

const config = getDefaultConfig(projectRoot);
/**
* Add the monorepo paths to the Metro config.
* This allows Metro to resolve modules from the monorepo.
*
* @see https://docs.expo.dev/guides/monorepos/#modify-the-metro-config
* @param {import('expo/metro-config').MetroConfig} config
* @returns {import('expo/metro-config').MetroConfig}
*/
function withMonorepoPaths(config) {
const projectRoot = __dirname;
const workspaceRoot = path.resolve(projectRoot, '../..');

// #1 - Watch all files in the monorepo
config.watchFolders = [workspaceRoot];
// #3 - Force resolving nested modules to the folders below
config.resolver.disableHierarchicalLookup = true;
// #2 - Try resolving with project modules first, then workspace modules
config.resolver.nodeModulesPaths = [
path.resolve(projectRoot, 'node_modules'),
path.resolve(workspaceRoot, 'node_modules'),
];
// #1 - Watch all files in the monorepo
config.watchFolders = [workspaceRoot];

// Use turborepo to restore the cache when possible
config.cacheStores = [
new FileStore({ root: path.join(projectRoot, 'node_modules', '.cache', 'metro') }),
];
// #2 - Resolve modules within the project's `node_modules` first, then all monorepo modules
config.resolver.nodeModulesPaths = [
path.resolve(projectRoot, 'node_modules'),
path.resolve(workspaceRoot, 'node_modules'),
];

module.exports = config;
return config;
}

/**
* Move the Metro cache to the `node_modules/.cache/metro` folder.
* This repository configured Turborepo to use this cache location as well.
* If you have any environment variables, you can configure Turborepo to invalidate it when needed.
*
* @see https://turbo.build/repo/docs/reference/configuration#env
* @param {import('expo/metro-config').MetroConfig} config
* @returns {import('expo/metro-config').MetroConfig}
*/
function withTurborepoManagedCache(config) {
config.cacheStores = [new FileStore({ root: path.join(__dirname, 'node_modules/.cache/metro') })];
return config;
}
17 changes: 8 additions & 9 deletions apps/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,27 @@
"lint": "eslint --ext js,ts,tsx .",
"build": "expo export --output-dir ./build --platform all",
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"eas-build-post-install": "pnpm run -w build:mobile"
},
"dependencies": {
"@acme/feature-home": "*",
"expo": "^49.0.10",
"expo-dev-client": "~2.4.8",
"expo-status-bar": "~1.6.0",
"expo-updates": "~0.18.10",
"expo": "50.0.0-preview.6",
"expo-status-bar": "1.11.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.72.4",
"react-native": "0.73.1",
"react-native-web": "~0.19.6"
},
"devDependencies": {
"@acme/eslint-config": "*",
"@babel/core": "^7.19.3",
"@types/react": "~18.2.43",
"@babel/runtime": "^7.23.5",
"@types/react": "~18.2.45",
"@types/react-dom": "~18.0.11",
"babel-preset-expo": "~9.5.0"
"babel-preset-expo": "~10.0.0"
},
"eslintConfig": {
"extends": "@acme/eslint-config",
Expand Down
8 changes: 3 additions & 5 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
"lint": "eslint --ext js,ts,tsx ."
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^5.42.1",
"@typescript-eslint/parser": "^5.42.1",
"eslint": "^8.34.0",
"eslint-config-universe": "^11.2.0",
"prettier": "^2.7.1"
"eslint": "^8.55.0",
"eslint-config-universe": "^12.0.0",
"prettier": "^3.1.0"
},
"eslintConfig": {
"extends": "."
Expand Down
9 changes: 5 additions & 4 deletions packages/feature-home/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
"@tsconfig/recommended": "^1.0.1",
"@types/jest": "^29.5.11",
"@types/react": "~18.2.43",
"babel-preset-expo": "~9.5.0",
"babel-preset-expo": "~10.0.0",
"jest": "^29.7.0",
"jest-expo": "^49.0.0",
"jest-expo": "~50.0.1",
"react": "18.2.0",
"react-native": "0.72.1",
"react-native": "0.73.1",
"react-test-renderer": "18.2.0",
"tsup": "^6.5.0"
},
Expand All @@ -56,7 +56,8 @@
]
},
"jest": {
"preset": "jest-expo"
"preset": "jest-expo",
"transformIgnorePatterns": []
},
"tsup": {
"entry": [
Expand Down
9 changes: 5 additions & 4 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
"@tsconfig/recommended": "^1.0.1",
"@types/jest": "^29.5.11",
"@types/react": "~18.2.43",
"babel-preset-expo": "~9.5.0",
"babel-preset-expo": "~10.0.0",
"jest": "^29.7.0",
"jest-expo": "^49.0.0",
"jest-expo": "~50.0.1",
"react": "18.2.0",
"react-native": "0.72.1",
"react-native": "0.73.1",
"react-test-renderer": "18.2.0",
"tsup": "^6.5.0"
},
Expand All @@ -53,7 +53,8 @@
]
},
"jest": {
"preset": "jest-expo"
"preset": "jest-expo",
"transformIgnorePatterns": []
},
"tsup": {
"entry": [
Expand Down
Loading
Loading