Skip to content

🚫 InstallNoScripts

Installs dependencies with the --no-scripts option, skipping execution of the scripts defined in composer.json (such as post-install-cmd).

When to use

Use this when you need to manually control the script execution order in a CI/CD environment, or when external conditions the scripts depend on are not yet ready and execution would fail. Equivalent to running composer install --no-scripts.

Signature

go
func (c *Composer) InstallNoScripts() error

Parameters

This method takes no parameters.

Return value

error: Returns the corresponding error message when an error occurs during installation; nil on success.

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("Initialization failed: %v", err)
	}

	// In CI, install dependencies first; scripts are triggered later by the pipeline
	if err := comp.InstallNoScripts(); err != nil {
		log.Fatalf("Install dependencies failed: %v", err)
	}

	fmt.Println("Dependencies installed (scripts not executed)")
}

Advanced

Released under the MIT License