storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
84.22k stars 9.26k forks source link

[Bug]: Parameter docs.autodocs = false not working #21920

Closed stefano-8wave closed 1 year ago

stefano-8wave commented 1 year ago

Describe the bug

versions

"vue": 3.2.47 "@storybook/builder-vite": "7.0.2", "@storybook/vue3-vite": "7.0.2", "vite": "4.2.1", "storybook": "7.0.2", "@storybook/addon-essentials": "7.0.2", "@storybook/...": "7.0.2",

Expected

I want to hide all the "Docs" autogenerated files on the sidebar. From the documentation I can set:

docs: {
       autodocs: false,
},

Unexpected

But It's not working. The docs files always exists. Only with the config below I can hide all the docs files, but then "storybook dev" command is not working:

addons: [
        {
            name: '@storybook/addon-essentials',
             options: {
                docs: false,
            },
        },
     ]

With the above config, docs correctly hides but the storybook dev command has this warning for all my stories: "Unable to index files" "... No matching story indexer found ....."

Any suggestion to hide docs files?

To Reproduce

Use this config on the main.js with the above versions.

export default {
    stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
    addons: [
        '@storybook/addon-a11y',
        '@storybook/addon-links',
        {
            name: '@storybook/addon-essentials',
        },
        '@storybook/addon-interactions',
        'storybook-dark-mode',
        'storybook-version',
    ],
    framework: {
        name: '@storybook/vue3-vite',
    },
    staticDirs: ['./static'],
    docs: {
        autodocs: false,
    },
    features: {
        storyStoreV7: false,
        interactionsDebugger: true,
        buildStoriesJson: true,
    },
}

Run the dev storybook command:

storybook dev -p 6006

System

Environment Info:

  System:
    OS: macOS 13.2
    CPU: (8) arm64 Apple M1 Pro
  Binaries:
    Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
    npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
  Browsers:
    Chrome: 111.0.5563.146
    Firefox: 109.0.1
    Safari: 16.3
  npmPackages:
    @storybook/addon-a11y: 7.0.2 => 7.0.2 
    @storybook/addon-actions: 7.0.2 => 7.0.2 
    @storybook/addon-docs: 7.0.2 => 7.0.2 
    @storybook/addon-essentials: 7.0.2 => 7.0.2 
    @storybook/addon-interactions: 7.0.2 => 7.0.2 
    @storybook/addon-links: 7.0.2 => 7.0.2 
    @storybook/builder-vite: 7.0.2 => 7.0.2 
    @storybook/channel-postmessage: 7.0.2 => 7.0.2 
    @storybook/channel-websocket: 7.0.2 => 7.0.2 
    @storybook/cli: 7.0.2 => 7.0.2 
    @storybook/client-api: 7.0.2 => 7.0.2 
    @storybook/client-logger: 7.0.2 => 7.0.2 
    @storybook/core-common: 7.0.2 => 7.0.2 
    @storybook/jest: ^0.1.0 => 0.1.0 
    @storybook/preview-api: 7.0.2 => 7.0.2 
    @storybook/preview-web: 7.0.2 => 7.0.2 
    @storybook/test-runner: ^0.10.0 => 0.10.0 
    @storybook/testing-library: ^0.1.0 => 0.1.0 
    @storybook/vue3: 7.0.2 => 7.0.2 
    @storybook/vue3-vite: 7.0.2 => 7.0.2

Additional context

On the previous storybook version (7.0.0-beta.40) I can hide all the autogenerated docs files adding this to the config:

docs: {
    disabled: true,
},

But with 7.0.2 is not working.

shilman commented 1 year ago

I tried this out in a fresh Vite project and it worked fine for me, so I'm wondering if it's a problem with multiple versions in your node_modules or something like that.

Do you a have a reproduction repo you can share? If not, can you create one? See how to create a repro.

stefano-8wave commented 1 year ago

@shilman Yes, with npx storybook@next sandbox is working, so maybe is a package.. You can try here https://github.com/volverjs/ui-vue/tree/develop

stefano-8wave commented 1 year ago

@shilman Ok, the problem maybe is the .mdx file stories i think.. on mdx files can i disable the autodocs?

github-actions[bot] commented 1 year ago

Hi there! Thank you for opening this issue, but it has been marked as stale because we need more information to move forward. Could you please provide us with the requested reproduction or additional information that could help us better understand the problem? We'd love to resolve this issue, but we can't do it without your help!

github-actions[bot] commented 1 year ago

I'm afraid we need to close this issue for now, since we can't take any action without the requested reproduction or additional information. But please don't hesitate to open a new issue if the problem persists – we're always happy to help. Thanks so much for your understanding.

stevus commented 1 year ago

FYI @stefano24 @shilman I have reproduced this as well here:

https://github.com/stevus/storybook-autodocs-false-repro/tree/master

I can either create another issue or this one could potentially be reopened?

What is the solution to hide the Docs entry for all stories?

image

This is the single story:

https://github.com/stevus/storybook-autodocs-false-repro/blob/master/jsx/SampleStory.stories.mdx

import { Meta, Story } from '@storybook/addon-docs'
import App from './App'

<Meta title='App' component={App} />

<Story
  name='App'>
  <App />
</Story>

main.js file:

https://github.com/stevus/storybook-autodocs-false-repro/blob/master/%40storybook/main.js

module.exports = {
  addons: [
    '@storybook/addon-links',
    '@storybook/addon-controls',
    '@storybook/addon-a11y',
    '@storybook/addon-essentials',
    '@storybook/addon-interactions',
  ],
  docs: {
    autodocs: 'false',
  },
  features: {
    postcss: false,
  },
  framework: {
    name: '@storybook/react-vite',
    options: {},
  },
  stories: ['../jsx/**/*.stories.mdx', '../stories/**/*.stories.mdx'],
}

'../stories/*/.stories.mdx' does not exist, needs to be removed, but that shouldn't effect the outcome here.