Initial commit from monorepo
This commit is contained in:
46
.storybook/main.ts
Normal file
46
.storybook/main.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import path from 'node:path'
|
||||
import type { StorybookConfig } from '@storybook/vue3-vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
const config: StorybookConfig = {
|
||||
stories: ['../app/components/**/*.stories.@(js|ts)'],
|
||||
addons: ['@storybook/addon-essentials', '@storybook/addon-interactions'],
|
||||
framework: {
|
||||
name: '@storybook/vue3-vite',
|
||||
options: {}
|
||||
},
|
||||
core: {
|
||||
disableTelemetry: true
|
||||
},
|
||||
docs: {
|
||||
autodocs: false
|
||||
},
|
||||
viteFinal: async (baseConfig) => {
|
||||
const projectRoot = path.resolve(__dirname, '..')
|
||||
baseConfig.resolve = baseConfig.resolve || {}
|
||||
baseConfig.resolve.alias = {
|
||||
...baseConfig.resolve.alias,
|
||||
'~': path.resolve(__dirname, '../app'),
|
||||
'@': path.resolve(__dirname, '../app'),
|
||||
'@graphql-typed-document-node/core': path.resolve(__dirname, './shims/graphql-typed-document-node-core.ts')
|
||||
}
|
||||
baseConfig.plugins = baseConfig.plugins || []
|
||||
baseConfig.plugins.push(vue())
|
||||
baseConfig.root = projectRoot
|
||||
baseConfig.server = {
|
||||
...(baseConfig.server || {}),
|
||||
fs: {
|
||||
...(baseConfig.server?.fs || {}),
|
||||
allow: Array.from(
|
||||
new Set([
|
||||
...(baseConfig.server?.fs?.allow || []),
|
||||
projectRoot
|
||||
])
|
||||
)
|
||||
}
|
||||
}
|
||||
return baseConfig
|
||||
}
|
||||
}
|
||||
|
||||
export default config
|
||||
23
.storybook/preview.ts
Normal file
23
.storybook/preview.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import type { Preview } from '@storybook/vue3'
|
||||
import { setup } from '@storybook/vue3'
|
||||
|
||||
import '../app/assets/css/tailwind.css'
|
||||
|
||||
setup((app) => {
|
||||
app.config.globalProperties.$t = (key: string) => key
|
||||
app.config.globalProperties.$d = (value: any) => value
|
||||
})
|
||||
|
||||
const preview: Preview = {
|
||||
parameters: {
|
||||
actions: { argTypesRegex: '^on[A-Z].*' },
|
||||
controls: {
|
||||
matchers: {
|
||||
color: /(background|color)$/i,
|
||||
date: /Date$/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default preview
|
||||
10
.storybook/shims/graphql-typed-document-node-core.ts
Normal file
10
.storybook/shims/graphql-typed-document-node-core.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
// Minimal runtime shim so Vite/Storybook can resolve generated GraphQL imports.
|
||||
import type { DocumentNode } from 'graphql'
|
||||
|
||||
export type TypedDocumentNode<TResult = any, TVariables = Record<string, any>> = DocumentNode & {
|
||||
__resultType?: TResult
|
||||
__variablesType?: TVariables
|
||||
}
|
||||
|
||||
// Runtime placeholder; generated files import the symbol but do not use the value.
|
||||
export const TypedDocumentNode = {} as unknown as TypedDocumentNode
|
||||
Reference in New Issue
Block a user