Skip to content

Commit 916dcad

Browse files
authored
chore(web): update storybooks dependencies (#139)
1 parent 7c11dd8 commit 916dcad

258 files changed

Lines changed: 9792 additions & 11766 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

web/.storybook/main.ts

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,34 @@
1-
import { resolve } from "path";
1+
// This file has been automatically migrated to valid ESM format by Storybook.
2+
import { fileURLToPath } from "node:url";
3+
import { resolve, dirname } from "path";
24

35
import type { StorybookConfig } from "@storybook/react-vite";
46
import { mergeConfig } from "vite";
57

8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = dirname(__filename);
10+
611
const config: StorybookConfig = {
712
stories: ["../src/**/*.stories.@(js|ts|tsx|mdx)"],
8-
addons: ["@storybook/addon-essentials", "@storybook/addon-styling"],
13+
addons: [
14+
"@storybook/addon-onboarding",
15+
"@storybook/addon-a11y",
16+
"@storybook/addon-themes",
17+
"@chromatic-com/storybook",
18+
"@storybook/addon-docs",
19+
],
20+
921
framework: {
1022
name: "@storybook/react-vite",
1123
options: {},
1224
},
25+
1326
core: {
1427
disableTelemetry: true,
1528
},
29+
1630
staticDirs: ["./public"],
31+
1732
viteFinal(config, { configType }) {
1833
return mergeConfig(config, {
1934
define: {
@@ -46,7 +61,29 @@ const config: StorybookConfig = {
4661
find: "@reearth/core",
4762
replacement: resolve(__dirname, "..", "node_modules/@reearth/core"),
4863
},
49-
// quickjs-emscripten
64+
// cesium-mvt-imagery-provider: force resolution to the JS bundle, not the .d.ts types file
65+
{
66+
find: "cesium-mvt-imagery-provider",
67+
replacement: resolve(
68+
__dirname,
69+
"..",
70+
"node_modules/cesium-mvt-imagery-provider/dist/cesium-mvt-imagery-provider.mjs",
71+
),
72+
},
73+
// quickjs-emscripten: force resolution to the JS bundle, not the .d.ts types file
74+
{
75+
find: "quickjs-emscripten-sync",
76+
replacement: resolve(
77+
__dirname,
78+
"..",
79+
"node_modules/quickjs-emscripten-sync/dist/quickjs-emscripten-sync.mjs",
80+
),
81+
},
82+
// react-align: force resolution to the JS bundle, not the .d.ts types file
83+
{
84+
find: "react-align",
85+
replacement: resolve(__dirname, "..", "node_modules/react-align/dist/react-align.mjs"),
86+
},
5087
{
5188
find: "@reearth",
5289
replacement: resolve(__dirname, "..", "src"),
@@ -57,6 +94,10 @@ const config: StorybookConfig = {
5794
},
5895
],
5996
},
97+
optimizeDeps: {
98+
include: ["quickjs-emscripten-sync", "prop-types", "hoist-non-react-statics", "react-is"],
99+
exclude: ["react-align"],
100+
},
60101
server: {
61102
watch: {
62103
// https://github.com/storybookjs/storybook/issues/22253#issuecomment-1673229400
@@ -65,8 +106,11 @@ const config: StorybookConfig = {
65106
},
66107
});
67108
},
68-
docs: {
69-
autodocs: true,
109+
110+
docs: {},
111+
112+
typescript: {
113+
reactDocgen: "react-docgen-typescript",
70114
},
71115
};
72-
module.exports = config;
116+
export default config;

web/.storybook/manager.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

web/.storybook/preview.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import {
77
Observable,
88
} from "@apollo/client";
99
import { ThemeProvider } from "@emotion/react";
10-
import { withThemeFromJSXProvider } from "@storybook/addon-styling";
11-
import type { Preview, ReactRenderer } from "@storybook/react";
10+
import { withThemeFromJSXProvider } from "@storybook/addon-themes";
11+
import type { Preview, ReactRenderer } from "@storybook/react-vite";
1212
import React from "react";
1313

1414
import classicDarkTheme from "../src/classic/theme/reearthTheme/darkTheme"; // temp classic imports
@@ -33,18 +33,18 @@ const mockClient = new ApolloClient({
3333
const preview: Preview = {
3434
parameters: {
3535
backgrounds: {
36-
values: [
37-
{ name: "Light", value: "lightGrey" },
38-
{ name: "Dark", value: "ash" },
39-
],
36+
options: {
37+
light: { name: "Light", value: "lightGrey" },
38+
dark: { name: "Dark", value: "ash" },
39+
},
4040
},
4141
layout: "fullscreen",
4242
controls: { expanded: true },
43-
actions: { argTypesRegex: "^on.*" },
4443
docs: {
4544
theme,
4645
},
4746
},
47+
4848
decorators: [
4949
withThemeFromJSXProvider<ReactRenderer>({
5050
themes: {
@@ -73,6 +73,8 @@ const preview: Preview = {
7373
);
7474
},
7575
],
76+
77+
tags: ["autodocs"],
7678
};
7779

7880
export default preview;

web/.storybook/theme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { create } from "@storybook/theming";
1+
import { create } from "storybook/theming";
22

33
export default create({
44
base: "dark",

web/.yarn/install-state.gz

-372 KB
Binary file not shown.

0 commit comments

Comments
 (0)