utarwyn / storybook-branch-switcher

A Storybook addon and a simple CLI to navigate between multiple Git branches.
https://storybook.js.org/addons/storybook-branch-switcher
MIT License
1 stars 1 forks source link

Following readme instructions does not display the branch switcher in the tool bar #7

Closed jessepinuelas closed 3 weeks ago

jessepinuelas commented 1 month ago

I think I might be missing a step or not understanding the usage correctly. When I run storybook locally after following the read me instructions no branch switcher appears in the storybook tool bar.

I have two branches master and beta on GitHub

Steps I followed while in beta branch

  1. Installed addon via npm i --save-dev storybook-branch-switcher

  2. Added storybook branch switcher to my main.js

    const config = {
    stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
    addons: [
    '@storybook/addon-links',
    '@storybook/addon-essentials',
    '@storybook/addon-interactions',
    '@storybook/addon-toolbars',
    '@storybook/preset-create-react-app',
    'storybook-branch-switcher'
    ],
    framework: {
    name: '@storybook/react-webpack5',
    options: {
      builder: {
        fsCache: true,
        lazyCompilation: true
      }
    }
    },
    docs: {
    autodocs: 'tag'
    }
    };
    export default config;
  3. Created .branches.json in .storybook directory

    {
    "from": "storybook-static",
    "to": "storybook-bundle",
    "default_branch": "master",
    "default_root": true,
    "script_name": "build-storybook"
    }
  4. Ran sb-branch-switcher which successfully created storybook-bundle>beta

  5. Ran npm run storybook locally and nothing appeared in the tool bar am I missing something here?

jessepinuelas commented 1 month ago

@utarwyn any advice?

utarwyn commented 1 month ago

Hello @jessepinuelas, sorry for the response delay.

The script extracts branches only via one of the two providers mentioned in the README (Bitbucket PRs or GitHub PRs) otherwise it will take only the current branch. It looks like you can't search for all the existing Git branches. Is this what you need? Or would you prefer to specify the branches in the configuration file?

jessepinuelas commented 3 weeks ago

@utarwyn When I run storybook locally after following the read me instructions no branch switcher appears in the storybook tool bar.