From 948618f32d7dc1da1089f3bd7732a2ac89c67dc0 Mon Sep 17 00:00:00 2001 From: Henric Trotzig Date: Fri, 22 Dec 2023 12:03:50 +0100 Subject: [PATCH] Improve checking for Storybook v7 I came across a case where Storybook 7 was used but the plugin still detected v6. Going to add another v7 check to make things more robust. --- index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/index.js b/index.js index 9cfe037..6640f61 100644 --- a/index.js +++ b/index.js @@ -42,6 +42,18 @@ function resolveBuildCommandParts() { console.log('[happo] Check for Storybook v6 failed. Details:', e); } } + try { + execSync(`${binary} storybook --version`); + // Storybook v7 or later + return ['storybook', 'build']; + } catch (e) { + if (HAPPO_DEBUG) { + console.log( + '[happo] Check for Storybook v7 failed. Details:', + e, + ); + } + } try { execSync(`${binary} build-storybook --version`); return ['build-storybook'];