codegen: Introduce TS codegen veneer (#54816)
* Split all named types out into defs, etc. * Use latest cuetsy, refactor generators accordingly * Return AST type from plugin TS generator * Near-complete checkin of TS veneer code generator * First full completed pass * Improve the attribute name * Defer use of the dashboard veneer type to follow-up * Remove dummy index, prettier on veneer * Fix merge errors in gen.go * Add match field to SpecialValueMap * Fix backend lint errors
This commit is contained in:
+12
-5
@@ -1,6 +1,7 @@
|
||||
package codegen
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"embed"
|
||||
"text/template"
|
||||
"time"
|
||||
@@ -48,11 +49,6 @@ type (
|
||||
SlotImpls []tvars_plugin_lineage_binding
|
||||
Header tvars_autogen_header
|
||||
}
|
||||
tvars_cuetsy_multi struct {
|
||||
Header tvars_autogen_header
|
||||
Imports []*tsImport
|
||||
Sections []tsSection
|
||||
}
|
||||
tvars_plugin_registry struct {
|
||||
Header tvars_autogen_header
|
||||
Plugins []struct {
|
||||
@@ -63,3 +59,14 @@ type (
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
type HeaderVars = tvars_autogen_header
|
||||
|
||||
// GenGrafanaHeader creates standard header elements for generated Grafana files.
|
||||
func GenGrafanaHeader(vars HeaderVars) string {
|
||||
buf := new(bytes.Buffer)
|
||||
if err := tmpls.Lookup("autogen_header.tmpl").Execute(buf, vars); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user