Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppConfig ¶
type AppConfig struct {
Version VersionConfig `yaml:"version"`
Build BuildConfig `yaml:"build"`
Docker DockerConfig `yaml:"docker"`
Git GitConfig `yaml:"git"`
NodeJS NodeJSConfig `yaml:"nodejs"`
}
AppConfig represents the forge.yaml configuration file structure.
type Binary ¶
type Binary struct {
Name string `yaml:"name"` // Binary name (e.g., "forge", "cli-tool")
Path string `yaml:"path"` // Path to main.go (e.g., "./cmd/forge", ".")
LDFlags string `yaml:"ldflags"` // Optional ldflags override for this binary
}
Binary represents a single binary to build.
type BuildConfig ¶
type BuildConfig struct {
Name string `yaml:"name"` // Binary name for single-app builds (optional, defaults to repo dir basename)
MainPath string `yaml:"main_path"` // Path to main.go (e.g., "./cmd/main.go")
Targets []string `yaml:"targets"` // ["linux/amd64", "darwin/arm64", ...]
LDFlags string `yaml:"ldflags"` // template allowed (default for all binaries)
OutputDir string `yaml:"output_dir"` // default "dist"
Binaries []Binary `yaml:"binaries"` // List of binaries to build (optional, defaults to single binary)
}
BuildConfig holds build settings.
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 ¶
Load reads the configuration from the specified path. If the file doesn't exist, returns the default configuration.
func LoadFromDir ¶
LoadFromDir loads the forge.yaml configuration from the specified directory. It looks for forge.yaml or .forge.yaml in that directory.
func (*Config) GetAllApps ¶
GetAllApps returns all app configurations with their names
func (*Config) IsMultiApp ¶
IsMultiApp returns true if this is a multi-app configuration
type DockerConfig ¶
type DockerConfig struct {
Enabled bool `yaml:"enabled"`
Repository string `yaml:"repository"` // Single repository, use Repositories for multiple (e.g., "ghcr.io/USER/forge")
Repositories []string `yaml:"repositories"` // Multiple repositories (e.g., ["ghcr.io/USER/forge", "docker.io/USER/forge"])
Dockerfile string `yaml:"dockerfile"` // default "./Dockerfile"
Tags []string `yaml:"tags"` // template strings
Platforms []string `yaml:"platforms"` // ["linux/amd64", "linux/arm64"]
BuildArgs map[string]string `yaml:"build_args"`
}
DockerConfig holds Docker image build settings.
func (*DockerConfig) GetRepositories ¶
func (dc *DockerConfig) GetRepositories() []string
GetRepositories returns all configured repositories. If Repositories is set, it returns that. Otherwise, it returns Repository as a single-element slice for backward compatibility. Returns empty slice if neither is set.
type GitConfig ¶
type GitConfig struct {
TagPrefix string `yaml:"tag_prefix"` // e.g., "v"
DefaultBranch string `yaml:"default_branch"` // e.g., "main"
}
GitConfig holds git-related settings.
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.
type VersionConfig ¶
type VersionConfig struct {
Scheme string `yaml:"scheme"` // "semver" or "calver"
Prefix string `yaml:"prefix"` // e.g., "v"
CalVerFormat string `yaml:"calver_format"` // e.g., "2006.01.02", "2006.WW" (supports WW for ISO week)
Pre string `yaml:"pre"` // [ALPHA] prerelease identifier - not fully implemented, do not use in production
Meta string `yaml:"meta"` // [ALPHA] build metadata - not fully implemented, do not use in production
}
VersionConfig holds version scheme settings.