Do you use Storybook as a separate repository?

1.3k views Asked by At

I'm a junior and I would like to start using Storybook in my Next.JS personal project. I have never used it before and all examples I found are basically design libraries that for example the whole company uses for multiple projects.

My question is, if I'm only using Storybook for one project/one repository do I:

  1. install it as a devDependency (so it doesn't affect build?) and run it in that one project
  2. or create new repository for Storybook only where I move my components and then import them back into the original project?

It doesn't sound very effiecient to me to take my components out just to import them back in and keep two repos updated and running at the same time.

I tried to find (unsuccesfully) an open-source/public project that uses Storybook in it's own repository as a devDependency for reference! I only found the big, separate libraries though. All the tutorials create a new project titled something like "Storybook example" so that doesn't help either.

Thank you in advance!

1

There are 1 answers

2
Atep On

we are using storybook as separate git repository with it own history. The "Main project" is in another/separate repository with git "storybook repository" as a (independent) submodule.

You can update your submodule (add new version of components, etc..) independently on the "main" repository. The main git repository have relation on "last" commit in the submodule (standard git submodule behavior), so after update submodule repository (and push) you have to commit this reference to submodule in main repository (it is a standard commit).

It allows us to work on storybook components with no harm and confusion with "commits" in the main project.

It is in Drupal so we have to use submodule because the theme directory (with storybook) is inside the main folder structure (repository).

Hope it helps :).