Skip to content

Commit

Permalink
bug #1039 Do not synchronize package.json if symfony/flex is not inst…
Browse files Browse the repository at this point in the history
…alled (leofeyer)

This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead.

Discussion
----------

Do not synchronize package.json if symfony/flex is not installed

Just as the project is not configured and no recipes are loaded if symfony/flex is not in the root `composer.json`, the `package.json` should not be synchronized in this case.

Commits
-------

740bc2f Do not synchronize package.json if symfony/flex is not installed
  • Loading branch information
fabpot committed Mar 3, 2025
2 parents 1aabc8e + 740bc2f commit 0491870
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Flex.php
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,12 @@ public function finish(string $rootDir, ?string $originalComposerJsonHash = null

private function synchronizePackageJson(string $rootDir)
{
if (!$this->downloader->isEnabled()) {
$this->io->writeError('<warning>Synchronizing package.json is disabled: "symfony/flex" not found in the root composer.json</>');

return;
}

$rootDir = realpath($rootDir);
$vendorDir = trim((new Filesystem())->makePathRelative($this->config->get('vendor-dir'), $rootDir), '/');

Expand Down

0 comments on commit 0491870

Please sign in to comment.