composer / satis

Simple static Composer repository generator - For a full private Composer repo use Private Packagist
MIT License
3.14k stars 516 forks source link

satis build doesn't pass config to composer #878

Open dr-diesel opened 3 months ago

dr-diesel commented 3 months ago

Hello,

BuildCommand uses this method to get $composer with config:

        /** @var SatisApplication|ComposerApplication $application */
        $application = $this->getApplication();
        if ($application instanceof SatisApplication) {
            $composer = $application->getComposerWithConfig($config);
        } else {
            $composer = $application->getComposer(true);
        }

https://github.com/composer/satis/blob/7735ad22abf661fab304e73bba469289647f63d5/src/Console/Application.php#L77

Unfortunately BaseCommand already creates $application->composer in BaseCommand::initialize() :

https://github.com/composer/composer/blob/11e5237ad9d9e8f29bdc57d946f87c816320d863/src/Composer/Command/BaseCommand.php#L240

For me solution in Satis was to remove if (null === $this->composer) { in Application::getComposerWithConfig() , called only in BuildCommand. Than $composer is recreated with config from .json "config" key, mentioned in docs here: https://composer.github.io/satis/using