File tree 1 file changed +10
-4
lines changed
packages/@angular/cli/upgrade
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import * as path from 'path';
6
6
7
7
import { CliConfig } from '../models/config' ;
8
8
import { findUp } from '../utilities/find-up' ;
9
+ import { requireProjectModule } from '../utilities/require-project-module' ;
9
10
10
11
const resolve = require ( 'resolve' ) ;
11
12
@@ -83,10 +84,15 @@ export class Version {
83
84
}
84
85
85
86
static assertAngularVersionIs2_3_1OrHigher ( projectRoot : string ) {
86
- const angularCorePath = path . join ( projectRoot , 'node_modules/@angular/core' ) ;
87
- const pkgJson = existsSync ( angularCorePath )
88
- ? JSON . parse ( readFileSync ( path . join ( angularCorePath , 'package.json' ) , 'utf8' ) )
89
- : null ;
87
+ let pkgJson ;
88
+ try {
89
+ pkgJson = requireProjectModule ( projectRoot , '@angular/core/package.json' ) ;
90
+ } catch ( _ ) {
91
+ console . error ( bold ( red ( stripIndents `
92
+ You seem to not be depending on "@angular/core". This is an error.
93
+ ` ) ) ) ;
94
+ process . exit ( 2 ) ;
95
+ }
90
96
91
97
// Just check @angular /core.
92
98
if ( pkgJson && pkgJson [ 'version' ] ) {
You can’t perform that action at this time.
0 commit comments