helpers

package
v2.17.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(logLevel string, verbose bool, stderr io.Writer) *slog.Logger

Types

type AwsHelper

type AwsHelper struct{}

func NewAwsHelper

func NewAwsHelper() AwsHelper

func (*AwsHelper) AddCloudFrontAssets

func (helper *AwsHelper) AddCloudFrontAssets(originBucketName string, region string, awsProfile string) error

func (*AwsHelper) CleanCloudFrontCache

func (helper *AwsHelper) CleanCloudFrontCache(stackName string, stage string, region string, awsProfile string) error

func (*AwsHelper) RemoveCloudFrontAssets

func (helper *AwsHelper) RemoveCloudFrontAssets(originBucketName string, region string, awsProfile string) error

type AwsSamHelper

type AwsSamHelper struct {
}

func NewAwsSamHelper

func NewAwsSamHelper() AwsSamHelper

func (*AwsSamHelper) Build

func (helper *AwsSamHelper) Build() error

func (*AwsSamHelper) DeleteStack

func (helper *AwsSamHelper) DeleteStack(stage string, stackName string, awsProfile string) error

func (*AwsSamHelper) Deploy

func (helper *AwsSamHelper) Deploy(stage string, stackName string, awsProfile string) error

type EnvValueInfo

type EnvValueInfo struct {
	Value        interface{}
	Key          string // Lambda env var name (spaces replaced with underscores)
	SanitizedKey string // Alphanumeric-only key for CloudFormation Mappings lookups
}

type InitCmdTemplateInfo

type InitCmdTemplateInfo struct {
	ProjectName            string
	GoModName              string
	MainServerPackageName  string
	MainServerFunctionName string
	PageName               string
	RouteName              string
	ComponentName          string
}

type RouteTemplateInfo

type RouteTemplateInfo struct {
	PageName      string
	RouteName     string
	ComponentName string
	GoModName     string
}

type SamTomlTemplateInfo

type SamTomlTemplateInfo struct {
	StackName string
	AwsRegion string
}

type SamYamlTemplateInfo

type SamYamlTemplateInfo struct {
	Timeout           int
	MemorySize        int
	UsedTemplateName  string
	ProjectName       string
	StageTemplateInfo StageTemplateInfo
}

type StageTemplateInfo

type StageTemplateInfo struct {
	Name                  string
	BucketName            string
	LambdaName            string
	CustomDomain          string
	HostedZone            string
	CertificateArn        string
	IsCustomDomainWithArn bool
	IsCustomDomain        bool
	WafArn                string
	Env                   []EnvValueInfo
}

type TailwindHelper

type TailwindHelper struct {
	Runtime        string // runtime.GOOS
	Arch           string // runtime.GOARCH
	Version        string // default "v3.4.14"
	ConfigOverride string // from gothic-config.json tailwindBinary field
}

func DefaultTailwindHelper

func DefaultTailwindHelper() TailwindHelper

DefaultTailwindHelper creates a TailwindHelper using the current runtime's OS and architecture.

func NewTailwindHelper

func NewTailwindHelper(goos, goarch string) TailwindHelper

func (*TailwindHelper) Build

func (h *TailwindHelper) Build() error

Build runs the Tailwind CSS build (one-shot, minified).

func (*TailwindHelper) EnsureBinary

func (h *TailwindHelper) EnsureBinary() (string, error)

EnsureBinary resolves the Tailwind binary path. Resolution order: 1. ConfigOverride if set (returns error if file doesn't exist) 2. Cached binary in OS cache directory 3. Download from GitHub releases

func (*TailwindHelper) WatchStart

func (h *TailwindHelper) WatchStart() (*exec.Cmd, error)

WatchStart starts the Tailwind CSS watcher (non-blocking).

type TemplHelper

type TemplHelper struct {
}

func NewTemplHelper

func NewTemplHelper() TemplHelper

func (*TemplHelper) Render

func (t *TemplHelper) Render() error

Render runs `templ generate`, but skips files whose contents are unchanged since the last successful run (tracked via .gothicCli/templ-cache.json).

Behavior:

  • Scans the working directory for .templ files.
  • If every file is cache-hit (and the matching _templ.go exists), it returns without invoking templ at all.
  • Otherwise it runs templ per dirty file using the -f flag. If any per-file run fails (e.g. unsupported by the installed templ version), it falls back to a full-project generation.
  • On success, updates and persists the cache.

type TemplateHelper

type TemplateHelper struct {
	InitCmdTemplateInfo InitCmdTemplateInfo
	RouteTemplateInfo   RouteTemplateInfo
}

func NewTemplateHelper

func NewTemplateHelper() TemplateHelper

func (*TemplateHelper) CopyFile

func (helper *TemplateHelper) CopyFile(filePath string, destinationPath string) error

func (*TemplateHelper) CopyFromFs

func (helper *TemplateHelper) CopyFromFs(fileTemplate embed.FS, templateFilePath string, outputFilePath string) error

func (*TemplateHelper) CreateFromTemplate

func (helper *TemplateHelper) CreateFromTemplate(fileTemplate embed.FS, templateFilePath string, outputFilePath string, templateStruct interface{}) error

func (*TemplateHelper) DeleteFile

func (helper *TemplateHelper) DeleteFile(filePath string) error

func (*TemplateHelper) RenderToString

func (helper *TemplateHelper) RenderToString(fileTemplate embed.FS, templateFilePath string, templateStruct interface{}) (string, error)

func (*TemplateHelper) UpdateFromTemplate

func (helper *TemplateHelper) UpdateFromTemplate(templateFilePath string, outputFilePath string, templateStruct interface{}) error

func (*TemplateHelper) UpdateFromTemplateFS

func (helper *TemplateHelper) UpdateFromTemplateFS(fileTemplate embed.FS, templateFilePath string, outputFilePath string, templateStruct interface{}) error

UpdateFromTemplateFS renders a template stored in an embed.FS to a destination file on disk. It mirrors UpdateFromTemplate but reads the template source from the provided embed.FS rather than the user's project tree. This is the path used for templates the CLI considers an implementation detail (WASM glue, generated route registration) and no longer seeds onto user disk.

Directories

Path Synopsis
Package templ provides a content-hash cache for .templ files so that `templ generate` is only invoked for files whose contents (or generated counterparts) have changed since the last run.
Package templ provides a content-hash cache for .templ files so that `templ generate` is only invoked for files whose contents (or generated counterparts) have changed since the last run.

Jump to

Keyboard shortcuts

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