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

Support monorepo #147

Open
wants to merge 1 commit into
base: v49/next
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
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,11 @@ if [ ! -z "$ENDPOINT" ]; then
ARGS+=("$ENDPOINT")
fi

../node_modules/.bin/bugsnag-source-maps upload-react-native "${ARGS[@]}"
# Make sure that node binary exists
source `$NODE_BINARY --print "require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/node-binary.sh'"`

# Retrieve the expo node binary
BUGSNAG_EXPO_NODE_BINARY=$($NODE_BINARY --print "require('path').dirname(require.resolve('@bugsnag/source-maps/package.json'))")

# Start upload the source maps to bugsnag
$BUGSNAG_EXPO_NODE_BINARY upload-react-native "${ARGS[@]}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if [[ -f "$PODS_ROOT/../.xcode.env" ]]; then
source "$PODS_ROOT/../.xcode.env"
fi
if [[ -f "$PODS_ROOT/../.xcode.env.local" ]]; then
source "$PODS_ROOT/../.xcode.env.local"
fi

SOURCE_MAP="$TMPDIR/$(md5 -qs "$CONFIGURATION_BUILD_DIR")-main.jsbundle.map" `$NODE_BINARY --print "require('path').dirname(require.resolve('@bugsnag/plugin-expo-eas-sourcemaps/package.json')) + '/lib/bugsnag-expo-xcode.sh'"`
16 changes: 3 additions & 13 deletions packages/plugin-expo-eas-sourcemaps/src/ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const {
withInfoPlist,
withXcodeProject
} = require('@expo/config-plugins')
const { readFileSync } = require('fs');
const { dirname, join } = require('path');

const buildPhaseName = 'PBXShellScriptBuildPhase'
const buildPhaseComment = 'Bundle React Native code and images'
Expand All @@ -19,19 +21,7 @@ function withIosPlugin (config, onPremConfig) {
config = withXcodeProject(config, config => {
const xcodeProject = config.modResults

// 02. Update react native bundle phase with sourcemap filepath
const bundleReactNativePhase = xcodeProject.pbxItemByComment(buildPhaseComment, buildPhaseName)

const initialScript = bundleReactNativePhase.shellScript

const additionalExports = '"export EXTRA_PACKAGER_ARGS=\\"--sourcemap-output $TMPDIR/$(md5 -qs \\"$CONFIGURATION_BUILD_DIR\\")-main.jsbundle.map\\"\\n'

const modifiedScript = additionalExports + initialScript.substr(1)

bundleReactNativePhase.shellScript = modifiedScript

// 03. Configure the new build phase
const shellScript = 'SOURCE_MAP="$TMPDIR/$(md5 -qs "$CONFIGURATION_BUILD_DIR")-main.jsbundle.map" ../node_modules/@bugsnag/plugin-expo-eas-sourcemaps/lib/bugsnag-expo-xcode.sh'
const shellScript = readFileSync(join(__dirname, '../lib/bugsnag-xcode-build-phase'), 'utf8')

xcodeProject.addBuildPhase([], buildPhaseName, 'Upload source maps to Bugsnag', null, {
shellPath: '/bin/sh',
Expand Down