@@ -155,11 +155,11 @@ function shouldUseYarn() {
155155 }
156156}
157157
158- function install ( dependencies , verbose , isOnline ) {
158+ function install ( useYarn , dependencies , verbose , isOnline ) {
159159 return new Promise ( function ( resolve , reject ) {
160160 var command ;
161161 var args ;
162- if ( shouldUseYarn ( ) ) {
162+ if ( useYarn ) {
163163 command = 'yarnpkg' ;
164164 args = [
165165 'add' ,
@@ -201,10 +201,11 @@ function run(root, appName, version, verbose, originalDirectory, template) {
201201 ', and ' + chalk . cyan ( packageName ) + '...'
202202 ) ;
203203 console . log ( ) ;
204-
205- checkIfOnline ( )
204+
205+ var useYarn = shouldUseYarn ( ) ;
206+ checkIfOnline ( useYarn )
206207 . then ( function ( isOnline ) {
207- return install ( allDependencies , verbose , isOnline ) ;
208+ return install ( useYarn , allDependencies , verbose , isOnline ) ;
208209 } )
209210 . then ( function ( ) {
210211 checkNodeVersion ( packageName ) ;
@@ -422,7 +423,13 @@ function isSafeToCreateProjectIn(root) {
422423 } ) ;
423424}
424425
425- function checkIfOnline ( ) {
426+ function checkIfOnline ( useYarn ) {
427+ if ( ! useYarn ) {
428+ // Don't ping the Yarn registry.
429+ // We'll just assume the best case.
430+ return Promise . resolve ( true ) ;
431+ }
432+
426433 return new Promise ( function ( resolve ) {
427434 dns . resolve ( 'registry.yarnpkg.com' , function ( err ) {
428435 resolve ( err === null ) ;
0 commit comments