Skip to content

Commit

Permalink
feat: support additional launch strategies
Browse files Browse the repository at this point in the history
Add support for new launch strategies for launching a Storybook
developer server. This allows the server to be launched via direct
invocation (`storybook` for Storybook 7 or `start-storybook` for
Storybook 6), npm script, VS Code task, or custom script.

The existing settings for configuring the `start-storybook` binary path
and arguments are deprecated in favor of new options.

Fixes #571
Fixes #605
  • Loading branch information
joshbolduc committed Feb 20, 2023
1 parent c7a900d commit 4b13fd9
Show file tree
Hide file tree
Showing 31 changed files with 1,060 additions and 357 deletions.
68 changes: 67 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,18 @@ Controls when to automatically start a Storybook development server. This settin

### `storyExplorer.server.internal.commandLineArgs`

⚠️ _**Deprecated:** This option has been replaced with [`storyExplorer.server.internal.startStorybook.args`](#storyexplorerserverinternalstartstorybookargs). If you used this option to run a script other than `start-storybook`, consider switching to a different launch strategy._

Array of command line arguments to pass to the `start-storybook` script.

### `storyExplorer.server.internal.custom.args`

Array of command line arguments to pass to the custom script. Only used when [`storyExplorer.server.internal.launchStrategy`](#storyexplorerserverinternallaunchstrategy) is set to `custom` or `detect`.

### `storyExplorer.server.internal.custom.path`

Path to a custom script used to start the Storybook development server. Only used when [`storyExplorer.server.internal.launchStrategy`](#storyexplorerserverinternallaunchstrategy) is set to `custom` or `detect`.

### `storyExplorer.server.internal.enabled`

Controls whether to enable the internal Storybook development server. When unchecked, you will have to run the server externally.
Expand All @@ -75,9 +85,65 @@ Controls whether to enable the internal Storybook development server. When unche

Object with environment variables that will be added to the Storybook server process.

### `storyExplorer.server.internal.launchStrategy`

The method to use to launch the Storybook development server.

### Options

- `detect`: Detect automatically

- `npm`: Run an npm script

- `storybook`: Run `storybook dev` directly, for use with Storybook 7

- `start-storybook`: Run `start-storybook` directly, for use with Storybook 6

- `task`: Run a VS Code task

- `custom`: Run a custom command

### `storyExplorer.server.internal.npm.args`

Array of command line arguments to pass to the npm script when launching a development server. Only used when [`storyExplorer.server.internal.launchStrategy`](#storyexplorerserverinternallaunchstrategy) is set to `storybook` or `detect`.

### `storyExplorer.server.internal.npm.dir`

Optional path to the directory containing the `package.json` file with the npm script to use. If your workspace contains multiple `package.json` files with the same script name, you can set this to specify which one to use. Only used when [`storyExplorer.server.internal.launchStrategy`](#storyexplorerserverinternallaunchstrategy) is set to `npm` or `detect`.

### `storyExplorer.server.internal.npm.script`

Name of the npm script to use to launch the Storybook development server. Defaults to `storybook`. Only used when [`storyExplorer.server.internal.launchStrategy`](#storyexplorerserverinternallaunchstrategy) is set to `npm` or `detect`.

### `storyExplorer.server.internal.startStorybook.args`

Array of command line arguments to pass to the `start-storybook` script. Only used when [`storyExplorer.server.internal.launchStrategy`](#storyexplorerserverinternallaunchstrategy) is set to `start-storybook` or `detect`.

### `storyExplorer.server.internal.startStorybook.path`

Path to the `start-storybook` script used to start the Storybook 6 development server. By default, Story Explorer will attempt to auto-detect the path inside `node_modules`. Only used when [`storyExplorer.server.internal.launchStrategy`](#storyexplorerserverinternallaunchstrategy) is set to `start-storybook` or `detect`.

### `storyExplorer.server.internal.storybook.args`

Array of command line arguments to pass to the `storybook` CLI when launching a development server. The `dev` argument is always included. Only used when [`storyExplorer.server.internal.launchStrategy`](#storyexplorerserverinternallaunchstrategy) is set to `storybook` or `detect`.

### `storyExplorer.server.internal.storybook.path`

Path to the `storybook` CLI used to start the Storybook 7 development server. By default, Story Explorer will attempt to auto-detect the path inside `node_modules`. Only used when [`storyExplorer.server.internal.launchStrategy`](#storyexplorerserverinternallaunchstrategy) is set to `storybook` or `detect`.

### `storyExplorer.server.internal.storybookBinaryPath`

Path to the `start-storybook` script used to start a Storybook development server. By default, Story Explorer will attempt to auto-detect the script inside `node_modules`.
⚠️ _**Deprecated:** This option has been replaced with [`storyExplorer.server.internal.startStorybook.path`](#storyexplorerserverinternalstartstorybookpath). If you used this option to run a script other than `start-storybook`, consider switching to a different launch strategy._

Path to the `start-storybook` script used to start the Storybook development server. By default, Story Explorer will attempt to auto-detect the path inside `node_modules`.

### `storyExplorer.server.internal.task.label`

Label of the task to run to launch the Storybook development server. Only used when [`storyExplorer.server.internal.launchStrategy`](#storyexplorerserverinternallaunchstrategy) is set to `task` or `detect`.

### `storyExplorer.server.internal.task.type`

Optional type of the task to run to launch the Storybook development server. Only used when [`storyExplorer.server.internal.launchStrategy`](#storyexplorerserverinternallaunchstrategy) is set to `task` or `detect`.

### `storyExplorer.storiesGlobs`

Expand Down
167 changes: 57 additions & 110 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4b13fd9

Please sign in to comment.