@storybook/cli 8.3.0-alpha.1 → 8.3.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,49 @@
1
- # Storybook CLI
1
+ # Storybook
2
2
 
3
- This is a wrapper for <https://www.npmjs.com/package/@storybook/cli>
3
+ ## CLI
4
+
5
+ Storybook CLI (_Command Line Interface_) is the easiest way to add [Storybook](https://github.com/storybookjs/storybook) to your project.
6
+
7
+ ![Screenshot](docs/getstorybook.png)
8
+
9
+ Go to your project and run:
10
+
11
+ ```sh
12
+ cd my-app
13
+ npx storybook@latest init
14
+ ```
15
+
16
+ In addition to `init`, the CLI also has other commands:
17
+
18
+ - `add` - add an addon and register it
19
+ - `info` - print out system information for bug reports
20
+ - `upgrade` - upgrade to the latest version of Storybook (or a specific version)
21
+ - `migrate` - run codemods to migrate your code
22
+
23
+ See the command-line help with `-h` (including other useful commands) for details.
24
+
25
+ ## Core APIs
26
+
27
+ This package has multiple sub-exports to can be used to gain access to storybook's APIs.
28
+
29
+ ### `storybook/components`
30
+
31
+ This export contains a list of components very useful for building out addons.
32
+ We recommend addon-authors to use these components to ensure a consistent look and feel, and to reduce the amount of code they need to write.
33
+
34
+ ### `storybook/theming`
35
+
36
+ This export exposes a few utility functions to help writing components that automatically adapt to the current theme.
37
+ Useful for addon authors who want to make their addons theme-aware.
38
+
39
+ ### `storybook/preview-api`
40
+
41
+ This export contains the API that is available in the preview iframe.
42
+
43
+ ### `storybook/manager-api`
44
+
45
+ This export contains the API that is available in the manager iframe.
46
+
47
+ ### `storybook/types`
48
+
49
+ This export exposes a lot of TypeScript interfaces used throughout storybook, including for storybook configuration, addons etc.
package/bin/index.cjs ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+
3
+ const majorNodeVersion = parseInt(process.versions.node, 10);
4
+ if (majorNodeVersion < 18) {
5
+ console.error('To run Storybook you need to have Node.js 18 or higher');
6
+ process.exit(1);
7
+ }
8
+
9
+ // The Storybook CLI has a catch block for all of its commands, but if an error
10
+ // occurs before the command even runs, for instance, if an import fails, then
11
+ // such error will fall under the uncaughtException handler.
12
+ // This is the earliest moment we can catch such errors.
13
+ process.once('uncaughtException', (error) => {
14
+ if (error.message.includes('string-width')) {
15
+ console.error(
16
+ [
17
+ '🔴 Error: It looks like you are having a known issue with package hoisting.',
18
+ 'Please check the following issue for details and solutions: https://github.com/storybookjs/storybook/issues/22431#issuecomment-1630086092\n\n',
19
+ ].join('\n')
20
+ );
21
+ }
22
+
23
+ throw error;
24
+ });
25
+
26
+ require('../dist/bin/index.cjs');