diff --git a/gulpfile.js b/gulpfile.js index 768e6d419..f9afc6d36 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -148,7 +148,16 @@ gulp.task('installFixtures', function() { }, 1 * 1000); shell.cd('test/fixtures'); - execAsync('npm install --quiet', {cwd: '../fixtures'}).then(() => { + let installCommand; + if(process.platform === 'win32') { + installCommand = 'yarn --version >nul 2>&1 && ( yarn install ) || ( npm install --quiet )'; + } else { + installCommand = 'type yarn &> /dev/null | yarn install || npm install --quiet'; + } + + execAsync(installCommand, { + cwd: '../fixtures' + }).then(() => { process.stdout.write('\n'); if(!process.env.SAUCE_USERNAME) { gutil.log('running npm run-script update-webdriver'); diff --git a/src/generators/app/index.js b/src/generators/app/index.js index fe914e588..9c169d0ce 100644 --- a/src/generators/app/index.js +++ b/src/generators/app/index.js @@ -606,7 +606,15 @@ export class Generator extends Base { install() { if(!this.options['skip-install']) { - this.spawnCommand('npm', ['install']); + let yarnCheckCommand; + if (process.platform === 'win32') { + yarnCheckCommand = 'yarn --version >nul 2>&1'; + } else { + yarnCheckCommand = 'type yarn &> /dev/null'; + } + exec(yarnCheckCommand, (error, stdout, stderr) => { + return this.spawnCommand((!error) ? 'yarn' : 'npm', ['install']); + }); } }