Skip to content

Commit

Permalink
Merge pull request #738 from chromaui/test-framework-change-alone
Browse files Browse the repository at this point in the history
get the builder name and version via the mainConfig for SB v7+
  • Loading branch information
JonathanKolnik committed Apr 28, 2023
2 parents 24a3816 + d99a457 commit c76f620
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion bin-src/lib/getStorybookMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,17 @@ const findConfigFlags = async ({ options, packageJson }) => {
};

export const findBuilder = async (mainConfig) => {
if (mainConfig?.framework?.name) {
const sbV7BuilderName = mainConfig.framework.name;

return Promise.race([
resolvePackageJson(sbV7BuilderName)
.then((json) => ({ builder: { name: sbV7BuilderName, packageVersion: json.version } }))
.catch(() => Promise.reject(new Error(packageDoesNotExist(sbV7BuilderName)))),
timeout(10000),
]);
}

let name = 'webpack4'; // default builder in Storybook v6
if (mainConfig?.core?.builder) {
const { builder } = mainConfig.core;
Expand All @@ -170,7 +181,7 @@ export const getStorybookMetadata = async (ctx: Context) => {
const r = typeof __non_webpack_require__ !== 'undefined' ? __non_webpack_require__ : require;
const mainConfig = await r(path.resolve(configDir, 'main'));

const info = await Promise.all([
const info = await Promise.allSettled([
findAddons(ctx, mainConfig),
findConfigFlags(ctx),
findViewlayer(ctx),
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chromatic",
"version": "6.17.3",
"version": "6.17.4-next.0",
"description": "Automate visual testing across browsers. Gather UI feedback. Versioned documentation.",
"keywords": [
"storybook-addon",
Expand Down

0 comments on commit c76f620

Please sign in to comment.