11import type { Command } from 'commander' ;
22import { colorPalette , commands } from '../../../constants' ;
3- import { FileSystemError , handleError , isVitest , konsola } from '../../../utils' ;
3+ import { FileSystemError , handleError , konsola } from '../../../utils' ;
44import { Spinner } from '@topcli/spinner' ;
55import { type ComponentsData , readComponentsFiles } from '../../components/push/actions' ;
66import type { GenerateTypesOptions } from './constants' ;
@@ -30,18 +30,19 @@ generateCmd
3030 . action ( async ( options : GenerateTypesOptions , command : Command ) => {
3131 konsola . title ( `${ commands . TYPES } ` , colorPalette . TYPES , 'Generating types...' ) ;
3232
33- const { space, path, verbose } = command . optsWithGlobals ( ) ;
33+ const { space, path, verbose, suffix , filename , separateFiles } = command . optsWithGlobals ( ) ;
3434
3535 const spinner = new Spinner ( {
36- verbose : ! isVitest ,
36+ verbose,
3737 } ) ;
3838
3939 try {
4040 spinner . start ( `Generating types...` ) ;
4141 const componentsData = await readComponentsFiles ( {
4242 from : space ,
4343 path,
44- suffix : options . suffix ,
44+ separateFiles,
45+ suffix,
4546 verbose,
4647 } ) ;
4748 // Try to read datasources, but make it optional
@@ -50,7 +51,8 @@ generateCmd
5051 dataSourceData = await readDatasourcesFiles ( {
5152 from : space ,
5253 path,
53- suffix : options . suffix ,
54+ separateFiles,
55+ suffix,
5456 verbose,
5557 } ) ;
5658 }
@@ -75,19 +77,18 @@ generateCmd
7577
7678 const typedefData = await generateTypes ( spaceDataWithComponentsAndDatasources , {
7779 ...options ,
78- path,
7980 } ) ;
8081
8182 if ( typedefData ) {
8283 await saveTypesToComponentsFile ( space , typedefData , {
83- filename : options . filename ,
84+ filename,
8485 path,
85- separateFiles : options . separateFiles ,
86+ separateFiles,
8687 } ) ;
8788 }
8889
8990 spinner . succeed ( ) ;
90- if ( options . separateFiles && options . filename ) {
91+ if ( separateFiles && filename ) {
9192 konsola . warn ( `The --filename option is ignored when using --separate-files` ) ;
9293 }
9394
0 commit comments