@@ -7,7 +7,7 @@ function getMetadata() {
7
7
const cp = child_process . spawn (
8
8
process . execPath ,
9
9
[
10
- path . resolve ( __dirname , '..' , '..' , 'dash' , 'meta-ts .js' ) ,
10
+ path . resolve ( __dirname , '..' , '..' , 'dash' , 'extract-meta .js' ) ,
11
11
'""' , // ignore pattern
12
12
'""' , // reserved keywords
13
13
path . join ( __dirname , 'src' , 'components' )
@@ -30,7 +30,13 @@ function getMetadata() {
30
30
} ) ;
31
31
cp . on ( 'close' , code => {
32
32
if ( code === 0 ) {
33
- resolve ( JSON . parse ( meta . join ( '' ) ) ) ;
33
+ resolve (
34
+ R . values ( JSON . parse ( meta . join ( '' ) ) ) . reduce ( ( acc , c ) => {
35
+ // Map them back to component name for easier access.
36
+ acc [ c . displayName ] = c ;
37
+ return acc ;
38
+ } , { } )
39
+ ) ;
34
40
} else {
35
41
reject ( err . join ( '' ) ) ;
36
42
}
@@ -98,7 +104,7 @@ describe('Test Typescript component metadata generation', () => {
98
104
test (
99
105
`${ componentName } setProps func` ,
100
106
testTypeFactory ( 'setProps' , 'func' )
101
- )
107
+ ) ;
102
108
} ) ;
103
109
104
110
describe ( 'Test prop attributes' , ( ) => {
@@ -234,4 +240,9 @@ describe('Test Typescript component metadata generation', () => {
234
240
}
235
241
) ;
236
242
} ) ;
243
+ describe ( 'Test mixed generation' , ( ) => {
244
+ test ( 'Standard js component is parsed' , ( ) => {
245
+ expect ( R . path ( [ 'StandardComponent' ] , metadata ) ) . toBeDefined ( ) ;
246
+ } ) ;
247
+ } ) ;
237
248
} ) ;
0 commit comments