ag/templates/_makePluginCode.go

30 lines
619 B
Go
Raw Permalink Normal View History

2024-03-15 22:32:19 +08:00
package main
import (
"apigo.cloud/git/apigo/gojs"
"apigo.cloud/git/apigo/plugin"
{{- range .imports}}
_ "{{.}}"
{{- end}}
"fmt"
"github.com/ssgo/u"
"path"
)
func main() {
for _, plg := range plugin.List() {
code := gojs.MakePluginCode(&plg)
errStr := "no code"
if code != "" {
err := u.WriteFile(path.Join("plugins", plg.Id+".ts"), code)
if err == nil {
fmt.Println(u.Cyan(plg.Id), "-", plg.Name, u.BGreen("OK"), ">>", u.Magenta(path.Join("plugins", plg.Id+".ts")))
continue
} else {
errStr = err.Error()
}
}
fmt.Println(u.Cyan(plg.Id), "-", plg.Name, u.BGreen(errStr))
}
}