Skip to content

Commit c7081aa

Browse files
committed
feat: add storybook
1 parent 8c4f441 commit c7081aa

12 files changed

+38414
-1099
lines changed

.storybook/.babelrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["@babel/preset-env", "@babel/preset-typescript"]
3+
}

.storybook/main.ts

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import type { StorybookConfig } from "@storybook/react-webpack5";
2+
const config: StorybookConfig = {
3+
stories: ["../src/**/*.stories.@(js|jsx|ts|tsx)"],
4+
addons: [
5+
"@storybook/preset-typescript",
6+
"@storybook/addon-links",
7+
"@storybook/addon-essentials",
8+
"@storybook/addon-interactions",
9+
],
10+
framework: {
11+
name: "@storybook/react-webpack5",
12+
options: {},
13+
},
14+
docs: {
15+
autodocs: "tag",
16+
},
17+
typescript: {
18+
check: false,
19+
checkOptions: {},
20+
reactDocgen: "react-docgen-typescript",
21+
reactDocgenTypescriptOptions: {
22+
shouldExtractLiteralValuesFromEnum: true,
23+
propFilter: (prop) =>
24+
prop.parent ? !/node_modules/.test(prop.parent.fileName) : true,
25+
},
26+
},
27+
};
28+
export default config;

.storybook/presets.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = ["@storybook/preset-typescript"];

.storybook/preview.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import React from "react";
2+
import { ChakraProvider } from "@chakra-ui/react";
3+
4+
export const parameters = {
5+
backgrounds: {
6+
default: "light",
7+
},
8+
actions: { argTypesRegex: "^on[A-Z].*" },
9+
controls: {
10+
matchers: {
11+
color: /(background|color)$/i,
12+
date: /Date$/,
13+
},
14+
},
15+
};
16+
17+
export const decorators = [
18+
(Story) => {
19+
return (
20+
<ChakraProvider>
21+
<Story />
22+
</ChakraProvider>
23+
);
24+
},
25+
];

migration-storybook.log

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
🔎 checking possible migrations..
2+
3+
attention => Storybook now collects completely anonymous telemetry regarding usage.
4+
This information is used to shape Storybook's roadmap and prioritize features.
5+
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
6+
https://storybook.js.org/telemetry
7+
8+
9+
🔎 found a 'mdx1to2' migration:
10+
╭ Automigration detected ──────────────────────────────────────────────────────────────────────────────────────────╮
11+
│ │
12+
│ We've found 32 '.stories.mdx' files in your project. │
13+
│ │
14+
│ Storybook has upgraded to MDX2 (https://mdxjs.com/blog/v2/), which contains breaking changes from MDX1. │
15+
│ We can try to automatically upgrade your MDX files to MDX2 format using some common patterns. │
16+
│ │
17+
│ After this install completes, and before you start Storybook, we strongly recommend reading the MDX2 section │
18+
│ of the 7.0 migration guide. It contains useful tools for detecting and fixing any remaining issues. │
19+
│ │
20+
│ https://storybook.js.org/migration-guides/7.0 │
21+
│ │
22+
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
23+
? Do you want to run the 'mdx1to2' migration on your project? › (Y/n)✔ Do you want to run the 'mdx1to2' migration on your project? … yes
24+
🆗 Unmodified react-mdx.stories.mdx
25+
🆗 Unmodified react-mdx.stories.mdx
26+
🆗 Unmodified react-mdx.stories.mdx
27+
🆗 Unmodified react-mdx.stories.mdx
28+
🆗 Unmodified react-mdx.stories.mdx
29+
🆗 Unmodified react-mdx.stories.mdx
30+
🆗 Unmodified react-mdx.stories.mdx
31+
🆗 Unmodified react-mdx.stories.mdx
32+
🆗 Unmodified react-mdx.stories.mdx
33+
🆗 Unmodified react-mdx.stories.mdx
34+
🆗 Unmodified react-mdx.stories.mdx
35+
🆗 Unmodified react-mdx.stories.mdx
36+
🆗 Unmodified react-mdx.stories.mdx
37+
🆗 Unmodified react-mdx.stories.mdx
38+
🆗 Unmodified react-mdx.stories.mdx
39+
🆗 Unmodified react-mdx.stories.mdx
40+
🆗 Unmodified react-mdx.stories.mdx
41+
🆗 Unmodified react-mdx.stories.mdx
42+
🆗 Unmodified react-mdx.stories.mdx
43+
🆗 Unmodified react-mdx.stories.mdx
44+
🆗 Unmodified react-mdx.stories.mdx
45+
🆗 Unmodified react-mdx.stories.mdx
46+
🆗 Unmodified react-mdx.stories.mdx
47+
🆗 Unmodified react-mdx.stories.mdx
48+
🆗 Unmodified react-mdx.stories.mdx
49+
🆗 Unmodified react-mdx.stories.mdx
50+
🆗 Unmodified react-mdx.stories.mdx
51+
🆗 Unmodified react-mdx.stories.mdx
52+
🆗 Unmodified react-mdx.stories.mdx
53+
🆗 Unmodified react-mdx.stories.mdx
54+
🆗 Unmodified react-mdx.stories.mdx
55+
🆗 Unmodified react-mdx.stories.mdx
56+
✅ ran mdx1to2 migration
57+
58+
⚠️ failed to check fix missing-babelrc
59+
60+
Error: Cannot find module '/Users/wito/code/keat/node_modules/semver/index.js'. Please verify that the package.json has a valid "main" entry
61+
at tryPackage (node:internal/modules/cjs/loader:353:19)
62+
at Function.Module._findPath (node:internal/modules/cjs/loader:566:18)
63+
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
64+
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
65+
at Module.require (node:internal/modules/cjs/loader:1005:19)
66+
at require (node:internal/modules/cjs/helpers:102:18)
67+
at Object.<anonymous> (/Users/wito/code/keat/node_modules/@babel/helper-compilation-targets/lib/utils.js:12:15)
68+
at Module._compile (node:internal/modules/cjs/loader:1105:14)
69+
at Module._compile (/Users/wito/code/keat/node_modules/esbuild-register/dist/node.js:2258:26)
70+
at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
71+
72+
╭ Migration check ran with failures ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
73+
│ │
74+
│ │
75+
│ Successful migrations: │
76+
│ │
77+
│ mdx1to2 │
78+
│ │
79+
│ Failed migrations: │
80+
│ │
81+
│ missing-babelrc: │
82+
│ Cannot find module '/Users/wito/code/keat/node_modules/semver/index.js'. Please verify that the package.json has a valid "main" entry │
83+
│ │
84+
│ │
85+
│ You can find the full logs in /Users/wito/code/keat/migration-storybook.log │
86+
│ │
87+
│ ───────────────────────────────────────────────── │
88+
│ │
89+
│ If you'd like to run the migrations again, you can do so by running 'npx storybook@next automigrate' │
90+
│ │
91+
│ The automigrations try to migrate common patterns in your project, but might not contain everything needed to migrate to the latest version of Storybook. │
92+
│ │
93+
│ Please check the changelog and migration guide for manual migrations and more information: https://storybook.js.org/migration-guides/7.0 │
94+
│ And reach out on Discord if you need help: https://discord.gg/storybook │
95+
│ │
96+
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
97+

0 commit comments

Comments
 (0)