@@ -44,6 +44,14 @@ const {logger, CLIError, getDefaultUserTerminal} = (() => {
44
44
return require ( tools ) ;
45
45
} ) ( ) ;
46
46
47
+ /**
48
+ * @param {string } sourceDir
49
+ * @param {XcodeProject } xcodeProject
50
+ */
51
+ function getXcodeProjectPath ( sourceDir , xcodeProject ) {
52
+ return path . join ( sourceDir , xcodeProject . path || '.' , xcodeProject . name ) ;
53
+ }
54
+
47
55
/**
48
56
* @param {ProjectConfig } ctx
49
57
* @param {Options } args
@@ -117,7 +125,7 @@ function runMacOS(_, ctx, args) {
117
125
async function run ( sourceDir , xcodeProject , scheme , args ) {
118
126
await buildProject ( sourceDir , xcodeProject , scheme , args ) ;
119
127
120
- const buildSettings = getBuildSettings ( xcodeProject , args . mode , scheme ) ;
128
+ const buildSettings = getBuildSettings ( sourceDir , xcodeProject , args . mode , scheme ) ;
121
129
const appPath = path . join (
122
130
buildSettings . TARGET_BUILD_DIR ,
123
131
buildSettings . FULL_PRODUCT_NAME ,
@@ -162,7 +170,7 @@ function buildProject(sourceDir, xcodeProject, scheme, args) {
162
170
return new Promise ( ( resolve , reject ) => {
163
171
const xcodebuildArgs = [
164
172
xcodeProject . isWorkspace ? '-workspace' : '-project' ,
165
- path . join ( sourceDir , xcodeProject . path || '.' , xcodeProject . name ) ,
173
+ getXcodeProjectPath ( sourceDir , xcodeProject ) ,
166
174
'-configuration' ,
167
175
args . mode ,
168
176
'-scheme' ,
@@ -231,18 +239,19 @@ function buildProject(sourceDir, xcodeProject, scheme, args) {
231
239
}
232
240
233
241
/**
242
+ * @param {string } sourceDir
234
243
* @param {XcodeProject } xcodeProject
235
244
* @param {string } configuration
236
245
* @param {string } scheme
237
246
* @returns {{ FULL_PRODUCT_NAME: string, INFOPLIST_PATH: string, TARGET_BUILD_DIR: string } }
238
247
*/
239
- function getBuildSettings ( xcodeProject , configuration , scheme ) {
248
+ function getBuildSettings ( sourceDir , xcodeProject , configuration , scheme ) {
240
249
const settings = JSON . parse (
241
250
child_process . execFileSync (
242
251
'xcodebuild' ,
243
252
[
244
253
xcodeProject . isWorkspace ? '-workspace' : '-project' ,
245
- xcodeProject . name ,
254
+ getXcodeProjectPath ( sourceDir , xcodeProject ) ,
246
255
'-scheme' ,
247
256
scheme ,
248
257
'-sdk' ,
@@ -363,7 +372,7 @@ module.exports = [
363
372
{
364
373
name : '--port [number]' ,
365
374
default : process . env . RCT_METRO_PORT || 8081 ,
366
- parse : val => Number ( val ) ,
375
+ parse : ( /** @type { string } */ val ) => Number ( val ) ,
367
376
} ,
368
377
{
369
378
name : '--terminal [string]' ,
0 commit comments