UNPKG

1.66 kBMarkdownView Raw
1# Storybook CLI
2
3Storybook CLI (_Command Line Interface_) is the easiest way to add [Storybook](https://github.com/storybookjs/storybook) to your project.
4
5![Screenshot](docs/getstorybook.png)
6
7Go to your project and run:
8
9```sh
10cd my-app
11npx -p @storybook/cli sb init
12```
13
14In addition to `init`, the CLI also has other commands:
15
16- `add` - add an addon and register it
17- `info` - print out system information for bug reports
18- `migrate` - run codemods to migrate your code
19
20See the command-line help with `-h` for details.
21
22---
23
24## [Yarn](https://github.com/yarnpkg/yarn) support
25
26The CLI supports yarn. If you have installed yarn in your system and your project has `yarn.lock` file, it'll detect it and use `yarn` instead of `npm`.
27
28If you don't want to use `yarn` always you can use the `--use-npm` option like this:
29
30```sh
31npx -p @storybook/cli sb init --use-npm
32```
33
34---
35
36## [Flow](https://flow.org/) support
37
38It also supports flow files. By default, [jscodeshift](https://github.com/facebook/jscodeshift), the tool used to transform the source files, uses babel to read the files. To be able to transform any flow annotated file, you need to use the flow parser.
39
40```sh
41npx -p @storybook/cli sb init --parser flow
42```
43
44For more information visit: [storybook.js.org](https://storybook.js.org)
45
46---
47
48## Manually specify project type
49
50If the CLI cannot detect your project type, it will ask you. You can also force it to use a particular project type:
51
52```sh
53npx -p @storybook/cli sb init --type <type>
54```
55
56Where type is one of the project types defined in [project_types.js](https://github.com/storybookjs/storybook/blob/next/lib/cli/src/project_types.ts)