build(component): fix component storybook (#9990)

This commit is contained in:
forehalo
2025-02-06 15:58:10 +00:00
parent 1652e6df6b
commit 2ff31c6274
5 changed files with 9 additions and 5 deletions

View File

@@ -3,7 +3,6 @@ import { StorybookConfig } from '@storybook/react-vite';
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
import swc from 'unplugin-swc';
import { mergeConfig } from 'vite';
import { getBuildConfig } from '@affine-tools/utils/build-config';
export default {
stories: ['../src/ui/**/*.@(mdx|stories.@(js|jsx|ts|tsx))'],
@@ -26,6 +25,9 @@ export default {
docs: {},
async viteFinal(config, _options) {
const { getBuildConfig } = await import('@affine-tools/utils/build-config');
const { Package } = await import('@affine-tools/utils/workspace');
return mergeConfig(config, {
plugins: [
vanillaExtractPlugin(),
@@ -55,12 +57,9 @@ export default {
define: {
'process.env.CAPTCHA_SITE_KEY': `"${process.env.CAPTCHA_SITE_KEY}"`,
...Object.entries(
getBuildConfig({
distribution: 'web',
getBuildConfig(new Package('@affine/web'), {
mode: 'development',
channel: 'canary',
static: false,
coverage: false,
})
).reduce((envs, [key, value]) => {
envs[`BUILD_CONFIG.${key}`] = JSON.stringify(value);

View File

@@ -1,6 +1,7 @@
{
"name": "@affine/component",
"private": true,
"type": "module",
"main": "./src/index.ts",
"exports": {
".": "./src/index.ts",
@@ -64,6 +65,7 @@
"zod": "^3.24.1"
},
"devDependencies": {
"@affine-tools/utils": "workspace:*",
"@blocksuite/affine": "workspace:*",
"@blocksuite/icons": "2.2.2",
"@chromatic-com/storybook": "^3.2.2",

View File

@@ -16,6 +16,7 @@
{ "path": "../electron-api" },
{ "path": "../graphql" },
{ "path": "../i18n" },
{ "path": "../../../tools/utils" },
{ "path": "../../../blocksuite/affine/all" }
]
}

View File

@@ -609,6 +609,7 @@ export const PackageList = [
'packages/frontend/electron-api',
'packages/frontend/graphql',
'packages/frontend/i18n',
'tools/utils',
'blocksuite/affine/all',
],
},

View File

@@ -270,6 +270,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@affine/component@workspace:packages/frontend/component"
dependencies:
"@affine-tools/utils": "workspace:*"
"@affine/debug": "workspace:*"
"@affine/electron-api": "workspace:*"
"@affine/graphql": "workspace:*"