File tree 3 files changed +19
-5
lines changed
packages/@angular/cli/models
3 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -95,8 +95,10 @@ export class CliConfig extends CliConfigBase<ConfigInterface> {
95
95
96
96
static fromProject ( projectPath ?: string ) : CliConfig {
97
97
const configPath = this . configFilePath ( projectPath ) ;
98
- if ( ! configPath || configPath === this . globalConfigFilePath ( ) ) {
99
- return null ;
98
+
99
+ if ( ! configPath ||
100
+ ( configPath === this . globalConfigFilePath ( ) && process . cwd ( ) !== path . dirname ( configPath ) ) ) {
101
+ return null ;
100
102
}
101
103
if ( configCacheMap . has ( configPath ) ) {
102
104
return configCacheMap . get ( configPath ) ;
Original file line number Diff line number Diff line change @@ -74,9 +74,13 @@ export class CliConfig<JsonType> {
74
74
? ts . sys . readFile ( configPath )
75
75
: '{}' ;
76
76
const schemaContent = fs . readFileSync ( DEFAULT_CONFIG_SCHEMA_PATH , 'utf-8' ) ;
77
- const otherContents = otherPath
78
- . map ( path => fs . existsSync ( path ) && ts . sys . readFile ( path ) )
79
- . filter ( content => ! ! content ) ;
77
+
78
+ let otherContents = new Array < string > ( ) ;
79
+ if ( configPath !== otherPath [ 0 ] ) {
80
+ otherContents = otherPath
81
+ . map ( path => fs . existsSync ( path ) && ts . sys . readFile ( path ) )
82
+ . filter ( content => ! ! content ) ;
83
+ }
80
84
81
85
let content : T ;
82
86
let schema : Object ;
Original file line number Diff line number Diff line change
1
+ import { ng } from '../../utils/process' ;
2
+ import { deleteFile } from '../../utils/fs' ;
3
+ import { expectToFail } from '../../utils/utils' ;
4
+
5
+ export default function ( ) {
6
+ return deleteFile ( '.angular-cli.json' )
7
+ . then ( ( ) => expectToFail ( ( ) => ng ( 'generate' , 'class' , 'hello' ) ) ) ;
8
+ }
You can’t perform that action at this time.
0 commit comments