fix(@angular/cli): silence package manager not found messages

Fixes #12939
This commit is contained in:
Charles Lyding 2018-11-12 11:50:52 -05:00 committed by Keen Yee Liau
parent 26245c0c53
commit 00141868ce

View File

@ -10,10 +10,9 @@ import { existsSync } from 'fs';
import { join } from 'path';
import { getConfiguredPackageManager } from './config';
export function supportsYarn(): boolean {
function supports(name: string): boolean {
try {
execSync('yarn --version');
execSync(`${name} --version`, { stdio: 'ignore' });
return true;
} catch {
@ -21,14 +20,12 @@ export function supportsYarn(): boolean {
}
}
export function supportsNpm(): boolean {
try {
execSync('npm --version');
export function supportsYarn(): boolean {
return supports('yarn');
}
return true;
} catch {
return false;
}
export function supportsNpm(): boolean {
return supports('npm');
}
export function getPackageManager(root: string): string {