@@ -17,8 +17,9 @@ import { version } from '../package.json';
1717import { addCodegenBuildScript } from './utils/addCodegenBuildScript' ;
1818import { createInitialGitCommit } from './utils/initialCommit' ;
1919import { assertNpx } from './utils/assert' ;
20+ import { resolveBobVersionWithFallback } from './utils/promiseWithFallback' ;
2021
21- const FALLBACK_BOB_VERSION = '0.29 .0' ;
22+ const FALLBACK_BOB_VERSION = '0.32 .0' ;
2223
2324const BINARIES = [
2425 / ( g r a d l e w | \. ( j a r | k e y s t o r e | p n g | j p g | g i f ) ) $ / ,
@@ -276,12 +277,7 @@ async function create(_argv: yargs.Arguments<any>) {
276277 const { _, $0, ...argv } = _argv ;
277278
278279 // Prefetch bob version in background while asking questions
279- const bobVersionPromise = spawn ( 'npm' , [
280- 'view' ,
281- 'react-native-builder-bob' ,
282- 'dist-tags.latest' ,
283- ] ) ;
284-
280+ const resolveBobVersion = resolveBobVersionWithFallback ( FALLBACK_BOB_VERSION ) ;
285281 let local = false ;
286282
287283 if ( typeof argv . local === 'boolean' ) {
@@ -531,21 +527,6 @@ async function create(_argv: yargs.Arguments<any>) {
531527 reactNativeVersion,
532528 } = answers ;
533529
534- // Get latest version of Bob from NPM
535- let bobVersion : string ;
536-
537- try {
538- bobVersion = await Promise . race ( [
539- new Promise < string > ( ( resolve ) => {
540- setTimeout ( ( ) => resolve ( FALLBACK_BOB_VERSION ) , 1000 ) ;
541- } ) ,
542- bobVersionPromise ,
543- ] ) ;
544- } catch ( e ) {
545- // Fallback to a known version if we couldn't fetch
546- bobVersion = FALLBACK_BOB_VERSION ;
547- }
548-
549530 const moduleType = type . startsWith ( 'view-' ) ? 'view' : 'module' ;
550531 const arch =
551532 type === 'module-new' || type === 'view-new'
@@ -570,9 +551,10 @@ async function create(_argv: yargs.Arguments<any>) {
570551 . replace ( / [ ^ a - z 0 - 9 ] / g, '' )
571552 . toLowerCase ( ) } `;
572553
554+ const bobVersion = await resolveBobVersion ( ) ;
573555 const options = {
574556 bob : {
575- version : bobVersion || FALLBACK_BOB_VERSION ,
557+ version : bobVersion ,
576558 } ,
577559 project : {
578560 slug,
0 commit comments