config

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	Scheme        string        `yaml:"scheme"`                  // "semver" or "calver"
	Prefix        string        `yaml:"prefix"`                  // Tag prefix, e.g., "v", "api/v"
	DefaultBranch string        `yaml:"default_branch"`          // e.g., "main"
	CalVerFormat  string        `yaml:"calver_format,omitempty"` // e.g., "2006.01.02", "2006.WW"
	Pre           string        `yaml:"pre,omitempty"`           // [ALPHA] prerelease identifier
	Meta          string        `yaml:"meta,omitempty"`          // [ALPHA] build metadata
	Hotfix        *HotfixConfig `yaml:"hotfix,omitempty"`        // Hotfix workflow settings
	NodeJS        NodeJSConfig  `yaml:"nodejs,omitempty"`        // Node.js package.json sync
}

AppConfig represents the forge.yaml configuration file structure.

func Default

func Default() *AppConfig

Default returns a default AppConfig for single app configuration.

func (*AppConfig) GetHotfixConfig added in v1.3.0

func (ac *AppConfig) GetHotfixConfig() HotfixConfig

GetHotfixConfig returns hotfix config with defaults applied.

func (*AppConfig) Validate

func (ac *AppConfig) Validate() error

Validate checks if the AppConfig has all required fields.

type Config

type Config struct {
	DefaultApp string               `yaml:"defaultApp"`
	Apps       map[string]AppConfig `yaml:",inline"`
}

func DefaultMulti

func DefaultMulti() *Config

DefaultMulti returns a default Config for multi app configuration.

func Load

func Load(path string) (*Config, error)

Load reads the configuration from the specified path. If the file doesn't exist, returns the default configuration.

func LoadFromDir

func LoadFromDir(dir string) (*Config, error)

LoadFromDir loads the forge.yaml configuration from the specified directory. It looks for forge.yaml or .forge.yaml in that directory.

func (*Config) DetectAppFromTag added in v1.3.0

func (c *Config) DetectAppFromTag(tag string) (string, error)

DetectAppFromTag determines which app config to use based on tag prefix. Returns empty string for single-app configs.

func (*Config) GetAllAppConfigs added in v1.3.0

func (c *Config) GetAllAppConfigs() []*AppConfig

GetAllAppConfigs returns all app configurations as pointers

func (*Config) GetAllApps

func (c *Config) GetAllApps() map[string]AppConfig

GetAllApps returns all app configurations with their names

func (*Config) GetAppConfig

func (c *Config) GetAppConfig(app string) (*AppConfig, error)

func (*Config) GetFirst

func (c *Config) GetFirst() (*AppConfig, error)

func (*Config) IsMultiApp

func (c *Config) IsMultiApp() bool

IsMultiApp returns true if this is a multi-app configuration

func (*Config) ValidateAppTag added in v1.3.0

func (c *Config) ValidateAppTag(appName, tag string) error

ValidateAppTag ensures app name matches tag prefix.

type HotfixConfig added in v1.3.0

type HotfixConfig struct {
	// Branch naming prefix. The full branch name is prefix + tag.
	// Examples: "release/" creates "release/v1.0.0"
	BranchPrefix string `yaml:"branch_prefix"` // Default: "release/"

	// Version suffix for hotfix tags
	// Examples: "hotfix", "patch", "fix"
	Suffix string `yaml:"suffix"` // Default: "hotfix"
}

HotfixConfig holds hotfix workflow configuration.

type NodeJSConfig

type NodeJSConfig struct {
	Enabled     bool   `yaml:"enabled"`      // Enable package.json version updates
	PackagePath string `yaml:"package_path"` // Path to package.json (relative to repo root, defaults to "./package.json")
}

NodeJSConfig holds Node.js/npm package.json version sync settings.

Jump to

Keyboard shortcuts

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