import Fs from 'fs' ; import Path from 'path' ; import execa from 'execa' ; import { BuildContext } from '../build_context' ; const winVersion = ( path ) => ( process . platform === 'win32' ? `${ path }.cmd` : path ) ; export async function yarnInstall ( { log , buildDir , config } ) { const pkgJson = Path . resolve ( buildDir , 'package.json' ) ; if ( config ?. skipInstallDependencies || ! Fs . existsSync ( pkgJson ) ) { return ; } log . info ( 'running yarn to install dependencies' ) ; await execa ( winVersion ( 'yarn' ) , [ 'install' , '--production' , '--pure-lockfile' ] , { cwd : buildDir , } ) ; }