(sys System, locale locale.Locale, reportDiagnostic DiagnosticReporter, options *collections.OrderedMap[string, any])
| 17 | ) |
| 18 | |
| 19 | func WriteConfigFile(sys System, locale locale.Locale, reportDiagnostic DiagnosticReporter, options *collections.OrderedMap[string, any]) { |
| 20 | getCurrentDirectory := sys.GetCurrentDirectory() |
| 21 | file := tspath.NormalizePath(tspath.CombinePaths(getCurrentDirectory, "tsconfig.json")) |
| 22 | if sys.FS().FileExists(file) { |
| 23 | reportDiagnostic(ast.NewCompilerDiagnostic(diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file)) |
| 24 | } else { |
| 25 | _ = sys.FS().WriteFile(file, generateTSConfig(options, locale)) |
| 26 | output := []string{"\n"} |
| 27 | output = append(output, getHeader(sys, "Created a new tsconfig.json")...) |
| 28 | output = append(output, "You can learn more at https://aka.ms/tsconfig", "\n") |
| 29 | fmt.Fprint(sys.Writer(), strings.Join(output, "")) |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | func generateTSConfig(options *collections.OrderedMap[string, any], locale locale.Locale) string { |
| 34 | const tab = " " |
no test coverage detected