File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed
packages/@angular/cli/commands Expand file tree Collapse file tree 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');
22import * as path from 'path' ;
33import * as child_process from 'child_process' ;
44import * as chalk from 'chalk' ;
5+ import { CliConfig } from '../models/config' ;
6+
57
68const VersionCommand = Command . extend ( {
79 name : 'version' ,
@@ -40,6 +42,13 @@ const VersionCommand = Command.extend({
4042
4143 ngCliVersion = `local (v${ pkg . version } , branch: ${ gitBranch } )` ;
4244 }
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+ }
4352
4453 if ( projPkg ) {
4554 roots . forEach ( root => {
@@ -76,12 +85,16 @@ const VersionCommand = Command.extend({
7685 } ,
7786
7887 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+ }
8598 } ,
8699
87100 printVersion : function ( module : string , version : string ) {
You can’t perform that action at this time.
0 commit comments