1
0
Fork 0

Add COMPOSER_NO_DEV environment variable to set the --no-dev flag (#10262)

pull/10309/head
Yehuda Katz 2021-11-24 05:32:19 -05:00 committed by GitHub
parent 78583ab678
commit ebf4cbdc69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -1163,3 +1163,8 @@ If set to `1`, outputs information about events being dispatched, which can be
useful for plugin authors to identify what is firing when exactly.
← [Libraries](02-libraries.md) | [Schema](04-schema.md) →
### COMPOSER_NO_DEV
If set to `1`, it is the equivalent of passing the `--no-dev` arguement to `install` or
`update`. You can override this for a single command by setting `COMPOSER_NO_DEV=0`.

View File

@ -153,6 +153,12 @@ abstract class BaseCommand extends Command
$input->setOption('no-progress', true);
}
if (true == $input->hasOption('no-dev')) {
if (!$input->getOption('no-dev') && true == Platform::getEnv('COMPOSER_NO_DEV')) {
$input->setOption('no-dev', true);
}
}
parent::initialize($input, $output);
}