Skip to content

Commit

Permalink
[create-next-app] update logic for shouldUseYarn function (#11683)
Browse files Browse the repository at this point in the history
Co-authored-by: Joe Haddad <[email protected]>
  • Loading branch information
tsriram and Timer authored Apr 6, 2020
1 parent b91ee11 commit eec18ec
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/create-next-app/helpers/should-use-yarn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ 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) {
Expand Down

0 comments on commit eec18ec

Please sign in to comment.