Skip to content

Commit 3a67f50

Browse files
committed
fix: prefetch bob version in advance to reduce timeouts
1 parent 6bcb6c8 commit 3a67f50

File tree

1 file changed

+8
-1
lines changed
  • packages/create-react-native-library/src

1 file changed

+8
-1
lines changed

packages/create-react-native-library/src/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,13 @@ async function create(_argv: yargs.Arguments<any>) {
259259
// eslint-disable-next-line @typescript-eslint/no-unused-vars
260260
const { _, $0, ...argv } = _argv;
261261

262+
// Prefetch bob version in background while asking questions
263+
const bobVersionPromise = spawn('npm', [
264+
'view',
265+
'react-native-builder-bob',
266+
'dist-tags.latest',
267+
]);
268+
262269
let local = false;
263270

264271
if (typeof argv.local === 'boolean') {
@@ -584,7 +591,7 @@ async function create(_argv: yargs.Arguments<any>) {
584591
new Promise<string>((resolve) => {
585592
setTimeout(() => resolve(FALLBACK_BOB_VERSION), 1000);
586593
}),
587-
spawn('npm', ['view', 'react-native-builder-bob', 'dist-tags.latest']),
594+
bobVersionPromise,
588595
]);
589596
} catch (e) {
590597
// Fallback to a known version if we couldn't fetch

0 commit comments

Comments
 (0)