generated from t3-oss/create-t3-turbo
-
Notifications
You must be signed in to change notification settings - Fork 11
50 lines (45 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
diff --git a/scripts/react_native_pods_utils/script_phases.sh b/scripts/react_native_pods_utils/script_phases.sh
index 6c41ce1cbaa2b09d7b59b191b1edfb0c3fb41ea7..25bfcd11d6b88525d589c80ee08c9a8c8ba66d16 100755
--- a/scripts/react_native_pods_utils/script_phases.sh
+++ b/scripts/react_native_pods_utils/script_phases.sh
@@ -13,8 +13,6 @@ GENERATED_SCHEMA_FILE="$GENERATED_SRCS_DIR/schema.json"
cd "$RCT_SCRIPT_RN_DIR"
-CODEGEN_REPO_PATH="$RCT_SCRIPT_RN_DIR/packages/react-native-codegen"
-CODEGEN_NPM_PATH="$RCT_SCRIPT_RN_DIR/../react-native-codegen"
CODEGEN_CLI_PATH=""
error () {
@@ -23,14 +21,12 @@ error () {
exit 1
}
-# Determine path to react-native-codegen
-if [ -d "$CODEGEN_REPO_PATH" ]; then
- CODEGEN_CLI_PATH=$(cd "$CODEGEN_REPO_PATH" && pwd)
-elif [ -d "$CODEGEN_NPM_PATH" ]; then
- CODEGEN_CLI_PATH=$(cd "$CODEGEN_NPM_PATH" && pwd)
-else
- error "error: Could not determine react-native-codegen location in $CODEGEN_REPO_PATH or $CODEGEN_NPM_PATH. Try running 'yarn install' or 'npm install' in your project root."
-fi
+find_codegen () {
+ CODEGEN_CLI_PATH=$("$NODE_BINARY" --print "require('path').dirname(require.resolve('react-native-codegen/package.json'))")
+ if ! [ -d "$CODEGEN_CLI_PATH" ]; then
+ error "error: Could not determine react-native-codegen location, using node module resolution. Try running 'yarn install' or 'npm install' in your project root."
+ fi
+}
find_node () {
NODE_BINARY="${NODE_BINARY:-$(command -v node || true)}"
@@ -116,6 +112,7 @@ moveOutputs () {
withCodgenDiscovery () {
setup_dirs
find_node
+ find_codegen
generateArtifacts
moveOutputs
}
@@ -123,6 +120,7 @@ withCodgenDiscovery () {
noCodegenDiscovery () {
setup_dirs
find_node
+ find_codegen
generateCodegenSchemaFromJavaScript
generateCodegenArtifactsFromSchema
moveOutputs