Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle 'no stories' error with custom messaging.
- Loading branch information
1 parent
d61f7d6
commit 906f442
Showing
5 changed files
with
51 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import chalk from 'chalk'; | ||
import dedent from 'ts-dedent'; | ||
|
||
import { error } from '../../components/icons'; | ||
import link from '../../components/link'; | ||
|
||
export default ({ options, buildLogFile }) => { | ||
const { buildScriptName } = options; | ||
return dedent(chalk` | ||
${error} {bold Cannot run a build with no stories} | ||
Your statically built Storybook exposes no stories. This indicates a problem with your Storybook. Here's what to do: | ||
- Check the build log at {bold ${buildLogFile}} | ||
- Run {bold npm run ${buildScriptName}} or {bold yarn ${buildScriptName}} yourself and make sure it outputs a valid Storybook by opening the generated {bold index.html} in your browser. | ||
- Make sure you haven't accidently ignored all stories. See ${link( | ||
'https://www.chromatic.com/docs/ignoring-elements#ignore-stories' | ||
)} for details. | ||
`); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import missingStories from './missingStories'; | ||
|
||
export default { | ||
title: 'CLI/Messages/Errors', | ||
}; | ||
|
||
export const MissingStories = () => | ||
missingStories({ | ||
options: { buildScriptName: 'build:storybook' }, | ||
buildLogFile: '/path/to/project/build-storybook.log', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters