@@ -354,7 +354,7 @@ namespace ts {
354354
355355 function printEasyHelp ( sys : System , simpleOptions : readonly CommandLineOption [ ] ) {
356356 const colors = createColors ( sys ) ;
357- let output : string [ ] = [ ...getHelpHeader ( sys ) ] ;
357+ let output : string [ ] = [ ...getHeader ( sys , ` ${ getDiagnosticText ( Diagnostics . tsc_Colon_The_TypeScript_Compiler ) } - ${ getDiagnosticText ( Diagnostics . Version_0 , version ) } ` ) ] ;
358358 output . push ( colors . bold ( getDiagnosticText ( Diagnostics . COMMON_COMMANDS ) ) + sys . newLine + sys . newLine ) ;
359359
360360 example ( "tsc" , Diagnostics . Compiles_the_current_project_tsconfig_json_in_the_working_directory ) ;
@@ -388,7 +388,7 @@ namespace ts {
388388 }
389389
390390 function printAllHelp ( sys : System , compilerOptions : readonly CommandLineOption [ ] , buildOptions : readonly CommandLineOption [ ] , watchOptions : readonly CommandLineOption [ ] ) {
391- let output : string [ ] = [ ...getHelpHeader ( sys ) ] ;
391+ let output : string [ ] = [ ...getHeader ( sys , ` ${ getDiagnosticText ( Diagnostics . tsc_Colon_The_TypeScript_Compiler ) } - ${ getDiagnosticText ( Diagnostics . Version_0 , version ) } ` ) ] ;
392392 output = [ ...output , ...generateSectionOptionsOutput ( sys , getDiagnosticText ( Diagnostics . ALL_COMPILER_OPTIONS ) , compilerOptions , /*subCategory*/ true , /* beforeOptionsDescription */ undefined , formatMessage ( /*_dummy*/ undefined , Diagnostics . You_can_learn_about_all_of_the_compiler_options_at_0 , "https://aka.ms/tsconfig-reference" ) ) ] ;
393393 output = [ ...output , ...generateSectionOptionsOutput ( sys , getDiagnosticText ( Diagnostics . WATCH_OPTIONS ) , watchOptions , /*subCategory*/ false , getDiagnosticText ( Diagnostics . Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon ) ) ] ;
394394 output = [ ...output , ...generateSectionOptionsOutput ( sys , getDiagnosticText ( Diagnostics . BUILD_OPTIONS ) , buildOptions , /*subCategory*/ false , formatMessage ( /*_dummy*/ undefined , Diagnostics . Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0 , "https://aka.ms/tsc-composite-builds" ) ) ] ;
@@ -398,32 +398,31 @@ namespace ts {
398398 }
399399
400400 function printBuildHelp ( sys : System , buildOptions : readonly CommandLineOption [ ] ) {
401- let output : string [ ] = [ ...getHelpHeader ( sys ) ] ;
401+ let output : string [ ] = [ ...getHeader ( sys , ` ${ getDiagnosticText ( Diagnostics . tsc_Colon_The_TypeScript_Compiler ) } - ${ getDiagnosticText ( Diagnostics . Version_0 , version ) } ` ) ] ;
402402 output = [ ...output , ...generateSectionOptionsOutput ( sys , getDiagnosticText ( Diagnostics . BUILD_OPTIONS ) , buildOptions , /*subCategory*/ false , formatMessage ( /*_dummy*/ undefined , Diagnostics . Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0 , "https://aka.ms/tsc-composite-builds" ) ) ] ;
403403 for ( const line of output ) {
404404 sys . write ( line ) ;
405405 }
406406 }
407407
408- function getHelpHeader ( sys : System ) {
408+ function getHeader ( sys : System , message : string ) {
409409 const colors = createColors ( sys ) ;
410410 const header : string [ ] = [ ] ;
411- const tscExplanation = `${ getDiagnosticText ( Diagnostics . tsc_Colon_The_TypeScript_Compiler ) } - ${ getDiagnosticText ( Diagnostics . Version_0 , version ) } ` ;
412411 const terminalWidth = sys . getWidthOfTerminal ?.( ) ?? 0 ; ;
413412 const tsIconLength = 5 ;
414413
415414 const tsIconFirstLine = colors . blueBackground ( padLeft ( "" , tsIconLength ) ) ;
416415 const tsIconSecondLine = colors . blueBackground ( colors . brightWhite ( padLeft ( "TS " , tsIconLength ) ) ) ;
417416 // If we have enough space, print TS icon.
418- if ( terminalWidth >= tscExplanation . length + tsIconLength ) {
417+ if ( terminalWidth >= message . length + tsIconLength ) {
419418 // right align of the icon is 120 at most.
420419 const rightAlign = terminalWidth > 120 ? 120 : terminalWidth ;
421420 const leftAlign = rightAlign - tsIconLength ;
422- header . push ( padRight ( tscExplanation , leftAlign ) + tsIconFirstLine + sys . newLine ) ;
421+ header . push ( padRight ( message , leftAlign ) + tsIconFirstLine + sys . newLine ) ;
423422 header . push ( padLeft ( "" , leftAlign ) + tsIconSecondLine + sys . newLine ) ;
424423 }
425424 else {
426- header . push ( tscExplanation + sys . newLine ) ;
425+ header . push ( message + sys . newLine ) ;
427426 header . push ( sys . newLine ) ;
428427 }
429428 return header ;
@@ -1035,7 +1034,12 @@ namespace ts {
10351034 }
10361035 else {
10371036 sys . writeFile ( file , generateTSConfig ( options , fileNames , sys . newLine ) ) ;
1038- reportDiagnostic ( createCompilerDiagnostic ( Diagnostics . Successfully_created_a_tsconfig_json_file ) ) ;
1037+ const output : string [ ] = [ sys . newLine , ...getHeader ( sys , "Created a new tsconfig.json with:" ) ] ;
1038+ output . push ( getCompilerOptionsDiffValue ( options , sys . newLine ) + sys . newLine + sys . newLine ) ;
1039+ output . push ( `You can learn more at https://aka.ms/tsconfig.json` + sys . newLine ) ;
1040+ for ( const line of output ) {
1041+ sys . write ( line ) ;
1042+ }
10391043 }
10401044
10411045 return ;
0 commit comments