File tree 1 file changed +14
-0
lines changed
packages/angular/cli/commands
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 5
5
* Use of this source code is governed by an MIT-style license that can be
6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
+ import { execSync } from 'child_process' ;
8
9
import * as path from 'path' ;
9
10
import { Command } from '../models/command' ;
10
11
import { colors } from '../utilities/color' ;
12
+ import { getPackageManager } from '../utilities/package-manager' ;
11
13
import { Schema as VersionCommandSchema } from './version' ;
12
14
13
15
interface PartialPackageInfo {
@@ -105,6 +107,7 @@ export class VersionCommand extends Command<VersionCommandSchema> {
105
107
`
106
108
Angular CLI: ${ ngCliVersion }
107
109
Node: ${ process . versions . node }
110
+ Package Manager: ${ await this . getPackageManager ( ) }
108
111
OS: ${ process . platform } ${ process . arch }
109
112
110
113
Angular: ${ angularCoreVersion }
@@ -163,4 +166,15 @@ export class VersionCommand extends Command<VersionCommandSchema> {
163
166
164
167
return version || '<error>' ;
165
168
}
169
+
170
+ private async getPackageManager ( ) : Promise < string > {
171
+ try {
172
+ const manager = await getPackageManager ( this . context . root ) ;
173
+ const version = execSync ( `${ manager } --version` , { encoding : 'utf8' , stdio : 'pipe' } ) . trim ( ) ;
174
+
175
+ return `${ manager } ${ version } ` ;
176
+ } catch {
177
+ return '<error>' ;
178
+ }
179
+ }
166
180
}
You can’t perform that action at this time.
0 commit comments