This is a simple tool allows you to deploy your Storybook into a static hosting service. (Currently, GitHub Pages only.)
Install Storybook Deployer with:
npm i --save @kadira/storybook-deployer
Then add a NPM script like this:
{
"scripts": {
...
"deploy-storybook": "storybook-to-ghpages",
...
}
}
Then you can run npm run deploy-storybook
to deploy the Storybook to GitHub Pages.
If you customize the build configuration with some additional params (like static file directory), then you need to expose another NPM script like this:
{
"scripts": {
...
"build-storybook": "build-storybook -s public -o .out",
...
}
}
Make sure to set the output directory as
.out
.
If you want to customize Git username, email or commit message, add this to package.json
:
"storybook-deployer": {
"gitUsername": "Custom Username",
"gitEmail": "custom@email.com",
"commitMessage": "Deploy Storybook [skip ci]"
}
It will override the default configuration:
"storybook-deployer": {
"gitUsername": "GH Pages Bot",
"gitEmail": "hello@ghbot.com",
"commitMessage": "Deploy Storybook to GitHub Pages"
}