tons of code
This commit is contained in:
parent
de8c9aedf7
commit
ab294a0355
@ -1,5 +1,4 @@
|
||||
import { ParentIPC, ChildIPC } from "kitten-ipc";
|
||||
|
||||
export default class IpcApi {
|
||||
private ipc: ParentIPC | ChildIPC;
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ func (g *GoApiGenerator) Generate(apis *api.Api, destFile string) error {
|
||||
return v, nil
|
||||
},
|
||||
})
|
||||
tpl = template.Must(tpl.ParseFiles("./go_gen.tmpl"))
|
||||
tpl = template.Must(tpl.ParseFiles("./golang/go_gen.tmpl"))
|
||||
|
||||
var buf bytes.Buffer
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ export default class {{$e.Name}} {
|
||||
const results = await this.ipc.call('{{$mtd.Name}}',
|
||||
{{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}}
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ func (g *TypescriptApiGenerator) Generate(apis *api.Api, destFile string) error
|
||||
return td, nil
|
||||
},
|
||||
})
|
||||
tpl = template.Must(tpl.ParseFiles("./ts_gen.tmpl"))
|
||||
tpl = template.Must(tpl.ParseFiles("./ts/ts_gen.tmpl"))
|
||||
|
||||
var buf bytes.Buffer
|
||||
|
||||
@ -64,8 +64,9 @@ func (g *TypescriptApiGenerator) writeDest(destFile string, bytes []byte) error
|
||||
}
|
||||
|
||||
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("Output: \n%s", string(out))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user