Skip to content

Commit 0e752e4

Browse files
Fix unpacking on create-project
1 parent afd3d71 commit 0e752e4

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

src/Flex.php

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use Composer\Installer\PackageEvent;
2929
use Composer\Installer\PackageEvents;
3030
use Composer\Installer\SuggestedPackagesReporter;
31+
use Composer\IO\ConsoleIO;
3132
use Composer\IO\IOInterface;
3233
use Composer\IO\NullIO;
3334
use Composer\Json\JsonFile;
@@ -46,6 +47,7 @@
4647
use Composer\Script\Event;
4748
use Composer\Script\ScriptEvents;
4849
use Symfony\Component\Console\Input\ArgvInput;
50+
use Symfony\Component\Console\Output\OutputInterface;
4951
use Symfony\Flex\Event\UpdateEvent;
5052
use Symfony\Flex\Unpack\Operation;
5153
use Symfony\Thanks\Thanks;
@@ -56,8 +58,16 @@
5658
*/
5759
class Flex implements PluginInterface, EventSubscriberInterface
5860
{
61+
/**
62+
* @var Composer
63+
*/
5964
private $composer;
65+
66+
/**
67+
* @var IOInterface
68+
*/
6069
private $io;
70+
6171
private $config;
6272
private $options;
6373
private $configurator;
@@ -415,14 +425,30 @@ public function update(Event $event = null, $operations = [])
415425
}, $this->installer, $this->installer)();
416426
$this->composer->getEventDispatcher()->__construct($this->composer, $this->io);
417427

428+
$status = $this->installer->run();
429+
if (0 !== $status) {
430+
exit($status);
431+
}
432+
418433
$unpacker = new Unpacker($this->composer, new PackageResolver($this->downloader), $this->dryRun);
419434
$result = $unpacker->unpack($unpackOp);
420435
$unpacker->updateLock($result, $this->io);
421436

422-
$status = $this->installer->run();
423-
if (0 !== $status) {
424-
exit($status);
437+
if ($this->io instanceof ConsoleIO) {
438+
\Closure::bind(function () {
439+
$this->output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
440+
}, $this->io, $this->io)();
425441
}
442+
443+
\Closure::bind(function ($locker) {
444+
$this->locker = $locker;
445+
$this->dumpAutoloader = false;
446+
$this->runScripts = false;
447+
$this->ignorePlatformReqs = true;
448+
$this->update = false;
449+
}, $this->installer, $this->installer)($this->composer->getLocker());
450+
451+
$this->installer->run();
426452
}
427453

428454
public function install(Event $event = null)

0 commit comments

Comments
 (0)