react-cdk
react-cdk copied to clipboard
Configuring colocated stories
Hi,
I'm using React CDK for a collection of components, and I'd like to colocate the stories:
src
|-- components
|---|-- Button
|---|---|-- Button.js
|---|---|-- Button.test.js
|---|---|-- Button.stories.js
|---|-- Input
|---|---|-- Input.js
|---|---|-- Input.test.js
|---|---|-- Input.stories.js
In .storybook/config
, I can simply update the loadStories
function to do something like this:
const components = require.context('../src/components', true, /.stories.js$/);
function loadStories() {
components.keys().forEach(filename => components(filename));
}
This works great, but there's a warning at the top of ./storybook/config
:
// IMPORTANT
// ---------
// This is an auto generated file with React CDK.
// Do not modify this file.
I'm afraid that my changes will be overwritten, or at the very least, that there's a better way to do this. Please let me know :)
@joshwcomeau It'll be overwritten if you update your project. If you're not going to do it feel free to setup your project as you need :)
But I'm sure we should think about to provide an ability to do such customization like it's done for .scripts/prepublish.sh