2024-05-25 02:44:41 +02:00
|
|
|
import type { StorybookConfig } from "@storybook/react-vite";
|
2024-06-14 08:19:32 +02:00
|
|
|
import type { ElectronViteConfig } from "electron-vite";
|
2024-06-14 08:03:57 +02:00
|
|
|
import type { UserConfig } from "vite";
|
2024-05-25 02:44:41 +02:00
|
|
|
|
|
|
|
const config: StorybookConfig = {
|
2024-06-04 22:05:44 +02:00
|
|
|
stories: ["../frontend/**/*.mdx", "../frontend/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
|
|
|
|
2024-05-28 21:12:28 +02:00
|
|
|
addons: [
|
|
|
|
"@storybook/addon-links",
|
|
|
|
"@storybook/addon-essentials",
|
|
|
|
"@chromatic-com/storybook",
|
|
|
|
"@storybook/addon-interactions",
|
2024-09-27 03:58:25 +02:00
|
|
|
"storybook-dark-mode",
|
|
|
|
"./custom-addons/theme/register",
|
2024-05-28 21:12:28 +02:00
|
|
|
],
|
2024-06-04 22:05:44 +02:00
|
|
|
|
2024-06-26 21:22:27 +02:00
|
|
|
core: {},
|
2024-06-04 22:05:44 +02:00
|
|
|
|
2024-05-28 21:12:28 +02:00
|
|
|
framework: {
|
|
|
|
name: "@storybook/react-vite",
|
|
|
|
options: {},
|
|
|
|
},
|
2024-06-04 22:05:44 +02:00
|
|
|
|
|
|
|
docs: {},
|
|
|
|
|
|
|
|
typescript: {
|
|
|
|
reactDocgen: "react-docgen-typescript",
|
|
|
|
},
|
2024-06-14 04:46:31 +02:00
|
|
|
|
2024-06-14 08:03:57 +02:00
|
|
|
async viteFinal(config) {
|
|
|
|
const { mergeConfig } = await import("vite");
|
|
|
|
const { tsImport } = await import("tsx/esm/api");
|
2024-06-14 08:19:32 +02:00
|
|
|
const electronViteConfig = (await tsImport("../electron.vite.config.ts", import.meta.url))
|
|
|
|
.default as ElectronViteConfig;
|
2024-09-27 00:37:33 +02:00
|
|
|
const mergedConfig = mergeConfig(config, electronViteConfig.renderer as UserConfig);
|
|
|
|
mergedConfig.build.outDir = "storybook-static";
|
|
|
|
return mergedConfig;
|
2024-06-14 04:46:31 +02:00
|
|
|
},
|
2024-09-27 00:21:42 +02:00
|
|
|
|
2024-11-06 21:24:53 +01:00
|
|
|
staticDirs: [
|
|
|
|
{ from: "../assets", to: "/assets" },
|
|
|
|
{ from: "../public/fontawesome", to: "/fontawesome" },
|
|
|
|
],
|
2024-11-06 20:47:46 +01:00
|
|
|
managerHead: (head) => `
|
|
|
|
${head}
|
2024-11-06 20:56:49 +01:00
|
|
|
<link rel="shortcut icon" href="./assets/waveterm-logo-with-bg.ico" />
|
|
|
|
<link rel="icon" type="image/png" href="./assets/waveterm-logo-with-bg.png" sizes="250x250" />
|
2024-11-06 20:47:46 +01:00
|
|
|
<style>
|
|
|
|
.sidebar-header img {
|
|
|
|
max-width: 150px !important;
|
|
|
|
max-height: 100px !important;
|
|
|
|
}
|
2024-11-06 20:56:49 +01:00
|
|
|
</style>`,
|
2024-11-06 21:24:53 +01:00
|
|
|
previewHead: (head) => `
|
|
|
|
${head}
|
|
|
|
<link rel="stylesheet" href="./fontawesome/css/fontawesome.min.css" />
|
|
|
|
<link rel="stylesheet" href="./fontawesome/css/brands.min.css" />
|
|
|
|
<link rel="stylesheet" href="./fontawesome/css/solid.min.css" />
|
|
|
|
<link rel="stylesheet" href="./fontawesome/css/sharp-solid.min.css" />
|
|
|
|
<link rel="stylesheet" href="./fontawesome/css/sharp-regular.min.css" />
|
|
|
|
<style>
|
|
|
|
#storybook-docs {
|
|
|
|
[id^="anchor--"],
|
|
|
|
#stories {
|
|
|
|
a {
|
|
|
|
margin-left: -24px !important;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
body {
|
|
|
|
background-color: #ffffff !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
html.dark {
|
|
|
|
body {
|
|
|
|
background-color: #222222 !important;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>`,
|
2024-05-25 02:44:41 +02:00
|
|
|
};
|
|
|
|
export default config;
|