1 | # Storybook CLI
|
2 |
|
3 | Storybook 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 |
|
7 | Go to your project and run:
|
8 |
|
9 | ```sh
|
10 | cd my-app
|
11 | npx -p @storybook/cli sb init
|
12 | ```
|
13 |
|
14 | In 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 |
|
20 | See the command-line help with `-h` for details.
|
21 |
|
22 | ---
|
23 |
|
24 | ## [Yarn](https://github.com/yarnpkg/yarn) support
|
25 |
|
26 | The 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 |
|
28 | If you don't want to use `yarn` always you can use the `--use-npm` option like this:
|
29 |
|
30 | ```sh
|
31 | npx -p @storybook/cli sb init --use-npm
|
32 | ```
|
33 |
|
34 | ---
|
35 |
|
36 | ## [Flow](https://flow.org/) support
|
37 |
|
38 | It 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
|
41 | npx -p @storybook/cli sb init --parser flow
|
42 | ```
|
43 |
|
44 | For more information visit: [storybook.js.org](https://storybook.js.org)
|
45 |
|
46 | ---
|
47 |
|
48 | ## Manually specify project type
|
49 |
|
50 | If 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
|
53 | npx -p @storybook/cli sb init --type <type>
|
54 | ```
|
55 |
|
56 | Where 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)
|