Skip to content

Commit

Permalink
fix(storybook): better error handling
Browse files Browse the repository at this point in the history
closed #14334
  • Loading branch information
mandarini committed Jan 16, 2023
1 parent c3e904d commit e1dad4c
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions packages/storybook/src/executors/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,29 @@ export function getStorybookFrameworkPath(uiFramework: UiFramework) {

// TODO(katerina): Remove when Storybook 7
function isStorybookV62onwards(uiFramework: string) {
const storybookPackageVersion = require(join(
uiFramework,
'package.json'
)).version;

return gte(storybookPackageVersion, '6.2.0-rc.4');
try {
const storybookPackageVersion = require(join(
uiFramework,
'package.json'
)).version;
return gte(storybookPackageVersion, '6.2.0-rc.4');
} catch (e) {
try {
const storybookPackageVersion = require(join(
'@storybook/core-server',
'package.json'
)).version;
return gte(storybookPackageVersion, '6.2.0-rc.4');
} catch (e) {
throw new Error(
`Error: ${e}
It looks like you don\'t have Storybook installed.
Please run the @nrwl/storybook:configuration generator,
or run "npm/yarn" again to install your dependencies.`
);
}
}
}

// TODO(katerina): Remove when Storybook 7
Expand Down

0 comments on commit e1dad4c

Please sign in to comment.