11import type { StorybookConfig } from '@storybook/react-vite' ;
22
3- import fs from 'fs' ;
4- import path from 'path' ;
5-
6- import tsconfig from '../tsconfig.json' ;
7-
83const config : StorybookConfig = {
94 stories : [
105 '../docs/stories/**/*.mdx' ,
@@ -29,11 +24,6 @@ const config: StorybookConfig = {
2924 disableTelemetry : true ,
3025 } ,
3126 staticDirs : [ '.' , { from : '../packages/card/src/img' , to : '/static' } ] ,
32- env : ( config ) => {
33- const packageStatuses = getPackageStatusEnvVars ( ) ;
34-
35- return { ...config , ...packageStatuses } ;
36- } ,
3727 async viteFinal ( config ) {
3828 return config ;
3929 } ,
@@ -57,22 +47,4 @@ const config: StorybookConfig = {
5747 } ,
5848} ;
5949
60- const getPackageStatusEnvVars = ( ) => {
61- const paths = tsconfig . compilerOptions . paths ;
62- const statuses : Record < string , string > = { } ;
63-
64- for ( const key of Object . keys ( paths ) ) {
65- const filepath = path . resolve (
66- __dirname ,
67- `.${ paths [ key as keyof typeof paths ] [ 0 ] } /../package.json` ,
68- ) ;
69- const contents = fs . readFileSync ( filepath ) ;
70- const { status } = JSON . parse ( contents . toString ( ) ) ;
71- const statusKey = key . replace ( '@launchpad-ui/' , '' ) . replace ( / - / g, '_' ) . toUpperCase ( ) ;
72- statuses [ `STORYBOOK_PACKAGE_STATUS__${ statusKey } ` ] = status ;
73- }
74-
75- return statuses ;
76- } ;
77-
7850export default config ;
0 commit comments