Standalone Options
There is also an API for running Storybook from Node.
const storybook = require('@storybook/{APP}/standalone');storybook({// options});
Where the APP is one of the supported apps. For example:
const storybook = require('@storybook/react/standalone');storybook({// options});
Mode
Mode is defining what Storybook mode will be applied:
dev
run Storybook in a dev mode - similar to start-storybook in CLI
const storybook = require('@storybook/react/standalone');storybook({mode: 'dev',// other options});
static
build static version of Storybook - similar to build-storybook in CLI
const storybook = require('@storybook/react/standalone');storybook({mode: 'static',// other options});
Other options are similar to those in the CLI.
For “dev” mode:
port [number] Port to run Storybookhost [string] Host to run StorybookstaticDir <dir-names> Directory where to load static files from, array of stringsconfigDir [dir-name] Directory where to load Storybook configurations fromhttps Serve Storybook over HTTPS. Note: You must provide your own certificate information.sslCa <ca> Provide an SSL certificate authority. (Optional with "https", required if using a self-signed certificate)sslCert <cert> Provide an SSL certificate. (Required with "https")sslKey <key> Provide an SSL key. (Required with "https")smokeTest Exit after successful startci CI mode (skip interactive prompts, don't open browser)quiet Suppress verbose build output
For “static” mode:
staticDir <dir-names> Directory where to load static files from, array of stringsoutputDir [dir-name] Directory where to store built filesconfigDir [dir-name] Directory where to load Storybook configurations fromwatch Enable watch modequiet Suppress verbose build output
Example:
const storybook = require('@storybook/angular/standalone');storybook({mode: 'dev',port: 9009,configDir: './.storybook',});
