Skip to content

Commit

Permalink
Merge pull request #19235 from storybookjs/vite/step-support
Browse files Browse the repository at this point in the history
Vite: Support runStep in Vite builder SSv6
  • Loading branch information
IanVS authored Sep 24, 2022
2 parents e10b790 + d93bbe7 commit 253ffdb
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions code/lib/builder-vite/src/codegen-iframe-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export async function generateIframeScriptCode(options: ExtendedOptions) {
addDecorator,
addParameters,
addLoader,
addArgs,
addArgTypes,
addStepRunner,
addArgTypesEnhancer,
addArgsEnhancer,
setGlobalRender,
Expand All @@ -53,22 +56,10 @@ export async function generateIframeScriptCode(options: ExtendedOptions) {
const value = config[key];
switch (key) {
case 'args': {
if (typeof clientApi.addArgs !== "undefined") {
return clientApi.addArgs(value);
} else {
return logger.warn(
"Could not add global args. Please open an issue in storybookjs/builder-vite."
);
}
return addArgs(value);
}
case 'argTypes': {
if (typeof clientApi.addArgTypes !== "undefined") {
return clientApi.addArgTypes(value);
} else {
return logger.warn(
"Could not add global argTypes. Please open an issue in storybookjs/builder-vite."
);
}
return addArgTypes(value);
}
case 'decorators': {
return value.forEach((decorator) => addDecorator(decorator, false));
Expand Down Expand Up @@ -99,6 +90,9 @@ export async function generateIframeScriptCode(options: ExtendedOptions) {
case 'renderToDOM': {
return null; // This key is not handled directly in v6 mode.
}
case 'runStep': {
return addStepRunner(value);
}
default: {
// eslint-disable-next-line prefer-template
return console.log(key + ' was not supported :( !');
Expand Down

0 comments on commit 253ffdb

Please sign in to comment.