func (vg *VersionGenerator) DirectoryPath() string {
	return vg.directoryPath
}
DirectoryPath returns the path to the directory of the version.
package pipeline
import (
	"go/types"
	"os"
	"path/filepath"
	"strings"
	"github.com/muvaf/typewriter/pkg/wrapper"
	"github.com/pkg/errors"
	"github.com/crossplane-contrib/terrajet/pkg/pipeline/templates"
)
func NewVersionGenerator(rootDir, modulePath, group, version string) *VersionGenerator {
	pkgPath := filepath.Join(modulePath, "apis", strings.ToLower(strings.Split(group, ".")[0]), version)
	directoryPath := filepath.Join(rootDir, "apis", strings.ToLower(strings.Split(group, ".")[0]), version)
	return &VersionGenerator{
		directoryPath: directoryPath,
		Group:         group,
		Version:       version,
		pkg:           types.NewPackage(pkgPath, version),
	}
}
type VersionGenerator struct {
	Group   string
	Version string
	directoryPath string
	pkg           *types.Package
}
func (vg *VersionGenerator) Generate() error {
	vars := map[string]interface{}{
		"CRD": map[string]string{
			"APIVersion": vg.Version,
			"Group":      vg.Group,
		},
	}
	gviFile := wrapper.NewFile(vg.pkg.Path(), vg.Version, templates.GroupVersionInfoTemplate,
		wrapper.WithGenStatement(GenStatement),
		wrapper.WithHeaderPath("hack/boilerplate.go.txt"),  
	)
	return errors.Wrap(
		gviFile.Write(filepath.Join(vg.directoryPath, "zz_groupversion_info.go"), vars, os.ModePerm),
		"cannot write group version info file",
	)
}
func (vg *VersionGenerator) Package() *types.Package {
	return vg.pkg
}