-
Notifications
You must be signed in to change notification settings - Fork 554
/
SetupDevTools.php
52 lines (42 loc) · 1.37 KB
/
SetupDevTools.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
<?php
namespace A17\Twill\Commands;
class SetupDevTools extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'twill:setup-devtools';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Sets up the twill dev tools for standards';
/*
* Executes the console command.
*
* @return mixed
*/
public function handle()
{
if (! $this->confirm('This command is only intended for a development environment and will change and create files in your project, do you want to continue?')) {
$this->error('cancelled');
return;
}
$basePath = base_path();
$this->line('Installing php cs fixer');
exec("cd $basePath && composer require friendsofphp/php-cs-fixer");
$source = __DIR__ . '/../../.php-cs-fixer.dist.php';
exec("cp $source $basePath/.php-cs-fixer.dist.php");
$this->line('Installing prettier and eslint');
exec(
"cd $basePath && npm i --save-dev prettier eslint eslint-config-prettier"
);
$source = __DIR__ . '/../../.prettierrc.yml';
exec("cp $source $basePath/.prettierrc.yml");
$source = __DIR__ . '/../../.eslintrc.js';
exec("cp $source $basePath/.eslintrc.js");
}
}