Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed May 14, 2018
1 parent a6d2705 commit a6542b0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Illuminate/Foundation/Console/Presets/Preset.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,24 @@ protected static function ensureComponentDirectoryExists()
/**
* Update the "package.json" file.
*
* @param bool $dev
* @return void
*/
protected static function updatePackages($devDependency = true)
protected static function updatePackages($dev = true)
{
if (! file_exists(base_path('package.json'))) {
return;
}

$dependenciesBlock = $devDependency ? 'devDependencies' : 'dependencies';
$configurationKey = $dev ? 'devDependencies' : 'dependencies';

$packages = json_decode(file_get_contents(base_path('package.json')), true);

$packages[$dependenciesBlock] = static::updatePackageArray(
array_key_exists($dependenciesBlock, $packages) ? $packages[$dependenciesBlock] : []
$packages[$configurationKey] = static::updatePackageArray(
array_key_exists($configurationKey, $packages) ? $packages[$configurationKey] : []
);

ksort($packages[$dependenciesBlock]);
ksort($packages[$configurationKey]);

file_put_contents(
base_path('package.json'),
Expand Down

0 comments on commit a6542b0

Please sign in to comment.