|
60 | 60 | *) echo "unknown: $OSTYPE" ;;
|
61 | 61 | esac
|
62 | 62 |
|
63 |
| - #Find hermes(c) binary file path |
64 |
| - INSTALLED_RN_VERSION_MAJOR=$(node -p "require('./node_modules/react-native/package.json').version" | cut -d "." -f2) |
65 |
| - if [ "$INSTALLED_RN_VERSION_MAJOR" -ge 69 ] |
66 |
| - then |
67 |
| - HERMES_PATH=node_modules/react-native/sdks/hermesc/$HERMES_OS_BIN/hermesc |
68 |
| - elif [ "$INSTALLED_RN_VERSION_MAJOR" -lt 63 ] |
69 |
| - then |
70 |
| - HERMES_PATH=node_modules/hermes-engine/$HERMES_OS_BIN/hermes |
| 63 | + # Find hermes(c) binary file path |
| 64 | + RN_VERSION=$(node -p "require('react-native/package.json').version") |
| 65 | + RN_VERSION_MINOR=$(echo $RN_VERSION | cut -d "." -f2) |
| 66 | + echo "Instabug: Using React Native v$RN_VERSION" |
| 67 | + |
| 68 | + if [ "$RN_VERSION_MINOR" -ge 69 ]; then |
| 69 | + RN_PACKAGE_PATH=$(node -p "require.resolve('react-native/package.json')") |
| 70 | + RN_PATH=${RN_PACKAGE_PATH%"/package.json"} |
| 71 | + HERMES_PATH=$RN_PATH/sdks/hermesc/$HERMES_OS_BIN/hermesc |
71 | 72 | else
|
72 |
| - HERMES_PATH=node_modules/hermes-engine/$HERMES_OS_BIN/hermesc |
| 73 | + HERMES_ENGINE_PACKAGE_PATH=$(node -p "require.resolve('hermes-engine/package.json')") |
| 74 | + HERMES_ENGINE_PATH=${HERMES_ENGINE_PACKAGE_PATH%"/package.json"} |
| 75 | + if [ "$RN_VERSION_MINOR" -lt 63 ]; then |
| 76 | + HERMES_PATH=$HERMES_ENGINE_PATH/$HERMES_OS_BIN/hermes |
| 77 | + else |
| 78 | + HERMES_PATH=$HERMES_ENGINE_PATH/$HERMES_OS_BIN/hermesc |
| 79 | + fi |
73 | 80 | fi
|
74 |
| - if [ "$INSTALLED_RN_VERSION_MAJOR" -ge 65 ] |
| 81 | + |
| 82 | + if [ "$RN_VERSION_MINOR" -ge 65 ] |
75 | 83 | then
|
76 | 84 | EXTRA_ARGS="--minify false"
|
77 | 85 | fi
|
|
84 | 92 | --sourcemap-output index.android.bundle.packager.map \
|
85 | 93 | $EXTRA_ARGS
|
86 | 94 |
|
| 95 | + echo "Instabug: Using Hermes from: $HERMES_PATH" |
87 | 96 | $HERMES_PATH -emit-binary -out index.android.bundle.hbc index.android.bundle -O -output-source-map > /dev/null 2>&1
|
88 | 97 |
|
89 | 98 | cp index.android.bundle.hbc.map index.android.bundle.compiler.map
|
90 | 99 |
|
91 |
| - node node_modules/react-native/scripts/compose-source-maps.js index.android.bundle.packager.map index.android.bundle.compiler.map -o android-sourcemap.json |
| 100 | + COMPOSE_SCRIPT_PATH=$(node -p "require.resolve('react-native/scripts/compose-source-maps.js')") |
| 101 | + node $COMPOSE_SCRIPT_PATH index.android.bundle.packager.map index.android.bundle.compiler.map -o android-sourcemap.json |
92 | 102 | rm -rf index.android.bundle
|
93 | 103 | rm -rf index.android.bundle.hbc.map
|
94 | 104 | rm -rf index.android.bundle.compiler.map
|
|
0 commit comments