diff --git a/packages/angular/cli/commands/version-impl.ts b/packages/angular/cli/commands/version-impl.ts index 1619eccee6d8..b15e41f1ed86 100644 --- a/packages/angular/cli/commands/version-impl.ts +++ b/packages/angular/cli/commands/version-impl.ts @@ -5,9 +5,11 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ +import { execSync } from 'child_process'; import * as path from 'path'; import { Command } from '../models/command'; import { colors } from '../utilities/color'; +import { getPackageManager } from '../utilities/package-manager'; import { Schema as VersionCommandSchema } from './version'; interface PartialPackageInfo { @@ -105,6 +107,7 @@ export class VersionCommand extends Command { ` Angular CLI: ${ngCliVersion} Node: ${process.versions.node} + Package Manager: ${await this.getPackageManager()} OS: ${process.platform} ${process.arch} Angular: ${angularCoreVersion} @@ -163,4 +166,15 @@ export class VersionCommand extends Command { return version || ''; } + + private async getPackageManager(): Promise { + try { + const manager = await getPackageManager(this.context.root); + const version = execSync(`${manager} --version`, { encoding: 'utf8', stdio: 'pipe' }).trim(); + + return `${manager} ${version}`; + } catch { + return ''; + } + } }