@@ -10,6 +10,19 @@ import * as ts from "typescript";
1010import { formatErrorMessage } from "../src/infra/errors.ts" ;
1111import { resolveWindowsTaskkillPath } from "./lib/windows-taskkill.mjs" ;
1212
13+ const { formatGeneratedModule } = ( await import (
14+ new URL ( "./lib/format-generated-module.mjs" , import . meta. url ) . href
15+ ) ) as {
16+ formatGeneratedModule : (
17+ source : string ,
18+ options : {
19+ errorLabel : string ;
20+ outputPath : string ;
21+ repoRoot : string ;
22+ } ,
23+ ) => string ;
24+ } ;
25+
1326interface TranslationMap {
1427 [ key : string ] : string | TranslationMap ;
1528}
@@ -1222,18 +1235,12 @@ export async function runProcess(
12221235}
12231236
12241237async function formatGeneratedTypeScript ( filePath : string , source : string ) : Promise < string > {
1225- const directFormatterPath = path . join ( ROOT , "node_modules" , ".bin" , "oxfmt" ) ;
1226- const formatterCommand =
1227- process . platform !== "win32" && existsSync ( directFormatterPath ) ? directFormatterPath : "pnpm" ;
1228- const formatterArgs =
1229- formatterCommand === directFormatterPath
1230- ? [ "--stdin-filepath" , path . relative ( ROOT , filePath ) ]
1231- : [ "exec" , "oxfmt" , "--stdin-filepath" , path . relative ( ROOT , filePath ) ] ;
1232- const result = await runProcess ( formatterCommand , formatterArgs , {
1233- input : source ,
1234- rejectOnFailure : true ,
1238+ const formatted = formatGeneratedModule ( source , {
1239+ errorLabel : "control ui locale" ,
1240+ outputPath : filePath ,
1241+ repoRoot : ROOT ,
12351242 } ) ;
1236- return restoreReplacementCorruptedStringLiterals ( source , result . stdout ) ;
1243+ return restoreReplacementCorruptedStringLiterals ( source , formatted ) ;
12371244}
12381245
12391246function restoreReplacementCorruptedStringLiterals ( source : string , formatted : string ) : string {
0 commit comments