File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -217,6 +217,24 @@ program
217217 } else {
218218 let opts = [ ] ;
219219 let propNames = answers . propNames . split ( ' ' ) ;
220+ // TODO: refact props: {typed: [], notTyped: []}
221+ // and better regexp
222+ const propsWithoutTypes = propNames . filter ( function ( prop ) {
223+ return ! / : / . test ( prop ) ;
224+ } ) ;
225+
226+ const propsWithTypes = propNames . filter ( function ( prop ) {
227+ return / : / . test ( prop ) ;
228+ } ) ;
229+
230+ let result = { } ;
231+ for ( prop of propsWithTypes ) {
232+ result [ prop . match ( / ^ [ a - z 0 - 9 ] + / ig) [ 0 ] ] = prop . match ( / : [ a - z 0 - 9 ] + / ig) [ 0 ] . substring ( 1 ) ;
233+ } ;
234+
235+ propNames = propsWithoutTypes ;
236+ //todo: fix that
237+ numberOfPropTypes = propNames . length ;
220238
221239 for (
222240 let count = 0 ;
@@ -241,11 +259,12 @@ program
241259 opts . push ( propTypeChoice ) ;
242260 }
243261 inquirer . prompt ( opts ) . then ( function ( answersInner ) {
262+ const _answersInner = { ...result , ...answersInner } ;
244263 generate . createComponent (
245264 modulename ,
246265 name ,
247266 answers ,
248- answersInner ,
267+ _answersInner ,
249268 options . file ,
250269 function ( status ) {
251270 if ( status ) {
You can’t perform that action at this time.
0 commit comments