Skip to content

Update project dependencies #222

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

Open
wants to merge 4 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
4 changes: 2 additions & 2 deletions examples/turbo-demo-expo-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"dev:ios": "yarn ios",
"dev:android": "yarn android",
"clean": "rm -rf node_modules ios android && yarn cache clean && yarn && watchman watch-del-all && rm -fr $TMPDIR/haste-map-* && rm -rf $TMPDIR/metro-cache",
"ts:check": "tsc",
"lint:check": "eslint ."
"typescript": "tsc",
"lint": "eslint \"src/**/*.{ts,tsx}\" *.js"
},
"dependencies": {
"@react-navigation/bottom-tabs": "^7.3.3",
Expand Down
10 changes: 6 additions & 4 deletions examples/turbo-demo-expo-example/src/useSessionHandle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ import {
useNavigation,
} from '@react-navigation/native';

function unpackState(state: NavigationState | PartialState<NavigationState>) {
function unpackState(
state: NavigationState | PartialState<NavigationState> | undefined
) {
const nestedState = state?.routes[0]?.state;
if (nestedState) {
return unpackState(nestedState);
} else {
return state;
}

return state;
}

export function useSessionHandle() {
const navigation = useNavigation();
const state = unpackState(navigation.getState());
if (!state.routeNames || (!state.index && state.index !== 0)) {
if (!state?.routeNames || (!state.index && state.index !== 0)) {
return 'Default';
}
return state.routeNames[state.index];
Expand Down
4 changes: 3 additions & 1 deletion examples/turbo-demo-expo-example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"compilerOptions": {},
"compilerOptions": {
"strict": true
},
"extends": "expo/tsconfig.base"
}
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,20 @@
"@release-it/bumper": "^6.0.1",
"@types/jest": "^29.5.12",
"@types/react": "^18.2.65",
"@types/react-native": "^0.73.0",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-turbo": "^1.12.4",
"eslint-config-turbo": "^2.5.0",
"eslint-config-universe": "^12.0.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-import-resolver-typescript": "^4.3.2",
"eslint-plugin-only-error": "^1.0.2",
"eslint-plugin-prettier": "^5.1.3",
"husky": "^9.0.11",
"prettier": "^3.2.5",
"react-native-builder-bob": "^0.23.2",
"release-it": "^17.1.1",
"turbo": "^1.13.3",
"turbo": "^2.5.0",
"typescript": "^5.3.3"
},
"engines": {
Expand Down
11 changes: 11 additions & 0 deletions packages/navigation/turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://turbo.build/schema.json",
"extends": ["//"],
"tasks": {
"build": {
"outputs": [
"lib/**"
]
}
}
}
4 changes: 2 additions & 2 deletions packages/turbo/scripts/build-hotwire-native-ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ cd hotwire-native-ios
git apply $PATCH_FILE

# Keep the Source folder and remove the rest
for file in *; do
if [ "$file" != "Source" ]; then
for file in * .*; do
if [ "$file" != "Source" ] && [ "$file" != "." ] && [ "$file" != ".." ]; then
rm -rf $file
fi
done
18 changes: 13 additions & 5 deletions packages/turbo/scripts/postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,23 @@ if [ ! -d "./android/vendor" ]; then
exit 0
fi

VENDOR_DIR=$(realpath ./android/vendor)
CURRENT_DIR=$(realpath .)
MONOREPO_SUFFIX="examples/turbo-demo-expo-example/node_modules/react-native-turbo"
SKIP_RSYNC=0
PARENT_FOLDER=$(realpath .. | awk -F/ '{print $NF}')

if [ "$PARENT_FOLDER" = "node_modules" ]; then
# Skip postinstall for `yarn install` called from inside `turbo-demo-expo-example`
if [[ "$CURRENT_DIR" == *"$MONOREPO_SUFFIX" ]]; then
SKIP_RSYNC=1
elif [ "$PARENT_FOLDER" == "node_modules" ]; then
REACT_NATIVE_DIR=$(realpath ../react-native/android)
else
# We are in the monorepo
# We are in the monorepo in `packages/turbo`
REACT_NATIVE_DIR=$(realpath ../../node_modules/react-native/android)
fi

# Copying the vendor files to the react-native android folder is necessary to run the app with react-native run-android command.
rsync -av $VENDOR_DIR/ $REACT_NATIVE_DIR
if [ $SKIP_RSYNC -eq 0 ]; then
VENDOR_DIR=$(realpath ./android/vendor)
# Copying the vendor files to the react-native android folder is necessary to run the app with react-native run-android command.
rsync -av $VENDOR_DIR/ $REACT_NATIVE_DIR
fi
15 changes: 15 additions & 0 deletions packages/turbo/turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://turbo.build/schema.json",
"extends": ["//"],
"tasks": {
"build": {
"outputs": [
"android/build",
"android/vendor",
"android/turbo-android-dependencies.gradle",
"ios/vendor",
"lib"
]
}
}
}
40 changes: 30 additions & 10 deletions turbo.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,38 @@
{
"$schema": "https://turbo.build/schema.json",
"globalDependencies": ["**/.env.*local"],
"pipeline": {
"globalDependencies": [
"**/.env.*local"
],
"globalEnv": ["ANDROID_HOME"],
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": [".next/**", "!.next/cache/**"]
"dependsOn": [
"^build"
],
"outputs": [
".next/**",
"!.next/cache/**"
]
},
"lint": {
"dependsOn": ["^lint"]
"dependsOn": [
"^lint"
]
},
"prepare": {
"dependsOn": ["^prepare"]
"dependsOn": [
"^prepare"
]
},
"postinstall": {
"dependsOn": ["^postinstall"]
"dependsOn": [
"^postinstall"
]
},
"typescript": {
"dependsOn": ["^typescript"]
"dependsOn": [
"^typescript"
]
},
"clean": {
"cache": false,
Expand All @@ -27,10 +43,14 @@
"persistent": true
},
"dev:ios": {
"dependsOn": ["^dev"]
"dependsOn": [
"^dev"
]
},
"dev:android": {
"dependsOn": ["^dev"]
"dependsOn": [
"^dev"
]
}
}
}
Loading