-
Notifications
You must be signed in to change notification settings - Fork 905
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: str.replace not a function issue
- Loading branch information
Showing
2 changed files
with
12 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
import {CLIError} from '@react-native-community/cli-tools'; | ||
import execa from 'execa'; | ||
import {IosProjectInfo} from '../types'; | ||
|
||
export function getProjectInfo(): IosProjectInfo { | ||
try { | ||
const {project} = JSON.parse( | ||
execa.sync('xcodebuild', ['-list', '-json']).stdout, | ||
); | ||
|
||
const out = execa.sync('xcodebuild', ['-list', '-json']).stdout; | ||
const {project} = JSON.parse(out); | ||
return project; | ||
} catch (error) { | ||
throw new CLIError(error as any); | ||
if ( | ||
(error as Error)?.message && | ||
(error as Error).message.includes('xcodebuild: error:') | ||
) { | ||
const match = (error as Error).message.match(/xcodebuild: error: (.*)/); | ||
const err = match ? match[0] : error; | ||
throw new Error(err as any); | ||
} | ||
throw new Error(error as any); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters