Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite: Support runStep in Vite builder SSv6 #19235

Merged
merged 2 commits into from
Sep 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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