This commit is contained in:
Gabriela Araujo Britto committed 2021-10-06 13:38:25 -07:00
1 parent db408cc9c2
commit d7809c1122
2123 files changed
+166183 -20974

No files matched your search

+15 -11
View File
@@ -43,10 +43,10 @@ namespace ts {
}
const path = file.path;
if (fileExtensionIsOneOf(path, supportedTSExtensions)) {
if (fileExtensionIsOneOf(path, supportedTSExtensionsFlat)) {
return "TypeScript";
}
else if (fileExtensionIsOneOf(path, supportedJSExtensions)) {
else if (fileExtensionIsOneOf(path, supportedJSExtensionsFlat)) {
return "JavaScript";
}
else if (fileExtensionIs(path, Extension.Json)) {
@@ -354,7 +354,7 @@ namespace ts {
function printEasyHelp(sys: System, simpleOptions: readonly CommandLineOption[]) {
const colors = createColors(sys);
let output: string[] = [...getHelpHeader(sys)];
let output: string[] = [...getHeader(sys,`${getDiagnosticText(Diagnostics.tsc_Colon_The_TypeScript_Compiler)} - ${getDiagnosticText(Diagnostics.Version_0, version)}`)];
output.push(colors.bold(getDiagnosticText(Diagnostics.COMMON_COMMANDS)) + sys.newLine + sys.newLine);
example("tsc", Diagnostics.Compiles_the_current_project_tsconfig_json_in_the_working_directory);
@@ -388,7 +388,7 @@ namespace ts {
}
function printAllHelp(sys: System, compilerOptions: readonly CommandLineOption[], buildOptions: readonly CommandLineOption[], watchOptions: readonly CommandLineOption[]) {
let output: string[] = [...getHelpHeader(sys)];
let output: string[] = [...getHeader(sys,`${getDiagnosticText(Diagnostics.tsc_Colon_The_TypeScript_Compiler)} - ${getDiagnosticText(Diagnostics.Version_0, version)}`)];
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"))];
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))];
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 {
}
function printBuildHelp(sys: System, buildOptions: readonly CommandLineOption[]) {
let output: string[] = [...getHelpHeader(sys)];
let output: string[] = [...getHeader(sys,`${getDiagnosticText(Diagnostics.tsc_Colon_The_TypeScript_Compiler)} - ${getDiagnosticText(Diagnostics.Version_0, version)}`)];
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"))];
for (const line of output) {
sys.write(line);
}
}
function getHelpHeader(sys: System) {
function getHeader(sys: System, message: string) {
const colors = createColors(sys);
const header: string[] = [];
const tscExplanation = `${getDiagnosticText(Diagnostics.tsc_Colon_The_TypeScript_Compiler)} - ${getDiagnosticText(Diagnostics.Version_0, version)}`;
const terminalWidth = sys.getWidthOfTerminal?.() ?? 0;;
const tsIconLength = 5;
const tsIconFirstLine = colors.blueBackground(padLeft("", tsIconLength));
const tsIconSecondLine = colors.blueBackground(colors.brightWhite(padLeft("TS ", tsIconLength)));
// If we have enough space, print TS icon.
if (terminalWidth >= tscExplanation.length + tsIconLength) {
if (terminalWidth >= message.length + tsIconLength) {
// right align of the icon is 120 at most.
const rightAlign = terminalWidth > 120 ? 120 : terminalWidth;
const leftAlign = rightAlign - tsIconLength;
header.push(padRight(tscExplanation, leftAlign) + tsIconFirstLine + sys.newLine);
header.push(padRight(message, leftAlign) + tsIconFirstLine + sys.newLine);
header.push(padLeft("", leftAlign) + tsIconSecondLine + sys.newLine);
}
else {
header.push(tscExplanation + sys.newLine);
header.push(message + sys.newLine);
header.push(sys.newLine);
}
return header;
@@ -1035,7 +1034,12 @@ namespace ts {
}
else {
sys.writeFile(file, generateTSConfig(options, fileNames, sys.newLine));
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Successfully_created_a_tsconfig_json_file));
const output: string[] = [sys.newLine, ...getHeader(sys,"Created a new tsconfig.json with:")];
output.push(getCompilerOptionsDiffValue(options, sys.newLine) + sys.newLine + sys.newLine);
output.push(`You can learn more at https://aka.ms/tsconfig.json` + sys.newLine);
for (const line of output) {
sys.write(line);
}
}
return;