Skip to content

Commit

Permalink
Merge pull request #167 from lemberg/issue/166-update-no-lock
Browse files Browse the repository at this point in the history
Ensure that extra info is written when package is a dev dependency
  • Loading branch information
T2L committed Mar 6, 2020
2 parents 851d955 + 76139a7 commit 8f8c575
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Config/Manager/AbstractConfigManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,17 @@ final protected function setPackageExtra(array $extra): void {
if ($this->getConfig()->getFilesystem()->exists($lockFile)) {
$json = new JsonFile($lockFile);
$content = $json->read();

$key = array_search(App::PACKAGE_NAME, array_column($content['packages'], 'name'), TRUE);
if ($key !== FALSE) {
$content['packages'][$key]['extra'] = $extra;
$json->write($content);
$content += [
'packages' => [],
'packages-dev' => [],
];

foreach (['packages', 'packages-dev'] as $type) {
$key = array_search(App::PACKAGE_NAME, array_column($content[$type], 'name'), TRUE);
if ($key !== FALSE) {
$content[$type][$key]['extra'] = $extra;
$json->write($content);
}
}
}
}
Expand Down

0 comments on commit 8f8c575

Please sign in to comment.