Skip to content

Commit

Permalink
fix(storybook): better error handling (#14396)
Browse files Browse the repository at this point in the history
(cherry picked from commit 55aba13)
  • Loading branch information
mandarini authored and FrozenPandaz committed Jan 17, 2023
1 parent 74ca312 commit b868964
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 @@ -35,12 +35,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.`
);
}
}
}

export function isStorybookV7() {
Expand Down

0 comments on commit b868964

Please sign in to comment.