Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

[RFC] rearchitect project to keep separate packages with single Storybook app #905

Closed
brylie opened this issue Jun 29, 2021 · 13 comments · Fixed by #933
Closed

[RFC] rearchitect project to keep separate packages with single Storybook app #905

brylie opened this issue Jun 29, 2021 · 13 comments · Fixed by #933
Assignees
Labels
💻 aspect: code Concerns the software code in the repository 🤖 aspect: dx Concerns developers' experience with the codebase dependencies Pull requests that update a dependency file ✨ goal: improvement Improvement to an existing feature good first issue New-contributor friendly help wanted Open to participation from the community 🟩 priority: low Low priority and doesn't need to be rushed 💪 skill: javascript/storybook Requires proficiency in 'JavaScript/Storybook' 💪 skill: javascript/vue Requires proficiency in 'JavaScript/Vue' 💪 skill: sass Requires proficiency in 'Sass' 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work 💬 talk: discussion Open for discussions and feedback

Comments

@brylie
Copy link
Contributor

brylie commented Jun 29, 2021

Problem

Our project is currently split into multiple packages each with its own Storybook instance. The separate packages are desirable so we can use them in downstream projects. However, having multiple Storybook instances has led to some breaking complexity and redundant configuration.

In effect, the complexity introduced by the underlying dependencies has become an impediment to further development.

Additionally, the package documentation should probably not be intermixed with package code (unless in the form of comments/docstrings).

Description

Determine how to rearchitect this project so that we have

  • only one global Storybook project and
  • separate packages for vocabulary, fonts, and vue-components (allowing packaged distribution)

With this architecture, we might then be able to deprecate lerna.

Example architecture

  • /src/ or /packages/ - contains the sub-packages
    • fonts/ - fonts package (can possibly be merged into the vocabulary package)
    • vocabulary/ - vocabulary package (possibly including the fonts package)
    • vue-vocabulary/ - Vue components
  • /docs/ - documentation project containing Storybook code
    • package.json - dependencies for Storybook project
    • imports for vocabulary packages might be defined in package.json or index.js

Related issue(s)

@brylie brylie added good first issue New-contributor friendly help wanted Open to participation from the community dependencies Pull requests that update a dependency file 🟩 priority: low Low priority and doesn't need to be rushed 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work ✨ goal: improvement Improvement to an existing feature 💻 aspect: code Concerns the software code in the repository 🤖 aspect: dx Concerns developers' experience with the codebase 💬 talk: discussion Open for discussions and feedback 💪 skill: sass Requires proficiency in 'Sass' 💪 skill: javascript/vue Requires proficiency in 'JavaScript/Vue' 💪 skill: javascript/storybook Requires proficiency in 'JavaScript/Storybook' labels Jun 29, 2021
@brylie
Copy link
Contributor Author

brylie commented Jul 8, 2021

@dhruvkb would you consider offering your perspective and guidance regarding a simplified project structure where Storybook is decoupled from the vocabulary packages?

@dhruvkb
Copy link
Contributor

dhruvkb commented Jul 8, 2021

I would absolutely love to, but I need a couple of days to play with Storybook before conclusively saying what would work for us. I'm still unsure if this is even possible with the way Storybook is architectured so I need to do a little bit of research on my end.

@brylie
Copy link
Contributor Author

brylie commented Jul 8, 2021

Sure thing. Take your time 😃

@dhruvkb
Copy link
Contributor

dhruvkb commented Jul 11, 2021

@brylie I did some experimentation about having a single storybook for two intermingled projects (SCSS + Vue). I've hosted the most elegant solution I found at dhruvkb/vocab and it's Storybook at https://dhruvkb.github.io/vocab.

This repo contains one project with two build entrypoints, one producing a combined stylesheet and the other producing a Vue library. Some features of this approach include:

  • minimum redundancy, both in terms of code and config
  • maximum code sharing, both within the project as well as for a single Storybook
  • very simplified dev process, Vue and SCSS are developed together
  • a more maintainable unified codebase instead of three smaller ones
  • easier for new developers; no need to learn any tooling like Lerna (I still don't know how it works so... 🤷‍♂️)

I personally like this solution a lot, especially because of the relatively straightforward migration path from the current state to this one.

Could you check the project out and see if you feel this direction would be beneficial to move forward?

@brylie
Copy link
Contributor Author

brylie commented Jul 12, 2021

@dhruvkb thank you so much! I am checking the code out now. Would you try an experiment to see if the solution you have made can be deployed to GitHub pages with the storybook-deployer? I.e.it would be useful to have a single command to build/deploy the latest project release for continuous integration.

@brylie
Copy link
Contributor Author

brylie commented Jul 13, 2021

@dhruvkb would you mind if I assign you to this task so we can track its resolution? It is a high priority in our active sprint 😃

@dhruvkb
Copy link
Contributor

dhruvkb commented Jul 14, 2021

Yeah, sure. I don't mind! 😄 Do you agree with the direction taken in the test repo?

@brylie
Copy link
Contributor Author

brylie commented Jul 14, 2021

Yes, the repo architecture looks great! 😎 🏗️

The only change I suggest is that we avoid keeping the generated output in revision control. Keeping static generated output in revision control makes for noisy pull requests and repository bloat.

The build system/script can typically generate the output in a dedicated branch for GitHub pages or Netlify. So, I recommend we add a .gitignore rule to exclude the /docs directory and investigate how the deployment will generate the static files in a separate task.

@brylie brylie assigned brylie and dhruvkb and unassigned brylie Jul 14, 2021
@dhruvkb
Copy link
Contributor

dhruvkb commented Jul 14, 2021

@brylie putting the Storybook in the docs/ directory was a quick hack to get the Storybook live for a demo, that's definitely not what I intended to do in production 😆.

@dhruvkb
Copy link
Contributor

dhruvkb commented Jul 18, 2021

I've started working on this in a separate restructure branch. We can discussion the implementation specifics on the ^draft PR. Reviews, feedback and contributions to it are welcome 😄!

@github-actions
Copy link

Stale issue message

@brylie
Copy link
Contributor Author

brylie commented Sep 17, 2021

@dhruvkb have you had a chance to review pull request #940?

@dhruvkb
Copy link
Contributor

dhruvkb commented Sep 17, 2021

Really sorry @brylie and @sadn1ck for all the delays I've caused in the review. I got caught up in work a little more than usual. I'll definitely review this today and take this through to completion if there are any changes to be made.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💻 aspect: code Concerns the software code in the repository 🤖 aspect: dx Concerns developers' experience with the codebase dependencies Pull requests that update a dependency file ✨ goal: improvement Improvement to an existing feature good first issue New-contributor friendly help wanted Open to participation from the community 🟩 priority: low Low priority and doesn't need to be rushed 💪 skill: javascript/storybook Requires proficiency in 'JavaScript/Storybook' 💪 skill: javascript/vue Requires proficiency in 'JavaScript/Vue' 💪 skill: sass Requires proficiency in 'Sass' 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work 💬 talk: discussion Open for discussions and feedback
Development

Successfully merging a pull request may close this issue.

2 participants