Files
orca/mobile/plugins/ios-bundle-phase-quoted-script-path.js
T
Kelvin Amoaba 77db0c2000 fix(mobile): build iOS from checkout paths with spaces (#37058)
* fix(mobile): quote expo-constants iOS build paths so checkouts with spaces build

Backports the expo-constants 58 quoting of the app.config build phase
(podspec bash -l -c argument and basename $PROJECT_DIR) to 55.0.17.

* fix(mobile): quote react-native-xcode.sh call in the iOS bundle phase

Expo SDK 55's template leaves the command substitution unquoted, so the
Bundle React Native code and images phase splits a checkout path with a
space. Expo's SDK 58 template applies the same quoting.
2026-11-01 15:43:35 +00:00

25 lines
1.1 KiB
JavaScript

const { withXcodeProject } = require('expo/config-plugins')
// Why: Expo SDK 55's template runs react-native-xcode.sh through an unquoted command substitution,
// so a checkout path with a space splits and "Bundle React Native code and images" fails. Expo's
// SDK 58 template quotes it the same way; drop this plugin then.
const BUNDLE_PHASE_NAME = '"Bundle React Native code and images"'
// The pbxproj keeps shellScript escaped, so quotes appear as \" and newlines as \n.
const SCRIPT_CALL =
"`\\\"$NODE_BINARY\\\" --print \\\"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\\\"`"
module.exports = function withIosBundlePhaseQuotedScriptPath(config) {
return withXcodeProject(config, (cfg) => {
const phases = cfg.modResults.hash.project.objects.PBXShellScriptBuildPhase ?? {}
for (const phase of Object.values(phases)) {
if (typeof phase === 'object' && phase.name === BUNDLE_PHASE_NAME) {
phase.shellScript = phase.shellScript.replace(
`\\n${SCRIPT_CALL}\\n`,
`\\n\\"${SCRIPT_CALL}\\"\\n`
)
}
}
return cfg
})
}