-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[eas-cli] fix expo-updates fingerprinting during update
- Loading branch information
Showing
4 changed files
with
133 additions
and
43 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
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
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
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import spawnAsync from '@expo/spawn-async'; | ||
import chalk from 'chalk'; | ||
import resolveFrom, { silent as silentResolveFrom } from 'resolve-from'; | ||
|
||
import Log, { link } from '../log'; | ||
|
||
export async function expoUpdatesCommandAsync(projectDir: string, args: string[]): Promise<string> { | ||
let expoUpdatesCli; | ||
try { | ||
expoUpdatesCli = | ||
silentResolveFrom(projectDir, 'expo-updates/bin/cli') ?? | ||
resolveFrom(projectDir, 'expo-updates/bin/cli.js'); | ||
} catch (e: any) { | ||
if (e.code === 'MODULE_NOT_FOUND') { | ||
throw new Error( | ||
`The \`expo-updates\` package was not found. Follow the installation directions at ${link( | ||
'https://docs.expo.dev/bare/installing-expo-modules/' | ||
)}` | ||
); | ||
} | ||
throw e; | ||
} | ||
|
||
const spawnPromise = spawnAsync(expoUpdatesCli, args, { | ||
stdio: ['inherit', 'pipe', 'pipe'], // inherit stdin so user can install a missing expo-cli from inside this command | ||
}); | ||
const { | ||
child: { stderr }, | ||
} = spawnPromise; | ||
if (!stderr) { | ||
throw new Error('Failed to spawn expo-updates cli'); | ||
} | ||
stderr.on('data', data => { | ||
for (const line of data.toString().trim().split('\n')) { | ||
Log.warn(`${chalk.gray('[expo-cli]')} ${line}`); | ||
} | ||
}); | ||
const result = await spawnPromise; | ||
return result.stdout; | ||
} |