@@ -35,38 +35,42 @@ for (const id of Object.keys(plugins)) {
35
35
const { examples, options, readme, tests, header, community } = await plugin ( id )
36
36
37
37
//Readme
38
+ console . log ( `Generating source/plugins/${ community ? "community/" : "" } ${ id } /README.md` )
38
39
await fs . writeFile (
39
40
readme . path ,
40
41
readme . content
41
42
. replace ( / ( < ! - - h e a d e r - - > ) [ \s \S ] * ( < ! - - \/ h e a d e r - - > ) / g, `$1\n${ header } \n$2` )
42
43
. replace ( / ( < ! - - e x a m p l e s - - > ) [ \s \S ] * ( < ! - - \/ e x a m p l e s - - > ) / g, `$1\n${ examples . map ( ( { test, prod, ...step } ) => [ "```yaml" , yaml . dump ( step , { quotingType : '"' , noCompatMode : true } ) , "```" ] . join ( "\n" ) ) . join ( "\n" ) } \n$2` )
43
44
. replace ( / ( < ! - - o p t i o n s - - > ) [ \s \S ] * ( < ! - - \/ o p t i o n s - - > ) / g, `$1\n${ options } \n$2` ) ,
44
45
)
45
- console . log ( `Generating source/plugins/ ${ community ? "community/" : "" } ${ id } /README.md` )
46
+ staged . add ( readme . path )
46
47
47
48
//Tests
49
+ console . log ( `Generating tests/plugins/${ community ? "community/" : "" } ${ id } .yml` )
48
50
workflow . push ( ...examples . map ( example => testcase ( plugins [ id ] . name , "prod" , example ) ) . filter ( t => t ) )
49
51
await fs . writeFile ( tests . path , yaml . dump ( examples . map ( example => testcase ( plugins [ id ] . name , "test" , example ) ) . filter ( t => t ) ) )
50
- console . log ( `Generating tests/plugins/ ${ community ? "community/" : "" } ${ id } .yml` )
52
+ staged . add ( tests . path )
51
53
}
52
54
53
55
//Templates
54
56
for ( const id of Object . keys ( templates ) ) {
55
57
const { examples, readme, tests, header } = await template ( id )
56
58
57
59
//Readme
60
+ console . log ( `Generating source/templates/${ id } /README.md` )
58
61
await fs . writeFile (
59
62
readme . path ,
60
63
readme . content
61
64
. replace ( / ( < ! - - h e a d e r - - > ) [ \s \S ] * ( < ! - - \/ h e a d e r - - > ) / g, `$1\n${ header } \n$2` )
62
65
. replace ( / ( < ! - - e x a m p l e s - - > ) [ \s \S ] * ( < ! - - \/ e x a m p l e s - - > ) / g, `$1\n${ examples . map ( ( { test, prod, ...step } ) => [ "```yaml" , yaml . dump ( step , { quotingType : '"' , noCompatMode : true } ) , "```" ] . join ( "\n" ) ) . join ( "\n" ) } \n$2` ) ,
63
66
)
64
- console . log ( `Generating source/templates/ ${ id } /README.md` )
67
+ staged . add ( readme . path )
65
68
66
69
//Tests
70
+ console . log ( `Generating tests/templates/${ id } .yml` )
67
71
workflow . push ( ...examples . map ( example => testcase ( templates [ id ] . name , "prod" , example ) ) . filter ( t => t ) )
68
72
await fs . writeFile ( tests . path , yaml . dump ( examples . map ( example => testcase ( templates [ id ] . name , "test" , example ) ) . filter ( t => t ) , { quotingType : '"' , noCompatMode : true } ) )
69
- console . log ( `Generating tests/templates/ ${ id } .yml` )
73
+ staged . add ( tests . path )
70
74
}
71
75
72
76
//Config and general documentation auto-generation
0 commit comments