Building storybook

Anyone with experience building storybook?
After an hour hacking around I have the following script that builds something… (I also had to modify tsconfig to add the config folder and add ts module resolution)

cd web
rm config/preview.ts
rm config/main.js
mv config/webpack.config.js config/webpack.config.js_
cp config/storybook.preview.ts config/preview.ts
cp config/storybook.config.js config/main.js
yarn build-storybook -c config
mv config/webpack.config.js_ config/webpack.config.js
rm config/preview.ts
rm config/main.js
cd ..

Just a hack and it’s building, but the result is not great…

cc @bitshift

Are you trying to do something beyond yarn rw storybook --build? (See the CLI Docs for more.)

Also, Pete (@bitshift) has been doing some amazing exploratory work on Storybook over in this repo:

And he did a presentation this week we recorded and will be posting on YouTube soon. For now you can access the recording here:

Wow thank you. RTFM. Didn’t see that option for yarn rw storybook.
For the moment it fails with

info => Copying static files: /Users/stanislasduprey/Documents/Code/project/web/public at /Users/stanislasduprey/Documents/Code/project/web/public/storybook/
info => Loading custom manager config
info => Compiling manager..
info => Compiling preview..
/Users/stanislasduprey/Documents/Code/project/node_modules/fs-extra/lib/util/stat.js:42
      return cb(new Error(errMsg(src, dest, funcName)))
                ^

Error: Cannot copy '/Users/stanislasduprey/Documents/Code/project/web/public' to a subdirectory of itself, '/Users/stanislasduprey/Documents/Code/project/web/public/storybook/'.
    at /Users/stanislasduprey/Documents/Code/project/node_modules/fs-extra/lib/util/stat.js:42:17
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

But it seems to work on a blank redwood project, so that must be something I need to figure out

Ok, it seems to be linked to the staticDirs option here, so I added staticDirs: null in my storybook config and it works. Not sure why I have the problem and not on the redwood boilerplate