Documentation
¶
Overview ¶
Package config handles configuration loading and normalization across different formats.
Index ¶
Constants ¶
const ( // MaxConfigFileSize limits configuration file size to prevent resource exhaustion. MaxConfigFileSize = 10 * 1024 * 1024 // 10 MB )
Variables ¶
var ( // ErrConfigNotFound is returned when a configuration file is not found. ErrConfigNotFound = errors.New("configuration file not found") // ErrConfigTooLarge is returned when a configuration file exceeds size limits. ErrConfigTooLarge = errors.New("configuration file too large") // ErrConflictingLanguage is returned when merging configs with different language specs. ErrConflictingLanguage = errors.New("conflicting language specifications") // ErrConflictingManager is returned when merging configs with // different manager lists. ErrConflictingManager = errors.New("conflicting manager specifications") // ErrInvalidPackageFormat is returned when a package string has invalid format. ErrInvalidPackageFormat = errors.New("invalid package format") )
var StandardFileNames = map[string]string{
"cargobump-deps.yaml": "deps.yaml",
"gobump-deps.yaml": "deps.yaml",
"pombump-deps.yaml": "deps.yaml",
"pombump-properties.yaml": "properties.yaml",
"gobump-replaces.yaml": "replaces.yaml",
}
StandardFileNames maps old configuration file names to the new standard names.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Language specifies the language ecosystem (auto, maven, go, rust, js)
Language string `json:"language,omitempty" yaml:"language,omitempty"`
// Manager names the build tool(s) within a language where the
// language alone is ambiguous. Currently used by JS to choose between
// pnpm/yarn/npm/bun.
//
// In YAML this may be a scalar or a sequence: `manager: pnpm` is
// equivalent to `manager: [pnpm]`. A sequence is meaningful when a
// single package.json needs overrides written under more than one
// manager's field (for example, pnpm reads both .pnpm.overrides and
// .resolutions, so a project mid-migration may want both kept in
// sync).
Manager js.Managers `json:"manager,omitempty" yaml:"manager,omitempty"`
// Features lists Cargo features to activate when resolving the dependency
// graph during discovery (Rust only). It should mirror the feature set the
// melange package builds with (e.g. the crate's `cargo build --features ...`),
// so omnibump sees crates reachable only through non-default features and does
// not silently skip their pins. When empty, omnibump falls back to
// --all-features.
Features []string `json:"features,omitempty" yaml:"features,omitempty"`
// Packages lists dependencies to update
Packages []Package `json:"packages,omitempty" yaml:"packages,omitempty"`
// Properties lists properties to update (Maven, etc.)
Properties []Property `json:"properties,omitempty" yaml:"properties,omitempty"`
// Replaces lists module replacements (Go-specific)
Replaces []Replace `json:"replaces,omitempty" yaml:"replaces,omitempty"`
}
Config represents the unified configuration for omnibump.
func LoadConfig ¶
LoadConfig loads configuration from a file, supporting both old and new naming conventions.
func LoadMultipleConfigs ¶
LoadMultipleConfigs loads and merges multiple configuration files. This is useful for Maven projects that have separate deps and properties files.
func (*Config) Merge ¶ added in v0.15.1
Merge appends other's packages, properties and replaces into c and adopts its language and manager, erroring on conflicting specifications.
func (*Config) ToUpdateConfig ¶ added in v0.13.0
func (c *Config) ToUpdateConfig() *languages.UpdateConfig
ToUpdateConfig projects this Config into the UpdateConfig consumed by languages.Language.
type Package ¶
type Package struct {
// Common fields
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
// Reason is a free-form note (typically a CVE/GHSA list) recorded
// in build logs alongside the update. It is not written to any
// manifest file.
Reason string `json:"reason,omitempty" yaml:"reason,omitempty"`
// Maven-specific
GroupID string `json:"groupId,omitempty" yaml:"groupId,omitempty"`
ArtifactID string `json:"artifactId,omitempty" yaml:"artifactId,omitempty"`
Scope string `json:"scope,omitempty" yaml:"scope,omitempty"`
Type string `json:"type,omitempty" yaml:"type,omitempty"`
// Classifier selects which classifier variants of a Maven artifact the pin
// governs: unset matches every variant (the classifier-less dependency and
// all classifier'd ones), "none" matches only the classifier-less
// dependency, and a value (e.g. osx-x86_64) matches only that classifier.
Classifier string `json:"classifier,omitempty" yaml:"classifier,omitempty"`
}
Package represents a dependency package to update.
func ParseInlinePackages ¶
ParseInlinePackages parses inline package specifications from command line.
Three input shapes are accepted:
- Go/Rust: name@version
- Maven: groupId@artifactId@version[@scope[@type]]
- JS: selector=version (use this form when the selector contains '@' or '/', e.g. "@scope/name"=1.0.0 or "undici@^6"=6.24.0)
The input may span multiple lines and include shell-style line comments introduced by '#'. Each non-empty line is tokenised on whitespace; the JS form is identified by the presence of '=' in a token, in which case the token is split on its last '=' with the left-hand side optionally surrounded by double quotes.
type Property ¶
type Property struct {
Property string `json:"property" yaml:"property"`
Value string `json:"value" yaml:"value"`
}
Property represents a build property to update.
func ParseInlineProperties ¶
ParseInlineProperties parses inline property specifications from command line. Format: "property=value" pairs separated by spaces.
type Replace ¶
type Replace struct {
OldName string `json:"oldName" yaml:"oldName"`
Name string `json:"name" yaml:"name"`
Version string `json:"version" yaml:"version"`
}
Replace represents a module replacement (Go-specific).
func ParseInlineReplaces ¶
ParseInlineReplaces parses inline replace specifications from command line. Format: space-separated "oldpkg=newpkg@version" entries.