config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EcosystemGo     = "go"
	EcosystemNPM    = "npm"
	EcosystemPython = "python"
	EcosystemHelm   = "helm"
	EcosystemCargo  = "cargo"
	EcosystemDeno   = "deno"
)

Ecosystem types

Variables

This section is empty.

Functions

func FindConfig added in v0.2.0

func FindConfig(startDir string) (string, error)

FindConfig searches for a shipyard config file in the current directory and parent directories up to the repository root

func ValidateDependencies added in v0.2.0

func ValidateDependencies(cfg *Config) error

ValidateDependencies checks that all package dependencies reference existing packages. Returns an error if any dependency references a non-existent package.

Validation rules:

  • All dependency package names must exist in the config
  • Self-dependencies are allowed (package depending on itself)
  • Circular dependencies are allowed (will be handled by cycle detection)
  • Empty dependency lists are valid

func WriteConfig added in v0.2.0

func WriteConfig(cfg *Config, configPath string) error

WriteConfig writes the configuration to a YAML file

Types

type Config added in v0.2.0

type Config struct {
	Extends      []RemoteConfig    `yaml:"extends,omitempty"`
	Packages     []Package         `yaml:"packages"`
	Templates    TemplateConfig    `yaml:"templates,omitempty"`
	Metadata     MetadataConfig    `yaml:"metadata,omitempty"`
	Consignments ConsignmentConfig `yaml:"consignments,omitempty"`
	History      HistoryConfig     `yaml:"history,omitempty"`
	GitHub       GitHubConfig      `yaml:"github,omitempty"`
	PreRelease   PreReleaseConfig  `yaml:"prerelease,omitempty"`
}

Config represents the project-specific settings

func Load added in v0.2.0

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

Load loads the configuration from a file using Viper

func LoadFromDir added in v0.2.0

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

LoadFromDir loads the configuration from a directory It looks for shipyard.yaml, shipyard.yml, shipyard.json, or shipyard.toml First checks .shipyard/ subdirectory, then the root directory

func (*Config) GetPackage added in v0.2.0

func (c *Config) GetPackage(name string) (Package, bool)

GetPackage retrieves a package by name

func (*Config) Merge added in v0.2.0

func (c *Config) Merge(overlay *Config) *Config

Merge merges this config with another, with the overlay taking precedence

func (*Config) Validate added in v0.2.0

func (c *Config) Validate() error

Validate checks if the configuration is valid

func (*Config) WithDefaults added in v0.2.0

func (c *Config) WithDefaults() *Config

WithDefaults returns a config with default values applied. Performs a deep copy so the original config is not modified.

type ConsignmentConfig added in v0.2.0

type ConsignmentConfig struct {
	Path string `yaml:"path,omitempty"`
}

ConsignmentConfig holds consignment storage settings

type Dependency added in v0.2.0

type Dependency struct {
	Package     string            `yaml:"package"`
	Strategy    string            `yaml:"strategy,omitempty"` // "fixed" or "linked"
	BumpMapping map[string]string `yaml:"bumpMapping,omitempty"`
}

Dependency represents a package dependency

type GitHubConfig added in v0.2.0

type GitHubConfig struct {
	Owner string `yaml:"owner,omitempty"`
	Repo  string `yaml:"repo,omitempty"`
	Token string `yaml:"token,omitempty"` // Format: "env:VAR_NAME"
}

GitHubConfig holds GitHub integration settings

type HelmOptions added in v0.6.0

type HelmOptions struct {
	AppDependency string // Package name to use for appVersion
}

HelmOptions contains Helm-specific package options

type HistoryConfig added in v0.2.0

type HistoryConfig struct {
	Path string `yaml:"path,omitempty"`
}

HistoryConfig holds history file settings

type MetadataConfig added in v0.2.0

type MetadataConfig struct {
	Fields []MetadataField `yaml:"fields,omitempty"`
}

MetadataConfig defines custom metadata fields

type MetadataField added in v0.2.0

type MetadataField struct {
	Name     string `yaml:"name"`
	Required bool   `yaml:"required,omitempty"`
	Type     string `yaml:"type,omitempty"` // "string", "int", "list", "map"

	// String validation
	Pattern   string `yaml:"pattern,omitempty"`
	MinLength *int   `yaml:"minLength,omitempty"`
	MaxLength *int   `yaml:"maxLength,omitempty"`

	// Integer validation
	Min *int `yaml:"min,omitempty"`
	Max *int `yaml:"max,omitempty"`

	// List validation
	ItemType string `yaml:"itemType,omitempty"` // "string", "int"
	MinItems *int   `yaml:"minItems,omitempty"`
	MaxItems *int   `yaml:"maxItems,omitempty"`

	// Common
	AllowedValues []string `yaml:"allowedValues,omitempty"`
	Default       string   `yaml:"default,omitempty"`
	Description   string   `yaml:"description,omitempty"`
}

