/
None.php
60 lines (53 loc) · 1.57 KB
/
None.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
namespace Illuminate\Foundation\Console\Presets;
use Illuminate\Filesystem\Filesystem;
class None extends Preset
{
/**
* Install the preset.
*
* @return void
*/
public static function install()
{
static::updatePackages();
static::updateBootstrapping();
tap(new Filesystem, function ($filesystem) {
$filesystem->deleteDirectory(resource_path('js/components'));
$filesystem->delete(resource_path('sass/_variables.scss'));
$filesystem->deleteDirectory(base_path('node_modules'));
$filesystem->deleteDirectory(public_path('css'));
$filesystem->deleteDirectory(public_path('js'));
});
}
/**
* Update the given package array.
*
* @param array $packages
* @return array
*/
protected static function updatePackageArray(array $packages)
{
unset(
$packages['bootstrap'],
$packages['jquery'],
$packages['popper.js'],
$packages['vue'],
$packages['@babel/preset-react'],
$packages['react'],
$packages['react-dom']
);
return $packages;
}
/**
* Write the stubs for the Sass and JavaScript files.
*
* @return void
*/
protected static function updateBootstrapping()
{
file_put_contents(resource_path('sass/app.scss'), ''.PHP_EOL);
copy(__DIR__.'/none-stubs/app.js', resource_path('js/app.js'));
copy(__DIR__.'/none-stubs/bootstrap.js', resource_path('js/bootstrap.js'));
}
}