Skip to content

Commit f4dd66b

Browse files
committed
Include static render API call
1 parent eebb929 commit f4dd66b

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

commands/storybook.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ const { defaultSmartUIConfig } = require('./utils/config')
66
const { skipStory } = require('./utils/story')
77
const { getLastCommit } = require('./utils/git')
88
const static = require('./utils/static')
9+
var { constants } = require('./utils/constants');
10+
const { shortPolling } = require('./utils/polling');
911

1012
async function storybook(serve, options) {
1113
let type = /^https?:\/\//.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) {

commands/utils/constants.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ constants.stage = {
88
SB_BUILD_VALIDATE_PATH: "/storybook/validate",
99
CHECK_UPDATE_PATH: "storybook/packageinfo",
1010
GET_SIGNED_URL_PATH: "/storybook/url",
11-
STATIC_RENDER_PATH: "/storybook/static-render"
11+
STATIC_RENDER_PATH: "/storybook/staticrender"
1212
};
1313
constants.prod = {
1414
AUTH_URL: "https://api.lambdatest.com/storybook/auth",
@@ -18,7 +18,7 @@ constants.prod = {
1818
SB_BUILD_VALIDATE_PATH: "/storybook/validate",
1919
CHECK_UPDATE_PATH: "storybook/packageinfo",
2020
GET_SIGNED_URL_PATH: "/storybook/url",
21-
STATIC_RENDER_PATH: "/storybook/static-render"
21+
STATIC_RENDER_PATH: "/storybook/staticrender"
2222
};
2323

2424
module.exports = { constants };

0 commit comments

Comments
 (0)