@@ -11,7 +11,7 @@ import {
1111 writeFileSync ,
1212} from 'node:fs' ;
1313import { createRequire } from 'node:module' ;
14- import { join , relative } from 'node:path' ;
14+ import { basename , join , relative } from 'node:path' ;
1515import { fileURLToPath } from 'node:url' ;
1616import { isRunning , run , sleep } from './core/exec.ts' ;
1717import { remoteBackend } from './core/remote/backend.ts' ;
@@ -494,13 +494,21 @@ async function ensureServed(
494494 return current ;
495495}
496496
497- export function productFor ( backend : BackendKind ) : BuildProduct {
498- return backend === 'remote' ? 'standalone' : 'dev-client' ;
497+ export function productFor ( backend : BackendKind , env : NodeJS . ProcessEnv = process . env ) : BuildProduct {
498+ if ( backend === 'remote' ) return 'standalone' ;
499+ const asked = env . VERIFY_LOCAL_BUILD ;
500+ if ( asked === undefined || asked === '' || asked === 'dev-client' ) return 'dev-client' ;
501+ if ( asked === 'standalone' ) return 'standalone' ;
502+ throw new VerifyFailure (
503+ 'USAGE' ,
504+ `VERIFY_LOCAL_BUILD=${ asked } is not dev-client or standalone` ,
505+ 'unset VERIFY_LOCAL_BUILD or set it to standalone' ,
506+ ) ;
499507}
500508
501- function keepBuild ( platform : Platform , built : string , into : string ) : string {
509+ function keepBuild ( built : string , into : string ) : string {
502510 mkdirSync ( into , { recursive : true } ) ;
503- const path = join ( into , platform === 'ios' ? ` ${ IOS_PRODUCT } .app` : 'app-debug.apk' ) ;
511+ const path = join ( into , basename ( built ) ) ;
504512 rmSync ( path , { recursive : true , force : true } ) ;
505513 cpSync ( built , path , { recursive : true , verbatimSymlinks : true } ) ;
506514 return path ;
@@ -534,24 +542,26 @@ export const host: HostAdapter<(typeof SCREENS)[number]> = {
534542 appId : ( ) => APP_ID ,
535543 buildInputs : ( platform , backend ) => buildInputs ( platform , productFor ( backend ) ) ,
536544 async build ( platform , key , into , progress ) {
545+ const product = productFor ( 'local' ) ;
537546 const path = await withFixtureLock ( progress , async ( ) => {
538- const watching = readRuntime ( 'watch' ) !== null ;
547+ const watching = product === 'dev-client' && readRuntime ( 'watch' ) !== null ;
539548 if ( watching )
540549 progress ( 'build the running watch build keeps packages/expo/dist current, so turbo build is skipped' ) ;
541550 else stopRuntime ( ) ;
542551 const built = await buildFixture ( {
543552 platform,
544- product : 'dev-client' ,
553+ product,
545554 nativeKey : key ,
546555 buildPackages : ! watching ,
547556 progress,
548557 } ) ;
549- return keepBuild ( platform , built , into ) ;
558+ return keepBuild ( built , into ) ;
550559 } ) ;
551560 return { platform, key, appId : APP_ID , path : path as ScratchPath , source : 'local' } ;
552561 } ,
553562 async runtime ( lease , progress ) {
554- if ( lease . backend === 'remote' ) return { entry : { kind : 'binary' } , processes : [ ] } ;
563+ if ( lease . backend === 'remote' || productFor ( lease . backend ) === 'standalone' )
564+ return { entry : { kind : 'binary' } , processes : [ ] } ;
555565 const port = metroPort ( lease ) ;
556566 return withCleanup (
557567 stopRuntime ,
0 commit comments