File tree 3 files changed +24
-18
lines changed
packages/@angular/cli/blueprints
3 files changed +24
-18
lines changed Original file line number Diff line number Diff line change @@ -203,17 +203,19 @@ export default Blueprint.extend({
203
203
} ,
204
204
205
205
afterInstall : function ( options : any ) {
206
- if ( options . dryRun ) {
207
- return ;
208
- }
209
-
210
206
const returns : Array < any > = [ ] ;
211
207
const className = stringUtils . classify ( `${ options . entity . name } Component` ) ;
212
208
const fileName = stringUtils . dasherize ( `${ options . entity . name } .component` ) ;
213
209
const componentDir = path . relative ( path . dirname ( this . pathToModule ) , this . generatePath ) ;
214
210
const importPath = componentDir ? `./${ componentDir } /${ fileName } ` : `./${ fileName } ` ;
215
211
216
212
if ( ! options . skipImport ) {
213
+ if ( options . dryRun ) {
214
+ this . _writeStatusToUI ( chalk . yellow ,
215
+ 'update' ,
216
+ path . relative ( this . project . root , this . pathToModule ) ) ;
217
+ return ;
218
+ }
217
219
const preChange = fs . readFileSync ( this . pathToModule , 'utf8' ) ;
218
220
219
221
returns . push (
Original file line number Diff line number Diff line change @@ -132,10 +132,6 @@ export default Blueprint.extend({
132
132
} ,
133
133
134
134
afterInstall : function ( options : any ) {
135
- if ( options . dryRun ) {
136
- return ;
137
- }
138
-
139
135
const returns : Array < any > = [ ] ;
140
136
const className = stringUtils . classify ( `${ options . entity . name } Directive` ) ;
141
137
const fileName = stringUtils . dasherize ( `${ options . entity . name } .directive` ) ;
@@ -145,6 +141,12 @@ export default Blueprint.extend({
145
141
const importPath = relativeDir ? `./${ relativeDir } /${ fileName } ` : `./${ fileName } ` ;
146
142
147
143
if ( ! options . skipImport ) {
144
+ if ( options . dryRun ) {
145
+ this . _writeStatusToUI ( chalk . yellow ,
146
+ 'update' ,
147
+ path . relative ( this . project . root , this . pathToModule ) ) ;
148
+ return ;
149
+ }
148
150
returns . push (
149
151
astUtils . addDeclarationToModule ( this . pathToModule , className , importPath )
150
152
. then ( ( change : any ) => change . apply ( NodeHost ) )
@@ -155,9 +157,9 @@ export default Blueprint.extend({
155
157
}
156
158
return result ;
157
159
} ) ) ;
158
- this . _writeStatusToUI ( chalk . yellow ,
159
- 'update' ,
160
- path . relative ( this . project . root , this . pathToModule ) ) ;
160
+ this . _writeStatusToUI ( chalk . yellow ,
161
+ 'update' ,
162
+ path . relative ( this . project . root , this . pathToModule ) ) ;
161
163
}
162
164
163
165
return Promise . all ( returns ) ;
Original file line number Diff line number Diff line change @@ -112,10 +112,6 @@ export default Blueprint.extend({
112
112
} ,
113
113
114
114
afterInstall : function ( options : any ) {
115
- if ( options . dryRun ) {
116
- return ;
117
- }
118
-
119
115
const returns : Array < any > = [ ] ;
120
116
const className = stringUtils . classify ( `${ options . entity . name } Pipe` ) ;
121
117
const fileName = stringUtils . dasherize ( `${ options . entity . name } .pipe` ) ;
@@ -125,6 +121,12 @@ export default Blueprint.extend({
125
121
const importPath = relativeDir ? `./${ relativeDir } /${ fileName } ` : `./${ fileName } ` ;
126
122
127
123
if ( ! options . skipImport ) {
124
+ if ( options . dryRun ) {
125
+ this . _writeStatusToUI ( chalk . yellow ,
126
+ 'update' ,
127
+ path . relative ( this . project . root , this . pathToModule ) ) ;
128
+ return ;
129
+ }
128
130
returns . push (
129
131
astUtils . addDeclarationToModule ( this . pathToModule , className , importPath )
130
132
. then ( ( change : any ) => change . apply ( NodeHost ) )
@@ -135,9 +137,9 @@ export default Blueprint.extend({
135
137
}
136
138
return result ;
137
139
} ) ) ;
138
- this . _writeStatusToUI ( chalk . yellow ,
139
- 'update' ,
140
- path . relative ( this . project . root , this . pathToModule ) ) ;
140
+ this . _writeStatusToUI ( chalk . yellow ,
141
+ 'update' ,
142
+ path . relative ( this . project . root , this . pathToModule ) ) ;
141
143
}
142
144
143
145
return Promise . all ( returns ) ;
You can’t perform that action at this time.
0 commit comments