@@ -5,11 +5,13 @@ var fs = require('fs');
55var isWin = / ^ w i n / . test ( process . platform ) ;
66var SLASH = isWin ?'\\' :'/' ;
77
8- function parseComponentFile ( fileString ) {
8+ function parseComponentFile ( filePath , fileString ) {
99var blocks = parseCommentBlocks ( fileString ) ;
1010var lines = [ ] ;
11+ var arr = filePath . split ( SLASH ) ;
1112var module = {
1213name :'' ,
14+ category :arr [ arr . length - 2 ] , // forms, buttons, etc
1315author :'' ,
1416description :'' ,
1517props :[ ] ,
@@ -162,7 +164,7 @@ function scan(root, callback) {
162164fse . walk ( root )
163165. on ( 'data' , function ( item ) {
164166// skip directory
165- if ( ! item . stats . isDirectory ( ) ) {
167+ if ( ! item . stats . isDirectory ( ) && item . path . endsWith ( '.vue' ) ) {
166168items . push ( item . path ) ;
167169console . log ( 'scanning file ' + item . path , items . length ) ;
168170}
@@ -181,7 +183,7 @@ function scan(root, callback) {
181183} else {
182184console . log ( 'parsing component file' , filePath ) ;
183185
184- result = parseComponentFile ( data ) ;
186+ result = parseComponentFile ( filePath , data ) ;
185187result . name && results . push ( result ) ; // store only when there is module name
186188
187189// when loop end, output json file