Skip to content

Storybook

The Storybook plugin gives every package with a .storybook folder a build-storybook and a storybook task.

Terminal window
axle add storybook

This writes it into the root axle.toml:

[plugins.storybook]
source = "npm:@axle-rs/plugin-storybook@0.1.0"
hash = "sha256-…"

A package or project with a .storybook/main file, .ts, .mts, .cts, .js, .mjs or .cjs, gets:

Task Command Settings
build-storybook storybook build inputs the package’s files and .storybook, outputs storybook-static
storybook storybook dev persistent, ready when Storybook prints that it started

Each command runs through the repository’s package manager, such as pnpm exec storybook build, so it uses the version the package installs.

.storybook is added to the inputs because Git may not see it as part of the package’s sources. A build that writes elsewhere, with --output-dir, should set outputs in the package’s axle.toml.

A package’s own script wins. When its package.json has a script with a task’s name that runs something else, such as "storybook": "storybook dev -p 6006", the plugin leaves that task alone and Axle runs the script. A script that only runs the same command is replaced by the plugin’s task, which runs the same command and adds its settings. The repository’s axle.toml changes a task as it would any other, and wins over the plugin.

Setting Default Meaning
build "build-storybook" the name of the build task, or false to leave it out
dev "storybook" the name of the dev server task, or false
[plugins.storybook]
source = "npm:@axle-rs/plugin-storybook@0.1.0"
hash = "sha256-…"
build = "build-stories"

The plugin’s answers are kept until a .storybook/main.*, a package.json, pnpm-workspace.yaml or a lockfile changes.