codegen

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package codegen generates Go source files from forge.contributor.yaml configuration. The generated files contain embed directives, manifest declarations, and factory functions for creating dashboard contributors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateContributorBinding

func GenerateContributorBinding(yamlPath string, outputDir string) error

GenerateContributorBinding reads a forge.contributor.yaml and writes zz_generated_contributor.go into the specified output directory.

func GenerateFromConfig

func GenerateFromConfig(cfg *config.ContributorConfig, outputDir string) error

GenerateFromConfig generates the Go binding file from a parsed config.

func GenerateToString

func GenerateToString(cfg *config.ContributorConfig, outputDir string) (string, error)

GenerateToString generates the Go binding code as a string (for testing).

Types

type TemplateData

type TemplateData struct {
	Package     string
	Name        string
	DisplayName string
	Version     string
	Icon        string
	VarPrefix   string // camelCase prefix for variables (e.g., "auth")

	// Static mode fields
	EmbedPath   string
	PagesDir    string
	WidgetsDir  string
	SettingsDir string
	AssetsDir   string

	// SSR mode fields
	SSREntry string
	WorkDir  string

	// From manifest
	Nav      []config.NavItemConfig
	Widgets  []config.WidgetConfig
	Settings []config.SettingConfig
}

TemplateData is the data passed to codegen templates.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL