@@ -65,31 +65,7 @@ export class CliConfig extends CliConfigBase<ConfigInterface> {
6565
6666 const cliConfig = CliConfigBase . fromConfigPath < ConfigInterface > ( globalConfigPath ) ;
6767
68- const aliases = [
69- cliConfig . alias ( 'apps.0.root' , 'defaults.sourceDir' ) ,
70- cliConfig . alias ( 'apps.0.prefix' , 'defaults.prefix' )
71- ] ;
72-
73- // Additional aliases which do not emit any messages.
74- cliConfig . alias ( 'defaults.interface.prefix' , 'defaults.inline.prefixInterfaces' ) ;
75- cliConfig . alias ( 'defaults.component.inlineStyle' , 'defaults.inline.style' ) ;
76- cliConfig . alias ( 'defaults.component.inlineTemplate' , 'defaults.inline.template' ) ;
77- cliConfig . alias ( 'defaults.component.spec' , 'defaults.spec.component' ) ;
78- cliConfig . alias ( 'defaults.class.spec' , 'defaults.spec.class' ) ;
79- cliConfig . alias ( 'defaults.component.directive' , 'defaults.spec.directive' ) ;
80- cliConfig . alias ( 'defaults.component.module' , 'defaults.spec.module' ) ;
81- cliConfig . alias ( 'defaults.component.pipe' , 'defaults.spec.pipe' ) ;
82- cliConfig . alias ( 'defaults.component.service' , 'defaults.spec.service' ) ;
83-
84- // If any of them returned true, output a deprecation warning.
85- if ( aliases . some ( x => x ) ) {
86- console . error ( chalk . yellow ( oneLine `
87- The "defaults.prefix" and "defaults.sourceDir" properties of .angular-cli.json
88- are deprecated in favor of "apps[0].root" and "apps[0].prefix".\n
89- Please update in order to avoid errors in future versions of Angular CLI.
90- ` ) ) ;
91- }
92-
68+ CliConfig . addAliases ( cliConfig ) ;
9369 configCacheMap . set ( globalConfigPath , cliConfig ) ;
9470 return cliConfig ;
9571 }
@@ -108,11 +84,28 @@ export class CliConfig extends CliConfigBase<ConfigInterface> {
10884 const globalConfigPath = CliConfig . globalConfigFilePath ( ) ;
10985 const cliConfig = CliConfigBase . fromConfigPath < ConfigInterface > ( configPath , [ globalConfigPath ] ) ;
11086
87+ CliConfig . addAliases ( cliConfig ) ;
88+ configCacheMap . set ( configPath , cliConfig ) ;
89+ return cliConfig as CliConfig ;
90+ }
91+
92+ static addAliases ( cliConfig : CliConfigBase < ConfigInterface > ) {
93+
94+ // Aliases with deprecation messages.
11195 const aliases = [
11296 cliConfig . alias ( 'apps.0.root' , 'defaults.sourceDir' ) ,
11397 cliConfig . alias ( 'apps.0.prefix' , 'defaults.prefix' )
11498 ] ;
11599
100+ // If any of them returned true, output a deprecation warning.
101+ if ( aliases . some ( x => x ) ) {
102+ console . error ( chalk . yellow ( oneLine `
103+ The "defaults.prefix" and "defaults.sourceDir" properties of .angular-cli.json
104+ are deprecated in favor of "apps[0].root" and "apps[0].prefix".\n
105+ Please update in order to avoid errors in future versions of Angular CLI.
106+ ` ) ) ;
107+ }
108+
116109 // Additional aliases which do not emit any messages.
117110 cliConfig . alias ( 'defaults.interface.prefix' , 'defaults.inline.prefixInterfaces' ) ;
118111 cliConfig . alias ( 'defaults.component.inlineStyle' , 'defaults.inline.style' ) ;
@@ -123,17 +116,6 @@ export class CliConfig extends CliConfigBase<ConfigInterface> {
123116 cliConfig . alias ( 'defaults.component.module' , 'defaults.spec.module' ) ;
124117 cliConfig . alias ( 'defaults.component.pipe' , 'defaults.spec.pipe' ) ;
125118 cliConfig . alias ( 'defaults.component.service' , 'defaults.spec.service' ) ;
126-
127- // If any of them returned true, output a deprecation warning.
128- if ( aliases . some ( x => x ) ) {
129- console . error ( chalk . yellow ( oneLine `
130- The "defaults.prefix" and "defaults.sourceDir" properties of .angular-cli.json
131- are deprecated in favor of "apps[0].root" and "apps[0].prefix".\n
132- Please update in order to avoid errors in future versions of Angular CLI.
133- ` ) ) ;
134- }
135-
136- configCacheMap . set ( configPath , cliConfig ) ;
137- return cliConfig as CliConfig ;
119+ cliConfig . alias ( 'defaults.build.poll' , 'defaults.poll' ) ;
138120 }
139121}
0 commit comments