tons of code

This commit is contained in:
Egor Aristov 2025-10-25 14:34:15 +03:00
parent de8c9aedf7
commit ab294a0355
Signed by: egor3f
GPG Key ID: 40482A264AAEC85F
4 changed files with 5 additions and 5 deletions

View File

@ -1,5 +1,4 @@
import { ParentIPC, ChildIPC } from "kitten-ipc"; import { ParentIPC, ChildIPC } from "kitten-ipc";
export default class IpcApi { export default class IpcApi {
private ipc: ParentIPC | ChildIPC; private ipc: ParentIPC | ChildIPC;

View File

@ -54,7 +54,7 @@ func (g *GoApiGenerator) Generate(apis *api.Api, destFile string) error {
return v, nil return v, nil
}, },
}) })
tpl = template.Must(tpl.ParseFiles("./go_gen.tmpl")) tpl = template.Must(tpl.ParseFiles("./golang/go_gen.tmpl"))
var buf bytes.Buffer var buf bytes.Buffer

View File

@ -16,7 +16,7 @@ export default class {{$e.Name}} {
const results = await this.ipc.call('{{$mtd.Name}}', const results = await this.ipc.call('{{$mtd.Name}}',
{{range $par := $mtd.Params}}{{$par.Name}}, {{end}} {{range $par := $mtd.Params}}{{$par.Name}}, {{end}}
); );
return {{range $ret := $mtd.}} return {{range $i, $ret := $mtd.Ret}}{{if $i}}, {{end}}results[{{$i}}] as {{$ret.Type | typedef}}{{end}}
} }
{{end}} {{end}}
} }

View File

@ -37,7 +37,7 @@ func (g *TypescriptApiGenerator) Generate(apis *api.Api, destFile string) error
return td, nil return td, nil
}, },
}) })
tpl = template.Must(tpl.ParseFiles("./ts_gen.tmpl")) tpl = template.Must(tpl.ParseFiles("./ts/ts_gen.tmpl"))
var buf bytes.Buffer var buf bytes.Buffer
@ -64,8 +64,9 @@ func (g *TypescriptApiGenerator) writeDest(destFile string, bytes []byte) error
} }
prettierCmd := exec.Command("npx", "prettier", destFile, "--write") prettierCmd := exec.Command("npx", "prettier", destFile, "--write")
if err := prettierCmd.Run(); err != nil { if out, err := prettierCmd.CombinedOutput(); err != nil {
log.Printf("Prettier returned error: %v", err) log.Printf("Prettier returned error: %v", err)
log.Printf("Output: \n%s", string(out))
} }
return nil return nil