Skip to content

Commit

Permalink
ensure iOS config plugin is idempotent
Browse files Browse the repository at this point in the history
  • Loading branch information
yousif-bugsnag committed Oct 25, 2023
1 parent 926148e commit 6ec937a
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions packages/plugin-expo-eas-sourcemaps/src/ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,24 @@ function withIosPlugin (config, onPremConfig) {

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
if (!initialScript.indexOf(additionalExports) < 0) {
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 uploadBuildPhaseComment = 'Upload source maps to Bugsnag'

xcodeProject.addBuildPhase([], buildPhaseName, 'Upload source maps to Bugsnag', null, {
shellPath: '/bin/sh',
shellScript: shellScript
})
const uploadBuildPhase = xcodeProject.pbxItemByComment(uploadBuildPhaseComment, buildPhaseName)

Check failure on line 38 in packages/plugin-expo-eas-sourcemaps/src/ios.js

View workflow job for this annotation

GitHub Actions / test (14)

Trailing spaces not allowed

Check failure on line 38 in packages/plugin-expo-eas-sourcemaps/src/ios.js

View workflow job for this annotation

GitHub Actions / test (14)

Trailing spaces not allowed
if( !uploadBuildPhase ) {

Check failure on line 39 in packages/plugin-expo-eas-sourcemaps/src/ios.js

View workflow job for this annotation

GitHub Actions / test (14)

Expected space(s) after "if"

Check failure on line 39 in packages/plugin-expo-eas-sourcemaps/src/ios.js

View workflow job for this annotation

GitHub Actions / test (14)

There should be no space after this paren

Check failure on line 39 in packages/plugin-expo-eas-sourcemaps/src/ios.js

View workflow job for this annotation

GitHub Actions / test (14)

There should be no space before this paren

Check failure on line 39 in packages/plugin-expo-eas-sourcemaps/src/ios.js

View workflow job for this annotation

GitHub Actions / test (14)

Expected space(s) after "if"

Check failure on line 39 in packages/plugin-expo-eas-sourcemaps/src/ios.js

View workflow job for this annotation

GitHub Actions / test (14)

There should be no space after this paren

Check failure on line 39 in packages/plugin-expo-eas-sourcemaps/src/ios.js

View workflow job for this annotation

GitHub Actions / test (14)

There should be no space before this paren
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'

xcodeProject.addBuildPhase([], buildPhaseName, uploadBuildPhaseComment, null, {
shellPath: '/bin/sh',
shellScript: shellScript
})
}

return config
})
Expand Down

0 comments on commit 6ec937a

Please sign in to comment.