@@ -24,6 +24,15 @@ module.exports = async (actions, graphql) => {
2424 throw result . errors ;
2525 }
2626
27+ function hasStorybookConfig ( relPath ) {
28+ const locations = [ 'stories/index.js' , 'storybook/index.js' , 'storybook/index.jsx' ] ;
29+
30+ return locations . some ( ( location ) => {
31+ const filePath = path . join ( relPath , location ) ;
32+ return fs . existsSync ( filePath ) ;
33+ } ) ;
34+ }
35+
2736 result . data . npmPackages . edges . map ( ( { node } ) => {
2837 // Package manifest slug will be /package so remove it
2938 const pagePath = path . dirname ( node . fields . slug ) ;
@@ -41,7 +50,7 @@ module.exports = async (actions, graphql) => {
4150 packageName : node . manifest . name ,
4251 packageDescription : node . manifest . description ,
4352 // Flag if Storybook demos are available for this package
44- storybook : fs . existsSync ( path . join ( relPath , 'stories' , 'index.js' ) ) ,
53+ storybook : hasStorybookConfig ( relPath ) ,
4554 // Associate readme and story nodes via slug
4655 packagePath : path . join ( pagePath , 'package' ) ,
4756 readmePath : path . join ( pagePath , 'readme' )
0 commit comments