MetadataField defines a custom metadata field

type Package

type Package struct {
	Name         string                 `yaml:"name"`
	Path         string                 `yaml:"path"`
	Ecosystem    string                 `yaml:"ecosystem,omitempty"`
	VersionFiles []string               `yaml:"versionFiles,omitempty"` // Use ["tag-only"] for tag-only mode
	Dependencies []Dependency           `yaml:"dependencies,omitempty"`
	Templates    *TemplateConfig        `yaml:"templates,omitempty"`
	Options      map[string]interface{} `yaml:"options,omitempty"`
}

Package represents a versionable package

func (*Package) GetHelmOptions added in v0.6.0

func (p *Package) GetHelmOptions() *HelmOptions

GetHelmOptions extracts Helm-specific options from package options

func (*Package) IsTagOnly added in v0.2.0

func (p *Package) IsTagOnly() bool

IsTagOnly returns true if this package uses tag-only versioning (no file updates) This is indicated by versionFiles containing "tag-only" keyword

func (*Package) Validate added in v0.2.0

func (p *Package) Validate() error

Validate checks if a package is valid

func (*Package) ValidateOptions added in v0.6.0

func (p *Package) ValidateOptions(allPackages []Package) error

ValidateOptions validates package options against the configuration This is called by Config.Validate after all packages are known

type PreReleaseConfig added in v0.4.0

type PreReleaseConfig struct {
	Stages              []StageConfig `yaml:"stages,omitempty"`
	SnapshotTagTemplate string        `yaml:"snapshotTagTemplate,omitempty"`
}

PreReleaseConfig holds pre-release stage definitions and snapshot template

func (*PreReleaseConfig) GetLowestOrderStage added in v0.4.0

func (c *PreReleaseConfig) GetLowestOrderStage() (StageConfig, bool)

GetLowestOrderStage returns the stage with the lowest order value

func (*PreReleaseConfig) GetNextStage added in v0.4.0

func (c *PreReleaseConfig) GetNextStage(currentName string) (StageConfig, bool)

GetNextStage returns the stage with the next-highest order after the given stage name

func (*PreReleaseConfig) GetStageByName added in v0.4.0

func (c *PreReleaseConfig) GetStageByName(name string) (StageConfig, bool)

GetStageByName returns the stage with the given name

func (*PreReleaseConfig) IsHighestStage added in v0.4.0

func (c *PreReleaseConfig) IsHighestStage(name string) bool

IsHighestStage returns true if the given stage name is the highest-order stage

func (*PreReleaseConfig) Validate added in v0.4.0

func (c *PreReleaseConfig) Validate() error

Validate checks if the pre-release configuration is valid (only when stages are defined)

type RemoteConfig added in v0.2.0

type RemoteConfig struct {
	URL  string `yaml:"url,omitempty"`
	Git  string `yaml:"git,omitempty"`
	Path string `yaml:"path,omitempty"`
	Ref  string `yaml:"ref,omitempty"`
	Auth string `yaml:"auth,omitempty"`
}

RemoteConfig represents a remote configuration source

func (*RemoteConfig) UnmarshalYAML added in v0.2.0

func (rc *RemoteConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements custom unmarshaling for RemoteConfig

type StageConfig added in v0.4.0

type StageConfig struct {
	Name        string `yaml:"name"`
	Order       int    `yaml:"order"`
	TagTemplate string `yaml:"tagTemplate,omitempty"`
}

StageConfig defines a pre-release stage

type TemplateConfig added in v0.2.0

type TemplateConfig struct {
	Changelog     *TemplateSource `yaml:"changelog,omitempty"`
	TagName       *TemplateSource `yaml:"tagName,omitempty"`
	ReleaseNotes  *TemplateSource `yaml:"releaseNotes,omitempty"`
	CommitMessage *TemplateSource `yaml:"commitMessage,omitempty"`
}

TemplateConfig holds template definitions

type TemplateSource added in v0.2.0

type TemplateSource struct {
	Source string `yaml:"source,omitempty"`
	Inline string `yaml:"inline,omitempty"`
}

TemplateSource represents a template source

Jump to

Keyboard shortcuts

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