11import { Workflow } from '@expo/eas-build-job' ;
22import chalk from 'chalk' ;
33import getenv from 'getenv' ;
4- import resolveFrom from 'resolve-from' ;
54
65import { resolveWorkflowPerPlatformAsync } from './workflow' ;
6+ import { isExpoDevClientInstalled } from '../build/utils/devClient' ;
77import Log , { learnMore } from '../log' ;
88import type { ProfileData } from '../utils/profiles' ;
99import type { Client } from '../vcs/vcs' ;
1010
1111const suppressionEnvVarName = 'EAS_BUILD_NO_EXPO_GO_WARNING' ;
1212
13- export const discourageExpoGoForProd = (
13+ export async function discourageExpoGoForProdAsync (
1414 buildProfiles : ProfileData < 'build' > [ ] | undefined ,
1515 projectDir : string ,
1616 vcsClient : Client
17- ) : void = > {
18- detectExpoGoProdBuildAsync ( buildProfiles , projectDir , vcsClient )
19- . then ( usesExpoGo => {
20- if ( usesExpoGo ) {
21- Log . newLine ( ) ;
22- Log . warn (
23- `⚠️ It appears you're trying to build an app based on Expo Go for production. Expo Go is not a suitable environment for production apps.`
24- ) ;
25- Log . warn (
26- learnMore ( 'https://docs.expo.dev/develop/development-builds/expo-go-to-dev-build/' , {
27- learnMoreMessage : 'Learn more about converting from Expo Go to a development build' ,
28- dim : false ,
29- } )
30- ) ;
31- Log . warn (
32- chalk . dim ( `To suppress this warning, set ${ chalk . bold ( ` ${ suppressionEnvVarName } =true` ) } .` )
33- ) ;
34- Log . newLine ( ) ;
35- }
36- } )
37- . catch ( err => {
38- Log . warn ( 'Error detecting whether Expo Go is used:' , err ) ;
39- } ) ;
40- } ;
17+ ) : Promise < void > {
18+ try {
19+ const usesExpoGo = await detectExpoGoProdBuildAsync ( buildProfiles , projectDir , vcsClient ) ;
20+ if ( ! usesExpoGo ) {
21+ return ;
22+ }
23+ Log . newLine ( ) ;
24+ Log . warn (
25+ `⚠️ It appears you're trying to build an app based on Expo Go for production. Expo Go is not a suitable environment for production apps.`
26+ ) ;
27+ Log . warn (
28+ learnMore ( 'https://docs.expo.dev/develop/development-builds/expo-go-to-dev-build/' , {
29+ learnMoreMessage : 'Learn more about converting from Expo Go to a development build' ,
30+ dim : false ,
31+ } )
32+ ) ;
33+ Log . warn (
34+ chalk . dim ( `To suppress this warning, set ${ chalk . bold ( ` ${ suppressionEnvVarName } =true` ) } .` )
35+ ) ;
36+ Log . newLine ( ) ;
37+ } catch ( err ) {
38+ Log . warn ( 'Error detecting whether Expo Go is used:' , err ) ;
39+ }
40+ }
4141
4242export async function detectExpoGoProdBuildAsync (
4343 buildProfiles : ProfileData < 'build' > [ ] | undefined ,
@@ -51,7 +51,7 @@ export async function detectExpoGoProdBuildAsync(
5151 return false ;
5252 }
5353
54- const hasExpoDevClient = checkIfExpoDevClientInstalled ( projectDir ) ;
54+ const hasExpoDevClient = isExpoDevClientInstalled ( projectDir ) ;
5555 if ( hasExpoDevClient ) {
5656 return false ;
5757 }
@@ -67,7 +67,3 @@ async function checkIfManagedWorkflowAsync(
6767
6868 return workflows . android === Workflow . MANAGED && workflows . ios === Workflow . MANAGED ;
6969}
70-
71- function checkIfExpoDevClientInstalled ( projectDir : string ) : boolean {
72- return resolveFrom . silent ( projectDir , 'expo-dev-client/package.json' ) !== undefined ;
73- }
0 commit comments