This repository was archived by the owner on Nov 9, 2017. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +23
-6
lines changed Expand file tree Collapse file tree 2 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -250,10 +250,9 @@ AddcomponentGenerator = yeoman.generators.NamedBase.extend({
250
250
path = 'components/_' + this . pkg . name + '.scss' ;
251
251
}
252
252
253
- this . log ( 'PATH: ' + path ) ;
254
-
253
+ // exit app when file doesn't exist
255
254
if ( ! this . fs . exists ( path ) ) {
256
- this . log . error ( 'FILE DOESNT EXIST ') ;
255
+ this . emit ( 'error' , 'Does ' + path + ' exist? ') ;
257
256
}
258
257
259
258
// read
@@ -291,8 +290,14 @@ AddcomponentGenerator = yeoman.generators.NamedBase.extend({
291
290
if ( this . includeJS ) {
292
291
293
292
var
294
- path = 'components/' + this . pkg . name + '.js' ,
295
- file = this . fs . read ( path ) ,
293
+ path = 'components/' + this . pkg . name + '.js' ;
294
+
295
+ // exit app when file doesn't exist
296
+ if ( ! this . fs . exists ( path ) ) {
297
+ this . emit ( 'error' , 'Does ' + path + ' exist?' ) ;
298
+ }
299
+
300
+ var file = this . fs . read ( path ) ,
296
301
match = '//{{app}}' ,
297
302
regex = new RegExp ( '/' + string . slugify ( this . name ) + '/' , 'g' ) ,
298
303
line = lineNumber ( file , regex ) ,
Original file line number Diff line number Diff line change @@ -144,6 +144,11 @@ RemovecomponentGenerator = yeoman.generators.NamedBase.extend({
144
144
path = 'components/_' + this . pkg . name + '.scss' ;
145
145
}
146
146
147
+ // exit app when file doesn't exist
148
+ if ( ! this . fs . exists ( path ) ) {
149
+ this . emit ( 'error' , 'Does ' + path + ' exist?' ) ;
150
+ }
151
+
147
152
var file = this . fs . read ( path ) ;
148
153
149
154
if ( this . ComponentType === 'standardModule' ) {
@@ -165,7 +170,14 @@ RemovecomponentGenerator = yeoman.generators.NamedBase.extend({
165
170
removeFromRequireJS : function ( ) {
166
171
167
172
var
168
- path = 'components/' + this . pkg . name + '.js' ,
173
+ path = 'components/' + this . pkg . name + '.js' ;
174
+
175
+ // exit app when file doesn't exist
176
+ if ( ! this . fs . exists ( path ) ) {
177
+ this . emit ( 'error' , 'Does ' + path + ' exist?' ) ;
178
+ }
179
+
180
+ var
169
181
file = this . fs . read ( path ) ,
170
182
newcontent = '' ,
171
183
match ;
You can’t perform that action at this time.
0 commit comments