eec18ecafe
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
14 lines
341 B
TypeScript
14 lines
341 B
TypeScript
import { execSync } from 'child_process'
|
|
|
|
export function shouldUseYarn() {
|
|
try {
|
|
const userAgent = process.env.npm_config_user_agent
|
|
if (userAgent) {
|
|
return Boolean(userAgent && userAgent.startsWith('yarn'))
|
|
}
|
|
execSync('yarnpkg --version', { stdio: 'ignore' })
|
|
return true
|
|
} catch (e) {
|
|
return false
|
|
}
|
|
}
|