2019-07-19 21:55:30 +02:00
|
|
|
import { execSync } from 'child_process'
|
|
|
|
|
2020-05-10 12:55:46 +02:00
|
|
|
export function shouldUseYarn(): boolean {
|
2019-07-19 21:55:30 +02:00
|
|
|
try {
|
2020-04-06 09:32:20 +02:00
|
|
|
const userAgent = process.env.npm_config_user_agent
|
|
|
|
if (userAgent) {
|
|
|
|
return Boolean(userAgent && userAgent.startsWith('yarn'))
|
|
|
|
}
|
2019-07-19 21:55:30 +02:00
|
|
|
execSync('yarnpkg --version', { stdio: 'ignore' })
|
|
|
|
return true
|
|
|
|
} catch (e) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|