feat: meta file for generator version

This commit is contained in:
Cristian Vidmar 2024-05-09 10:37:56 +02:00
parent b3410cb437
commit caeb4c9de1
4 changed files with 8 additions and 0 deletions

View File

@ -54,6 +54,7 @@ func generate(filename string, tpl []byte, conf spaceConf) error {
// generateCode generates API to and value objects for the space
func generateCode(conf spaceConf) (err error) {
for file, tpl := range map[string][]byte{
filepath.Join(conf.PackageDir, "meta"+goExt): templates.TemplateMeta,
filepath.Join(conf.PackageDir, "gocontentfulvobase"+goExt): templates.TemplateVoBase,
filepath.Join(conf.PackageDir, "gocontentfulvo"+goExt): templates.TemplateVo,
filepath.Join(conf.PackageDir, "gocontentfulvolib"+goExt): templates.TemplateVoLib,

View File

@ -0,0 +1,2 @@
// gocontentful version: {{ .Version }}
{{ $cfg := . }}package {{ .PackageName }}

View File

@ -2,6 +2,9 @@ package templates
import _ "embed"
//go:embed "meta.gotmpl"
var TemplateMeta []byte
//go:embed "contentful_vo.gotmpl"
var TemplateVo []byte

2
test/testapi/meta.go Normal file
View File

@ -0,0 +1,2 @@
// gocontentful version: latest
package testapi