Documentation
¶
Overview ¶
Package templates provides template rendering functionality for Shipyard.
Index ¶
- func DefaultChangelogTemplate(templateName string) string
- func DefaultCommitTemplate(repoType config.RepoType) string
- func DefaultTagTemplate(repoType config.RepoType) string
- type ChangelogChange
- type ChangelogEntry
- type ChangelogTemplateData
- type CommitTemplateData
- type TagTemplateData
- type TemplateData
- type TemplateEngine
- func (e *TemplateEngine) RenderChangelogTemplate(entries []ChangelogEntry, templateName string) (string, error)
- func (e *TemplateEngine) RenderCommitTemplate(versions map[string]*semver.Version, summaries []string, ...) (string, error)
- func (e *TemplateEngine) RenderTagTemplate(packageName string, version *semver.Version, customData map[string]interface{}) (string, error)
- func (e *TemplateEngine) ValidateTemplate(templateStr string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultChangelogTemplate ¶
DefaultChangelogTemplate returns the default changelog template based on template name
func DefaultCommitTemplate ¶
DefaultCommitTemplate returns the default git commit message template
func DefaultTagTemplate ¶
DefaultTagTemplate returns the default git tag template
Types ¶
type ChangelogChange ¶
type ChangelogChange struct {
Summary string // Summary of the consignment change
ChangeType string // e.g., "patch", "minor", "major"
Section string // e.g., "Added", "Fixed", "Changed"
PackageName string // for monorepo projects
ConsignmentID string // ID of the original consignment
}
ChangelogChange represents a single change in a changelog entry
type ChangelogEntry ¶
type ChangelogEntry struct {
Version string
Date string // Formatted date
DateTime string // Full datetime
ShipmentDate string // Date when shipment was created
Changes map[string][]ChangelogChange // section -> list of consignment changes
PackageName string // for monorepo projects
ShipmentID string // ID of the shipment
}
ChangelogEntry represents a single shipment entry in the changelog
type ChangelogTemplateData ¶
type ChangelogTemplateData struct {
TemplateData
ShipmentEntries []ChangelogEntry // All shipment entries in the changelog
CurrentShipment *ChangelogEntry // Current shipment entry being rendered
ConsignmentsBySection map[string][]ChangelogChange // Consignments grouped by section
}
ChangelogTemplateData represents data specifically for changelog templates
type CommitTemplateData ¶
type CommitTemplateData struct {
TemplateData
CommitType string // Type of commit (release, etc.)
FilesChanged []string // List of files being committed
}
CommitTemplateData represents data specifically for git commit templates
type TagTemplateData ¶
type TagTemplateData struct {
TemplateData
TagName string // The tag name being created
}
TagTemplateData represents data specifically for git tag templates
type TemplateData ¶
type TemplateData struct {
// Repository information
RepoURL string
RepoOwner string
RepoName string
RepoType string // "monorepo" or "single-repo"
// Package information
Package string // Current package name
Packages []string // All package names
// Shipment information (version being released)
Version string // Current version being shipped
Versions map[string]string // All package versions in this shipment
PrevVersion string // Previous shipped version
// Consignment information (changes being shipped)
ChangeType string // The change type (patch, minor, major, etc.)
ChangeTypes []string // All change types in this shipment
ConsignmentSummary string // Summary of consignment changes
ConsignmentSummaries []string // All consignment summaries in this shipment
// Date information
Date string // Current date in YYYY-MM-DD format
DateTime string // Current date and time
Timestamp int64 // Unix timestamp
ShipmentDate string // Date when shipment is being created
// Git information
GitHash string // Current git commit hash
GitBranch string // Current git branch
// Custom fields
Custom map[string]interface{} // Custom template variables
}
TemplateData represents the data available to templates
type TemplateEngine ¶
type TemplateEngine struct {
// contains filtered or unexported fields
}
TemplateEngine provides template rendering functionality
func NewTemplateEngine ¶
func NewTemplateEngine(projectConfig *config.ProjectConfig) *TemplateEngine
NewTemplateEngine creates a new template engine
func (*TemplateEngine) RenderChangelogTemplate ¶
func (e *TemplateEngine) RenderChangelogTemplate(entries []ChangelogEntry, templateName string) (string, error)
RenderChangelogTemplate renders a changelog using the specified template
func (*TemplateEngine) RenderCommitTemplate ¶
func (e *TemplateEngine) RenderCommitTemplate(versions map[string]*semver.Version, summaries []string, customData map[string]interface{}) (string, error)
RenderCommitTemplate renders a git commit message template
func (*TemplateEngine) RenderTagTemplate ¶
func (e *TemplateEngine) RenderTagTemplate(packageName string, version *semver.Version, customData map[string]interface{}) (string, error)
RenderTagTemplate renders a git tag template
func (*TemplateEngine) ValidateTemplate ¶
func (e *TemplateEngine) ValidateTemplate(templateStr string) error
ValidateTemplate validates a template string