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

Function initExampleApp

packages/create-expo-module/src/createExampleApp.ts:116–135  ·  view source on GitHub ↗

* Initializes the example app from `expo-template-blank-typescript` at the given dist-tag.

(
  packageManager: PackageManagerName,
  exampleProjectSlug: string,
  targetDir: string,
  distTag: string
)

Source from the content-addressed store, hash-verified

114 * Initializes the example app from `expo-template-blank-typescript` at the given dist-tag.
115 */
116async function initExampleApp(
117 packageManager: PackageManagerName,
118 exampleProjectSlug: string,
119 targetDir: string,
120 distTag: string
121): Promise<void> {
122 const template = `expo-template-blank-typescript@${distTag}`;
123 debug(`Using example template: ${template}`);
124 const command = createCommand(packageManager, exampleProjectSlug, template);
125
126 try {
127 await spawnAsync(packageManager, command, {
128 cwd: targetDir,
129 });
130 } catch (error: any) {
131 throw new Error(
132 `${command.join(' ')} failed with exit code: ${error?.status}.\n\nError stack:\n${error?.stderr}`
133 );
134 }
135}
136
137function createCommand(
138 packageManager: PackageManagerName,

Callers 1

createExampleAppFunction · 0.85

Calls 4

spawnAsyncFunction · 0.85
joinMethod · 0.80
createCommandFunction · 0.70
debugFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…