Skip to content

Commit

Permalink
Get actual chromatic version too
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeasday committed Dec 8, 2022
1 parent 8b7db92 commit 82ccbd9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
13 changes: 9 additions & 4 deletions code/lib/telemetry/src/storybook-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,20 @@ export const computeStorybookMetadata = async ({
});
}

const chromaticVersionSpecifier = getChromaticVersionSpecifier(packageJson);
if (chromaticVersionSpecifier) {
addons.chromatic = {
version: undefined,
versionSpecifier: chromaticVersionSpecifier,
options: undefined,
};
}

const addonVersions = await getActualPackageVersions(addons);
addonVersions.forEach(({ name, version }) => {
addons[name].version = version;
});

const chromaticVersionSpecifier = getChromaticVersionSpecifier(packageJson);
if (chromaticVersionSpecifier)
addons.chromatic = { version: chromaticVersionSpecifier, options: undefined };

const addonNames = Object.keys(addons);

// all Storybook deps minus the addons
Expand Down
1 change: 1 addition & 0 deletions code/lib/telemetry/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type EventType =

export interface Dependency {
version: string | undefined;
versionSpecifier?: string;
}

export interface StorybookAddon extends Dependency {
Expand Down

0 comments on commit 82ccbd9

Please sign in to comment.