@@ -3,30 +3,19 @@ import path from 'path';
3
3
import { Markdown } from './generateMarkdown' ;
4
4
import { separateParent } from './parentProps' ;
5
5
import { docgenParser } from './docgenParser' ;
6
+ import { findIgnoredComponents } from './utils' ;
6
7
import yargs from 'yargs' ;
7
8
8
9
const rootPath = path . join ( __dirname , '../../packages/' ) ;
9
10
10
- const ignore = [
11
- // Ignore themed package
12
- rootPath + 'themed/**' ,
13
- '**/base/**/index.tsx' ,
14
- '**/src/*/components/**' ,
15
- '**/__tests__/**' ,
16
- '**/helpers/**' ,
17
- '**/config/**' ,
18
- '**/base/src/SearchBar/SearchBar-**' ,
19
- ] ;
20
-
21
- function main ( sourcePath : string ) {
22
- const filePaths = glob . sync (
23
- path . join ( rootPath , sourcePath || '*/src/**/*.tsx' ) ,
24
- {
25
- absolute : true ,
26
- ignore,
27
- onlyFiles : true ,
28
- }
29
- ) ;
11
+ function main ( { source = '*/src/**/*.tsx' } : typeof argv ) {
12
+ const ignoredFiles = findIgnoredComponents ( rootPath ) ;
13
+
14
+ const filePaths = glob . sync ( path . join ( rootPath , source ) , {
15
+ absolute : true ,
16
+ ignore : ignoredFiles ,
17
+ onlyFiles : true ,
18
+ } ) ;
30
19
31
20
console . log ( 'Found' , filePaths . length , 'components' ) ;
32
21
@@ -39,8 +28,10 @@ function main(sourcePath: string) {
39
28
} ) ;
40
29
}
41
30
42
- const argv = yargs ( process . argv . slice ( 2 ) ) . options ( {
43
- include : { type : 'string' , alias : 'i' } ,
44
- } ) . argv ;
31
+ const { argv } = yargs ( process . argv . slice ( 2 ) ) . options ( {
32
+ source : { type : 'string' , alias : 's' } ,
33
+ component : { type : 'string' , alias : 'c' } ,
34
+ pkg : { type : 'string' , alias : 'p' } ,
35
+ } ) ;
45
36
46
- main ( argv . include ) ;
37
+ main ( argv ) ;
0 commit comments