From 55932e1e461bee0ddeec76993218b459d2eb3306 Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Fri, 20 May 2022 11:07:06 +0200 Subject: [PATCH] fix: use correct framework version in telemetry --- lib/core-common/src/utils/get-storybook-info.ts | 3 ++- lib/telemetry/src/storybook-metadata.ts | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/core-common/src/utils/get-storybook-info.ts b/lib/core-common/src/utils/get-storybook-info.ts index 000f37bcff0..0729ac2ca9e 100644 --- a/lib/core-common/src/utils/get-storybook-info.ts +++ b/lib/core-common/src/utils/get-storybook-info.ts @@ -6,6 +6,7 @@ import { PackageJson } from '../types'; interface StorybookInfo { framework: string; version: string; + frameworkPackage: string; configDir?: string; mainConfig?: string; previewConfig?: string; @@ -57,7 +58,7 @@ const getFrameworkInfo = (packageJson: PackageJson) => { ); } - return { framework, version }; + return { framework, version, frameworkPackage: pkg }; }; const validConfigExtensions = ['ts', 'js', 'tsx', 'jsx', 'mjs', 'cjs']; diff --git a/lib/telemetry/src/storybook-metadata.ts b/lib/telemetry/src/storybook-metadata.ts index ec288805c3c..0a82e61f436 100644 --- a/lib/telemetry/src/storybook-metadata.ts +++ b/lib/telemetry/src/storybook-metadata.ts @@ -187,9 +187,13 @@ export const computeStorybookMetadata = async ({ const hasStorybookEslint = !!allDependencies['eslint-plugin-storybook']; const storybookInfo = getStorybookInfo(packageJson); + + const storybookVersion = + storybookPackages[storybookInfo.frameworkPackage]?.version || storybookInfo.version; + return { ...metadata, - storybookVersion: storybookInfo.version, + storybookVersion, language, storybookPackages, framework: {