Kindsys: Unique names for composable kind TS types (#61928)
* Kindsys: Unique names for composable kind TS types * Update all TS imports
This commit is contained in:
@@ -3,6 +3,7 @@ package codegen
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/grafana/codejen"
|
||||
tsast "github.com/grafana/cuetsy/ts/ast"
|
||||
@@ -40,11 +41,10 @@ func (j *ptsJenny) Generate(decl *pfs.PluginDecl) (*codejen.File, error) {
|
||||
}
|
||||
}
|
||||
|
||||
slotname := decl.SchemaInterface.Name()
|
||||
v := decl.Lineage.Latest().Version()
|
||||
|
||||
tsf.Nodes = append(tsf.Nodes, tsast.Raw{
|
||||
Data: fmt.Sprintf("export const %sModelVersion = Object.freeze([%v, %v]);", slotname, v[0], v[1]),
|
||||
Data: fmt.Sprintf("export const %sModelVersion = Object.freeze([%v, %v]);", decl.SchemaInterface.Name(), v[0], v[1]),
|
||||
})
|
||||
|
||||
jf, err := j.inner.Generate(decl)
|
||||
@@ -56,7 +56,7 @@ func (j *ptsJenny) Generate(decl *pfs.PluginDecl) (*codejen.File, error) {
|
||||
Data: string(jf.Data),
|
||||
})
|
||||
|
||||
path := filepath.Join(j.root, decl.PluginPath, "models.gen.ts")
|
||||
path := filepath.Join(j.root, decl.PluginPath, fmt.Sprintf("%s.gen.ts", strings.ToLower(decl.SchemaInterface.Name())))
|
||||
data := []byte(tsf.String())
|
||||
data = data[:len(data)-1] // remove the additional line break added by the inner jenny
|
||||
|
||||
|
||||
Reference in New Issue
Block a user