Current File : /home/itiffy/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Presets/Preset.php |
<?php
namespace Illuminate\Foundation\Console\Presets;
use Illuminate\Filesystem\Filesystem;
class Preset
{
/**
* Ensure the component directories we need exist.
*
* @return void
*/
protected static function ensureComponentDirectoryExists()
{
$filesystem = new Filesystem;
if (! $filesystem->isDirectory($directory = resource_path('assets/js/components'))) {
$filesystem->makeDirectory($directory, 0755, true);
}
}
/**
* Update the "package.json" file.
*
* @return void
*/
protected static function updatePackages()
{
if (! file_exists(base_path('package.json'))) {
return;
}
$packages = json_decode(file_get_contents(base_path('package.json')), true);
$packages['devDependencies'] = static::updatePackageArray(
$packages['devDependencies']
);
ksort($packages['devDependencies']);
file_put_contents(
base_path('package.json'),
json_encode($packages, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT).PHP_EOL
);
}
/**
* Remove the installed Node modules.
*
* @return void
*/
protected static function removeNodeModules()
{
tap(new Filesystem, function ($files) {
$files->deleteDirectory(base_path('node_modules'));
$files->delete(base_path('yarn.lock'));
});
}
}