Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add COMPOSER_NO_DEV environment variable #10262

Merged
merged 2 commits into from
Nov 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/03-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -1147,3 +1147,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`.
6 changes: 6 additions & 0 deletions src/Composer/Command/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ protected function initialize(InputInterface $input, OutputInterface $output)
$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);
}

Expand Down