|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
namespace Modelarium\Laravel\Console\Commands; |
|
4
|
|
|
|
|
5
|
|
|
use Formularium\FrameworkComposer; |
|
6
|
|
|
use Formularium\Model; |
|
7
|
|
|
use Illuminate\Console\Command; |
|
8
|
|
|
use Modelarium\Frontend\FrontendGenerator; |
|
|
|
|
|
|
9
|
|
|
|
|
10
|
|
|
class ModelariumFrontendCommand extends Command |
|
11
|
|
|
{ |
|
12
|
|
|
use WriterTrait; |
|
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* The name and signature of the console command. |
|
16
|
|
|
* |
|
17
|
|
|
* @var string |
|
18
|
|
|
*/ |
|
19
|
|
|
protected $signature = 'modelarium:frontend |
|
20
|
|
|
{name : The model name. Use "*" or "all" for all models} |
|
21
|
|
|
{--framework=* : The frameworks to use} |
|
22
|
|
|
'; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* The console command description. |
|
26
|
|
|
* |
|
27
|
|
|
* @var string |
|
28
|
|
|
*/ |
|
29
|
|
|
protected $description = 'Creates frontend using Modelarium'; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Create a new command instance. |
|
33
|
|
|
* |
|
34
|
|
|
* @return void |
|
35
|
|
|
*/ |
|
36
|
|
|
public function __construct() |
|
37
|
|
|
{ |
|
38
|
|
|
parent::__construct(); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Execute the console command. |
|
43
|
|
|
* |
|
44
|
|
|
* @return mixed |
|
45
|
|
|
*/ |
|
46
|
|
|
public function handle() |
|
47
|
|
|
{ |
|
48
|
|
|
$name = $this->argument('name'); |
|
49
|
|
|
|
|
50
|
|
|
// setup stuff |
|
51
|
|
|
$frameworks = $this->option('framework'); |
|
52
|
|
|
if (empty($frameworks)) { |
|
53
|
|
|
$this->error('If you are generating frontend you need to specify frameworks. Example: `--framework=HTML --framework=Bootstrap --framework=Vue`'); |
|
54
|
|
|
return; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
$this->info('Generating Frontend.'); |
|
58
|
|
|
|
|
59
|
|
|
$composer = FrameworkComposer::create($frameworks); |
|
|
|
|
|
|
60
|
|
|
|
|
61
|
|
|
if ($name === '*' || $name === 'all') { |
|
62
|
|
|
// TODO: all classes |
|
63
|
|
|
} else { |
|
64
|
|
|
$model = $name::getFormularium(); |
|
65
|
|
|
$generator = new FrontendGenerator($composer, $model); |
|
66
|
|
|
$collection = $generator->generate(); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
$this->writeFiles( |
|
70
|
|
|
$collection, |
|
|
|
|
|
|
71
|
|
|
base_path(), |
|
|
|
|
|
|
72
|
|
|
(bool)$this->option('overwrite') |
|
73
|
|
|
); |
|
74
|
|
|
$this->info('Finished frontend.'); |
|
75
|
|
|
} |
|
76
|
|
|
} |
|
77
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths