mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-18 14:56:59 +08:00
build(component): fix component storybook (#9990)
This commit is contained in:
@@ -3,7 +3,6 @@ import { StorybookConfig } from '@storybook/react-vite';
|
|||||||
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
|
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
|
||||||
import swc from 'unplugin-swc';
|
import swc from 'unplugin-swc';
|
||||||
import { mergeConfig } from 'vite';
|
import { mergeConfig } from 'vite';
|
||||||
import { getBuildConfig } from '@affine-tools/utils/build-config';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
stories: ['../src/ui/**/*.@(mdx|stories.@(js|jsx|ts|tsx))'],
|
stories: ['../src/ui/**/*.@(mdx|stories.@(js|jsx|ts|tsx))'],
|
||||||
@@ -26,6 +25,9 @@ export default {
|
|||||||
docs: {},
|
docs: {},
|
||||||
|
|
||||||
async viteFinal(config, _options) {
|
async viteFinal(config, _options) {
|
||||||
|
const { getBuildConfig } = await import('@affine-tools/utils/build-config');
|
||||||
|
const { Package } = await import('@affine-tools/utils/workspace');
|
||||||
|
|
||||||
return mergeConfig(config, {
|
return mergeConfig(config, {
|
||||||
plugins: [
|
plugins: [
|
||||||
vanillaExtractPlugin(),
|
vanillaExtractPlugin(),
|
||||||
@@ -55,12 +57,9 @@ export default {
|
|||||||
define: {
|
define: {
|
||||||
'process.env.CAPTCHA_SITE_KEY': `"${process.env.CAPTCHA_SITE_KEY}"`,
|
'process.env.CAPTCHA_SITE_KEY': `"${process.env.CAPTCHA_SITE_KEY}"`,
|
||||||
...Object.entries(
|
...Object.entries(
|
||||||
getBuildConfig({
|
getBuildConfig(new Package('@affine/web'), {
|
||||||
distribution: 'web',
|
|
||||||
mode: 'development',
|
mode: 'development',
|
||||||
channel: 'canary',
|
channel: 'canary',
|
||||||
static: false,
|
|
||||||
coverage: false,
|
|
||||||
})
|
})
|
||||||
).reduce((envs, [key, value]) => {
|
).reduce((envs, [key, value]) => {
|
||||||
envs[`BUILD_CONFIG.${key}`] = JSON.stringify(value);
|
envs[`BUILD_CONFIG.${key}`] = JSON.stringify(value);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@affine/component",
|
"name": "@affine/component",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
"main": "./src/index.ts",
|
"main": "./src/index.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./src/index.ts",
|
".": "./src/index.ts",
|
||||||
@@ -64,6 +65,7 @@
|
|||||||
"zod": "^3.24.1"
|
"zod": "^3.24.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@affine-tools/utils": "workspace:*",
|
||||||
"@blocksuite/affine": "workspace:*",
|
"@blocksuite/affine": "workspace:*",
|
||||||
"@blocksuite/icons": "2.2.2",
|
"@blocksuite/icons": "2.2.2",
|
||||||
"@chromatic-com/storybook": "^3.2.2",
|
"@chromatic-com/storybook": "^3.2.2",
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
{ "path": "../electron-api" },
|
{ "path": "../electron-api" },
|
||||||
{ "path": "../graphql" },
|
{ "path": "../graphql" },
|
||||||
{ "path": "../i18n" },
|
{ "path": "../i18n" },
|
||||||
|
{ "path": "../../../tools/utils" },
|
||||||
{ "path": "../../../blocksuite/affine/all" }
|
{ "path": "../../../blocksuite/affine/all" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -609,6 +609,7 @@ export const PackageList = [
|
|||||||
'packages/frontend/electron-api',
|
'packages/frontend/electron-api',
|
||||||
'packages/frontend/graphql',
|
'packages/frontend/graphql',
|
||||||
'packages/frontend/i18n',
|
'packages/frontend/i18n',
|
||||||
|
'tools/utils',
|
||||||
'blocksuite/affine/all',
|
'blocksuite/affine/all',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -270,6 +270,7 @@ __metadata:
|
|||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@affine/component@workspace:packages/frontend/component"
|
resolution: "@affine/component@workspace:packages/frontend/component"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
"@affine-tools/utils": "workspace:*"
|
||||||
"@affine/debug": "workspace:*"
|
"@affine/debug": "workspace:*"
|
||||||
"@affine/electron-api": "workspace:*"
|
"@affine/electron-api": "workspace:*"
|
||||||
"@affine/graphql": "workspace:*"
|
"@affine/graphql": "workspace:*"
|
||||||
|
|||||||
Reference in New Issue
Block a user