File tree 1 file changed +19
-6
lines changed
packages/@angular/cli/commands
1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ const Command = require('../ember-cli/lib/models/command');
2
2
import * as path from 'path' ;
3
3
import * as child_process from 'child_process' ;
4
4
import * as chalk from 'chalk' ;
5
+ import { CliConfig } from '../models/config' ;
6
+
5
7
6
8
const VersionCommand = Command . extend ( {
7
9
name : 'version' ,
@@ -40,6 +42,13 @@ const VersionCommand = Command.extend({
40
42
41
43
ngCliVersion = `local (v${ pkg . version } , branch: ${ gitBranch } )` ;
42
44
}
45
+ const config = CliConfig . fromProject ( ) ;
46
+ if ( config && config . config . project . version !== pkg . version ) {
47
+ ngCliVersion += ` [${ config . config . project . version } ]` ;
48
+ }
49
+ if ( config && config . config . project . ejected ) {
50
+ ngCliVersion += ' (e)' ;
51
+ }
43
52
44
53
if ( projPkg ) {
45
54
roots . forEach ( root => {
@@ -76,12 +85,16 @@ const VersionCommand = Command.extend({
76
85
} ,
77
86
78
87
getVersion : function ( moduleName : string ) : string {
79
- const modulePkg = require ( path . resolve (
80
- this . project . root ,
81
- 'node_modules' ,
82
- moduleName ,
83
- 'package.json' ) ) ;
84
- return modulePkg . version ;
88
+ try {
89
+ const modulePkg = require ( path . resolve (
90
+ this . project . root ,
91
+ 'node_modules' ,
92
+ moduleName ,
93
+ 'package.json' ) ) ;
94
+ return modulePkg . version ;
95
+ } catch ( e ) {
96
+ return 'error' ;
97
+ }
85
98
} ,
86
99
87
100
printVersion : function ( module : string , version : string ) {
You can’t perform that action at this time.
0 commit comments