MCPcopy Create free account
hub / github.com/expo/expo / generateXcodeProjectAsync

Function generateXcodeProjectAsync

tools/src/prebuilds/XcodeGen.ts:31–49  ·  view source on GitHub ↗
(dir: string, spec: ProjectSpec)

Source from the content-addressed store, hash-verified

29 * Generates `.xcodeproj` from given project spec and saves it at given dir.
30 */
31export async function generateXcodeProjectAsync(dir: string, spec: ProjectSpec): Promise<string> {
32 const specPath = path.join(dir, `${spec.name}.spec.json`);
33
34 // Save the spec to the file so `xcodegen` can use it.
35 await fs.outputJSON(specPath, spec, {
36 spaces: 2,
37 });
38
39 // Generate `.xcodeproj` from given spec. The binary is provided by `@expo/xcodegen` package.
40 await spawnAsync('pnpm', ['--silent', 'run', 'xcodegen', '--quiet', '--spec', specPath], {
41 cwd: EXPOTOOLS_DIR,
42 stdio: 'inherit',
43 });
44
45 // Remove temporary spec file.
46 await fs.remove(specPath);
47
48 return path.join(dir, `${spec.name}.xcodeproj`);
49}
50
51/**
52 * Creates `xcodegen` spec from the podspec. It's very naive, but covers all our cases so far.

Calls 3

spawnAsyncFunction · 0.90
joinMethod · 0.80
removeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…