30 lines
619 B
Go
30 lines
619 B
Go
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))
|
|
}
|
|
}
|