make getBuilder more readable
MODIFY
bin-src/lib/getPrebuiltStorybookMetadata.ts
bin-src/lib/getPrebuiltStorybookMetadata.ts
@@ -26,20 +26,15 @@ export interface SBProjectJson {
}
const getBuilder = (sbProjectJson: SBProjectJson): { name: string; packageVersion: string } => {
- let name: string;
- if (sbProjectJson.builder) {
- const { builder } = sbProjectJson;
- name = sbProjectJson.builder.name;
- return {
- name,
- packageVersion: sbProjectJson.storybookPackages[builders[name]].version,
- };
+ const { builder, storybookPackages, storybookVersion } = sbProjectJson;
+ return builder
+ ? {
+ name: builder.name,
+ packageVersion: storybookPackages[builders[builder.name]].version,
}
-
- // Storybook uses Webpack4 if no builder is explicitly set.
- return {
- name: 'webpack4',
- packageVersion: sbProjectJson.storybookVersion,
+ : {
+ name: 'webpack4', // the default builder for Storybook v6
+ packageVersion: storybookVersion,
};
};

make getBuilder more readable