Skip to content

Commit ea1fe6e

Browse files
committed
bug #763 Don't try to update package.json on composer install (nicolas-grekas)
This PR was merged into the 1.12-dev branch. Discussion ---------- Don't try to update package.json on composer install composer install should be read-only, so this doesn't make much sense and this spams the console with unneeded messages. Commits ------- d363679 Don't try to update package.json on composer install
2 parents c15bccf + d363679 commit ea1fe6e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Event/UpdateEvent.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
namespace Symfony\Flex\Event;
1313

1414
use Composer\Script\Event;
15+
use Composer\Script\ScriptEvents;
1516

1617
class UpdateEvent extends Event
1718
{
1819
private $force;
1920

2021
public function __construct(bool $force)
2122
{
23+
$this->name = ScriptEvents::POST_UPDATE_CMD;
2224
$this->force = $force;
2325
}
2426

src/Flex.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,9 @@ public function install(Event $event = null)
483483
$this->io->writeError('');
484484

485485
if (!$recipes) {
486-
$this->synchronizePackageJson($rootDir);
486+
if (ScriptEvents::POST_UPDATE_CMD === $event->getName()) {
487+
$this->synchronizePackageJson($rootDir);
488+
}
487489
$this->lock->write();
488490

489491
if ($this->downloader->isEnabled()) {

0 commit comments

Comments
 (0)