We always have addArgs and addArgTypes now

Previously, we didn't have any guarantee which version of storybook the builder was being used with.
Now that it's in the monorepo, it'll be versioned together with the rest of storybook.
This commit is contained in:
Ian VanSchooten 2022-09-22 17:51:09 -04:00
parent e10b7900d4
commit 7da06e40f5

View File

@ -39,6 +39,8 @@ export async function generateIframeScriptCode(options: ExtendedOptions) {
addDecorator,
addParameters,
addLoader,
addArgs,
addArgTypes,
addArgTypesEnhancer,
addArgsEnhancer,
setGlobalRender,
@ -53,22 +55,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));