🏗️ BuildSatis
Builds a Satis repository using the specified configuration file. Equivalent to running composer satis build <configPath> [outputDir].
When to use
Call this after CreateSatisConfig or InitSatis generates the configuration, to produce the packages.json and package archive artifacts that clients can consume.
Signature
go
func (c *Composer) BuildSatis(configPath string, outputDir string) (string, error)Parameters
| Parameter | Type | Description |
|---|---|---|
configPath | string | Path to the Satis configuration file, e.g. satis/satis.json |
outputDir | string | Output directory; pass an empty string to use the output-dir from the configuration |
Return value
| Return value | Type | Description |
|---|---|---|
| First return value | string | Output of the build command |
| Second return value | error | Returned when execution fails |
Prerequisite
This method depends on the satis executable being installed and available in PATH. Satis is typically installed with composer global require composer/satis.
Example
go
package main
import (
"fmt"
"log"
"github.com/scagogogo/composer-skills/pkg/composer"
)
func main() {
comp, err := composer.New(composer.DefaultOptions())
if err != nil {
log.Fatalf("init failed: %v", err)
}
output, err := comp.BuildSatis("satis/satis.json", "public")
if err != nil {
log.Fatalf("failed to build Satis: %v", err)
}
fmt.Println(output)
}Advanced
- A configuration file is required before building; see CreateSatisConfig or InitSatis.
- To enable archive artifacts (zip/tar), modify the configuration with
EnableSatisArchivefirst. - To adjust minimum stability, use
UpdateSatisStability.