File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,9 @@ For more info, run any command with the `--help` flag:
3030
3131Options:
3232 --cwd [path] Set fix directory (default: dist)
33- --dts Fix commonjs d.ts files (default: true)
33+ --dts Fix commonjs d.ts and d.cts files (default: true)
3434 -i, --ignore [...files] Ignore files
35+ --silent Suppress logs
3536 -v, --version Display version number
3637 -h, --help Display this message
3738```
Original file line number Diff line number Diff line change 1515 . option ( '--cwd [path]' , 'Set fix directory' , { default : 'dist' } )
1616 . option ( '--dts' , 'Fix commonjs d.ts and d.cts files' , { default : true } )
1717 . option ( '-i, --ignore [...files]' , 'Ignore files' )
18+ . option ( '--silent' , 'Suppress logs' )
1819 . action ( async ( files , options ) => {
19- const { dts } = options ;
20+ const { dts, silent } = options ;
2021 const hasCustomMatchFiles = ! ! files ?. length ;
2122 const currentDir = process . cwd ( ) ;
2223 const cwd = path . resolve ( currentDir , options . cwd ) ;
2930 cwd : hasCustomMatchFiles ? currentDir : cwd ,
3031 ignore,
3132 } ,
33+
34+ silent,
3235 } ) ;
3336
3437 if ( dts ) {
3740 cwd,
3841 ignore,
3942 } ,
43+
44+ silent,
4045 } ) ;
4146 }
4247 } ) ;
Original file line number Diff line number Diff line change @@ -10,10 +10,11 @@ export interface ReflectOptions {
1010 globOptions ?: fg . Options ;
1111 name ?: string ;
1212 reflect ( code : string ) : Promise < ReflectActionResult > | ReflectActionResult ;
13+ silent ?: boolean ;
1314}
1415
1516export const reflect = async ( options : ReflectOptions ) => {
16- const { globOptions = { } , name = 'reflect' , reflect } = options ;
17+ const { globOptions = { } , name = 'reflect' , reflect, silent } = options ;
1718 const cwd = process . cwd ( ) ;
1819
1920 const files = await fg ( options . files , {
@@ -23,7 +24,9 @@ export const reflect = async (options: ReflectOptions) => {
2324 ignore : [ ...( globOptions . ignore || [ ] ) , 'node_modules' ] ,
2425 } ) ;
2526
26- const logger = ( message : string ) => console . log ( `[${ name } ]` , message ) ;
27+ const logger = ( message : string ) => {
28+ if ( ! silent ) console . log ( `[${ name } ]` , message ) ;
29+ } ;
2730
2831 if ( ! files . length ) logger ( gray ( 'No files matched' ) ) ;
2932
You can’t perform that action at this time.
0 commit comments