@@ -11,6 +11,7 @@ import { Observable, of } from 'rxjs';
11
11
import { concatMap , tap } from 'rxjs/operators' ;
12
12
import * as fs from 'fs' ;
13
13
import { homedir } from 'os' ;
14
+ import { stripIndent } from 'common-tags' ;
14
15
import { findUp } from '../utilities/find-up' ;
15
16
16
17
@@ -38,6 +39,7 @@ export class WorkspaceLoader {
38
39
39
40
// TODO: do this with the host instead of fs.
40
41
private _getProjectWorkspaceFilePath ( projectPath ?: string ) : Observable < Path | null > {
42
+ this . _assertUpdatedWorkspace ( projectPath ) ;
41
43
// Find the workspace file, either where specified, in the Angular CLI project
42
44
// (if it's in node_modules) or from the current process.
43
45
const workspaceFilePath = ( projectPath && findUp ( this . _configFileNames , projectPath ) )
@@ -81,4 +83,26 @@ export class WorkspaceLoader {
81
83
tap ( workspace => this . _workspaceCacheMap . set ( workspacePath , workspace ) )
82
84
) ;
83
85
}
86
+
87
+ private _assertUpdatedWorkspace ( projectPath ?: string ) {
88
+ const oldConfigFileNames = [
89
+ normalize ( '.angular-cli.json' ) ,
90
+ normalize ( 'angular-cli.json' ) ,
91
+ ] ;
92
+
93
+ const oldConfigFilePath = ( projectPath && findUp ( oldConfigFileNames , projectPath ) )
94
+ || findUp ( oldConfigFileNames , process . cwd ( ) )
95
+ || findUp ( oldConfigFileNames , __dirname ) ;
96
+
97
+ if ( oldConfigFilePath ) {
98
+ throw new Error ( stripIndent `
99
+ An old project has been detected, which needs to be updated to Angular CLI 6.
100
+
101
+ Please run the following commands to update this project.
102
+
103
+ ng update @angular/cli --migrate-only --from=1.7.1
104
+ npm i
105
+ ` ) ;
106
+ }
107
+ }
84
108
}
0 commit comments