New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework the project structure #501
Comments
Overall, I would go with option 2: it looks better for maintainability and understanding, especially in the long term. And I would put everything in the same folder as the component: I could imagine having stories and/or tests in a distinct folder, as they are part of a "different" stack but I've got no true reason to do this (not convinced). And I agree with the About this, I know it is possible to explicitly specify the package's entry points but I had trouble using it in a previous project: https://nodejs.org/api/packages.html#package-entry-points |
I would choose the second option where we, as much as possible, colocate files together. It's a common practive in JavaScript projects to do so. I find it easier to navigate and understand. It's also easier to know which files are involved in one component. |
I do find the second option to be better as well. Also it will probably be much easier to navigate through the files for us with that option than the first one. |
Yes, I tried experimenting with this but support with smart CDNs and some bundlers was still a bit weird... We'll try again in the future. |
I did some experiments with rollup and I'm sad 😢
|
OK, I tried all files as inputs and it seems to work 🎉 |
🎉 I found a way to move files automatically with a custom config of Rollup ❤️
Things that feel right:
Things we should discuss:
Those files are only used by stories.
NOTE: images in Is it bad if we have images in there that are only used by stories? |
Thinking about those exceptions:
I propose something like this (where
|
NOTE: I gave a look at multiple component library repos on GitHub (thanks https://storybook.js.org/showcase/projects) and most of them put everything in |
NOTE: If we move the tests from |
WARNING: I completely forgot about |
I'm considering removing most of the "folders" in the Storybook and only keep:
|
I like the organization
I would prefer the assets used only by stories to be located inside the
I would prefer having a
|
👍
I'm OK with both 👍
It's already like this 👍 |
Context
All components are organized in folders that have some kind of meaning.
It can be semantic:
atoms
or related to the domain:env-vars
.Problems
NOTE: The folder is not used by Storybook for the left menu/tree (even if it's the same). This is done through CSF config.
Proposition
1) Component files in
src/components
Example: we move
src/atoms/cc-input-text.js
tosrc/components/cc-input-text.js
.types.d.ts
?types.d.ts
file.2) Component files in
src/components/cc-my-component
Example: we move
src/atoms/cc-input-text.js
tosrc/components/cc-input-text/cc-input-text.js
.types.d.ts
?types.d.ts
in the same folder as the componenttypes.d.ts
for types used by multiple componentssrc/homepage/cc-article-list.smart.js
tosrc/components/cc-article-list/cc-article-list.smart.js
.stories/atoms/cc-input-text.stories.js
tosrc/components/cc-input-text/cc-input-text.stories.js
.stories/homepage/cc-article-list.smart.md
tosrc/components/cc-article-list/cc-article-list.smart.md
.Impacts
In both cases, I propose that we publish to npm with all components directly available in the
root
folder.The text was updated successfully, but these errors were encountered: