@@ -31,7 +31,7 @@ exports.handler = (argv) => {
3131 console . log ( '[Error] - You must use the react-intl package to use this command!' ) ;
3232 return ;
3333 }
34- const gitlabCiPath = path . join ( argv . path , '.gitlab-ci.yml ' ) ;
34+ const preparePath = path . join ( argv . path , 'styleguide/prepare.sh ' ) ;
3535 const configPath = path . join ( argv . path , 'styleguide/styleguide.ext.json' ) ;
3636 const config = require ( configPath ) ;
3737
@@ -50,13 +50,19 @@ import englishMessages from '$PACKAGE_NAME/translate/en.json';
5050 async . auto ( {
5151 runExtract : ( cb ) => spawn ( `npx @rollup-umd/intl extract` , cb ) ,
5252 isPrivate : ( cb ) => spawn ( `npx rollup-umd-scripts publish status | tail -1` , cb ) ,
53- setupCi : ( cb ) => exec ( `grep -q "npx @rollup-umd/documentation-cli intl" ${ gitlabCiPath } || echo true` , ( err , res ) => {
54- if ( res && res . indexOf ( 'true' ) !== - 1 ) {
55- sedReplace ( gitlabCiPath , `# !Replace variables` , `# !Replace variables\n - npx @rollup-umd/documentation-cli intl` , gitlabCiPath , cb ) ;
53+ setupCi : ( cb ) => {
54+ if ( ! fs . existsSync ( configPath ) ) {
55+ cb ( ) ;
5656 return ;
5757 }
58- cb ( ) ;
59- } ) ,
58+ exec ( `grep -q "npx @rollup-umd/documentation-cli intl" ${ preparePath } || echo true` , ( err , res ) => {
59+ if ( res && res . indexOf ( 'true' ) !== - 1 ) {
60+ exec ( `echo npx @rollup-umd/documentation-cli intl >> ${ preparePath } ` , cb ) ;
61+ return ;
62+ }
63+ cb ( ) ;
64+ } )
65+ } ,
6066 makeDoc : [ 'runExtract' , 'isPrivate' , 'setupCi' , ( res , cb ) => {
6167 const isPrivate = ! ( ( res . isPrivate [ 0 ] . split ( 'tail' ) [ 1 ] || res . isPrivate ) . indexOf ( 'private' ) === - 1 ) ; // ugly but support both internal cli and external cli
6268 pkg . translation . locales . forEach ( ( locale ) => {
0 commit comments