Skip to content

🏗️ 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 ​

ParameterTypeDescription
configPathstringPath to the Satis configuration file, e.g. satis/satis.json
outputDirstringOutput directory; pass an empty string to use the output-dir from the configuration

Return value ​

Return valueTypeDescription
First return valuestringOutput of the build command
Second return valueerrorReturned 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 EnableSatisArchive first.
  • To adjust minimum stability, use UpdateSatisStability.

Released under the MIT License