@@ -6,6 +6,8 @@ const { defaultSmartUIConfig } = require('./utils/config')
66const { skipStory } = require ( './utils/story' )
77const { getLastCommit } = require ( './utils/git' )
88const static = require ( './utils/static' )
9+ var { constants } = require ( './utils/constants' ) ;
10+ const { shortPolling } = require ( './utils/polling' ) ;
911
1012async function storybook ( serve , options ) {
1113 let type = / ^ h t t p s ? : \/ \/ / . test ( serve ) ? 'url' : 'dir' ;
@@ -119,21 +121,20 @@ async function storybook(serve, options) {
119121 githubURL : process . env . GITHUB_URL || '' ,
120122 }
121123 }
122- console . log ( payload ) ;
123124
124125 // Call static render API
125- // await axios.post(new URL(constants[options.env].STATIC_BASE_URL , constants[options.env].STATIC_RENDER_PATH ).href, payload)
126- // .then(async function (response) {
127- // console.log('[smartui] Build in progress...');
128- // await static. shortPolling(response.data.buildId, 0, options);
129- // })
130- // .catch(function (error) {
131- // if (error.response) {
132- // console.log('[smartui] Build failed: Error: ', error.response.data.message);
133- // } else {
134- // console.log('[smartui] Build failed: Error: ', error.message);
135- // }
136- // });
126+ await axios . post ( new URL ( constants [ options . env ] . STATIC_RENDER_PATH , constants [ options . env ] . BASE_URL ) . href , payload )
127+ . then ( async function ( response ) {
128+ console . log ( '[smartui] Build in progress...' ) ;
129+ await shortPolling ( response . data . data . buildId , 0 , options ) ;
130+ } )
131+ . catch ( function ( error ) {
132+ if ( error . response ) {
133+ console . log ( '[smartui] Build failed: Error: ' , error . response . data . message ) ;
134+ } else {
135+ console . log ( '[smartui] Build failed: Error: ' , error . message ) ;
136+ }
137+ } ) ;
137138 } )
138139 . catch ( function ( error ) {
139140 if ( error . response ) {
0 commit comments