@@ -33,7 +33,7 @@ program
3333 )
3434 . option (
3535 '-d, --dir <char>' ,
36- 'Specify the TypeScript code base to be analyzed. if tsconfig.json is not found, specify the directory where tsconfig.json is located .' ,
36+ 'Specifies the root directory of the TypeScript project to analyze. It reads and uses the tsconfig.json file found in this directory .' ,
3737 )
3838 . option (
3939 '--include <char...>' ,
@@ -66,12 +66,13 @@ opt.include = [...program.args, ...(opt.include ?? [])];
6666opt . include = opt . include . length === 0 ? undefined : opt . include ;
6767
6868export async function main (
69- dir : string ,
70- commandOptions : typeof opt & { executedScript : string } ,
69+ commandOptions : OptionValues & { executedScript : string } ,
7170) {
72- setupConfig ( path . join ( dir , commandOptions . configFile ?? '.tsgrc.json' ) ) ;
71+ setupConfig (
72+ path . join ( commandOptions . dir , commandOptions . configFile ?? '.tsgrc.json' ) ,
73+ ) ;
7374
74- const { graph : fullGraph , meta } = createGraph ( dir , commandOptions ) ;
75+ const { graph : fullGraph , meta } = createGraph ( commandOptions ) ;
7576
7677 let couplingData : ReturnType < typeof measureInstability > = [ ] ;
7778 if ( commandOptions . measureInstability ) {
@@ -103,7 +104,5 @@ export async function main(
103104 couplingData ,
104105 ) ;
105106}
106-
107- const dir = path . resolve ( opt . dir ?? './' ) ;
108107const executedScript = `tsg ${ process . argv . slice ( 2 ) . join ( ' ' ) } ` ;
109- main ( dir , { ...opt , executedScript } ) ;
108+ main ( { ...opt , dir : path . resolve ( opt . dir ?? './' ) , executedScript } ) ;
0 commit comments