improved logging of metadata
MODIFY
bin-src/lib/getStorybookInfo.ts
bin-src/lib/getStorybookInfo.ts
@@ -22,7 +22,8 @@ export default async function getStorybookInfo(
}
}
// Same for this await.
- return await getStorybookMetadata(ctx);
+ const sbMetadata = await getStorybookMetadata(ctx);
+ return sbMetadata;
} catch (e) {
ctx.log.debug(e);
return { viewLayer: null, version: null, addons: [], builder: null };

MODIFY
bin-src/lib/getStorybookMetadata.ts
bin-src/lib/getStorybookMetadata.ts
@@ -81,6 +81,7 @@ const findViewlayer = async ({ env, log, options, packageJson }) => {
// Note that `version` can be a semver range in this case.
return { viewLayer, version };
}
+ log.debug('viewLayer, ', `${viewLayer}`);
// Verify that the viewlayer package is actually present in node_modules.
return Promise.race([
resolvePackageJson(pkg)
@@ -115,7 +116,7 @@ const findAddons = async (ctx, mainConfig) => {
...ctx.packageJson?.devDependencies,
...ctx.packageJson?.peerDependencies,
};
- ctx.log.debug('addons, ', mainConfig.addons);
+
return {
addons: mainConfig.addons.map((addon) => {
let name: string;
@@ -156,13 +157,15 @@ const findConfigFlags = async ({ options, packageJson }) => {
};
};
-export const findBuilder = async (mainConfig) => {
+export const findBuilder = async (ctx, mainConfig) => {
let name = 'webpack4'; // default builder in Storybook v6
if (mainConfig?.core?.builder) {
const { builder } = mainConfig.core;
name = typeof builder === 'string' ? builder : builder.name;
}
+ ctx.log.debug('builder, ', name);
+
return Promise.race([
resolvePackageJson(builders[name])
.then((json) => ({ builder: { name, packageVersion: json.version } }))
@@ -180,7 +183,7 @@ export const getStorybookMetadata = async (ctx: Context) => {
findAddons(ctx, mainConfig),
findConfigFlags(ctx),
findViewlayer(ctx),
- findBuilder(mainConfig),
+ findBuilder(ctx, mainConfig),
]);
ctx.log.debug(info);
return info.reduce((acc, obj) => Object.assign(acc, obj), {});

MODIFY
bin-src/ui/tasks/storybookInfo.ts
bin-src/ui/tasks/storybookInfo.ts
@@ -11,7 +11,7 @@ const infoMessage = ({ addons, version, viewLayer, builder }: Context['storybook
const builderInfo = builder
? `${info}; using the ${builder.name} builder (${builder.packageVersion})`
: info;
- const supportedAddons = addons?.filter((addon) => addon && addon.name);
+ const supportedAddons = addons?.filter((addon) => addon?.name);
return supportedAddons?.length
? `${builderInfo}; supported addons found: ${supportedAddons
.map((addon) => capitalize(addon.name))

improved logging of metadata