Skip to content

Commit f345a2d

Browse files
committed
[ci] clean up storybook config
1 parent a79bbcc commit f345a2d

File tree

2 files changed

+20
-34
lines changed

2 files changed

+20
-34
lines changed

.storybook/main.ts

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { FileSystemIconLoader } from 'unplugin-icons/loaders'
33
import IconsResolver from 'unplugin-icons/resolver'
44
import Icons from 'unplugin-icons/vite'
55
import Components from 'unplugin-vue-components/vite'
6-
import type { InlineConfig, Plugin } from 'vite'
6+
import type { InlineConfig } from 'vite'
77

88
const config: StorybookConfig = {
99
stories: ['../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
@@ -18,18 +18,21 @@ const config: StorybookConfig = {
1818

1919
// Filter out any plugins that might generate import maps
2020
if (config.plugins) {
21-
config.plugins = (config.plugins as Plugin[]).filter((plugin: Plugin) => {
22-
if (
23-
plugin &&
24-
typeof plugin === 'object' &&
25-
'name' in plugin &&
26-
typeof plugin.name === 'string' &&
27-
plugin.name.includes('import-map')
28-
) {
29-
return false
30-
}
31-
return true
32-
})
21+
config.plugins = config.plugins
22+
// Type guard: ensure we have valid plugin objects with names
23+
.filter(
24+
(plugin): plugin is NonNullable<typeof plugin> & { name: string } => {
25+
return (
26+
plugin !== null &&
27+
plugin !== undefined &&
28+
typeof plugin === 'object' &&
29+
'name' in plugin &&
30+
typeof plugin.name === 'string'
31+
)
32+
}
33+
)
34+
// Business logic: filter out import-map plugins
35+
.filter((plugin) => !plugin.name.includes('import-map'))
3336
}
3437

3538
return mergeConfig(config, {

.storybook/preview.ts

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ import ConfirmationService from 'primevue/confirmationservice'
99
import ToastService from 'primevue/toastservice'
1010
import Tooltip from 'primevue/tooltip'
1111

12-
import '../src/assets/css/style.css'
13-
import GlobalDialog from '../src/components/dialog/GlobalDialog.vue'
14-
import { i18n } from '../src/i18n'
15-
import '../src/lib/litegraph/public/css/litegraph.css'
12+
import '@/assets/css/style.css'
13+
import { i18n } from '@/i18n'
14+
import '@/lib/litegraph/public/css/litegraph.css'
1615

1716
const ComfyUIPreset = definePreset(Aura, {
1817
semantic: {
@@ -29,10 +28,6 @@ setup((app) => {
2928
const pinia = createPinia()
3029

3130
app.use(pinia)
32-
33-
// Register global components for dialogs
34-
app.component('GlobalDialog', GlobalDialog)
35-
3631
app.use(i18n)
3732
app.use(PrimeVue, {
3833
theme: {
@@ -64,19 +59,7 @@ export const withTheme = (Story: StoryFn, context: StoryContext) => {
6459
document.body.classList.remove('dark-theme')
6560
}
6661

67-
// Return story with GlobalDialog included
68-
return {
69-
components: { GlobalDialog },
70-
setup() {
71-
return { storyResult: Story(context.args, context) }
72-
},
73-
template: `
74-
<div>
75-
<component :is="storyResult" />
76-
<GlobalDialog />
77-
</div>
78-
`
79-
}
62+
return Story(context.args, context)
8063
}
8164

8265
const preview: Preview = {

0 commit comments

Comments
 (0)