Permalink
Browse files

formatting

  • Loading branch information...
taylorotwell committed May 14, 2018
1 parent a6d2705 commit a6542b0972a1a92c1249689d3e1b46b3bc4e59fa
Showing with 7 additions and 5 deletions.
  1. +7 −5 src/Illuminate/Foundation/Console/Presets/Preset.php
@@ -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'),

0 comments on commit a6542b0

Please sign in to comment.