Skip to content

Commit

Permalink
Add COMPOSER_NO_DEV environment variable
Browse files Browse the repository at this point in the history
This works fine in practice, but the tests fail because it doesn't call the initialization function, so the setup isn't done.
  • Loading branch information
yakatz committed Nov 16, 2021
1 parent 28c3412 commit 44deb08
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
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 == getenv('COMPOSER_NO_DEV')) {
$input->setOption('no-dev', true);
}
}

parent::initialize($input, $output);
}

Expand Down

0 comments on commit 44deb08

Please sign in to comment.