Do you use Storybook as a separate repository?
Asked Answered
K

1

6

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!

Kristiankristiansand answered 17/11, 2022 at 15:52 Comment(0)
E
3

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 :).

Emmery answered 18/11, 2022 at 10:14 Comment(2)
Hi @Atep, how can I set up storybook as a separate git repo? Storybook states that: Storybook needs to be installed into a project that is already set up with a framework. It will not work on an empty project.Jungle
Hi @vu-viet-hung, As I wrote, main point is, that you your Storybook as independent git repository and this repository i part of your projects as git submodule. So, you have just "single source of truth" - your SB independent git repository, but the implementation depends on your "main" Project/s. In Drupal is this as custom theme (and better way is to use subtheme derivate from your SB custom theme for each project..Emmery

© 2022 - 2024 — McMap. All rights reserved.