style updates
This commit is contained in:
@@ -7,6 +7,7 @@ use Illuminate\Console\Command;
|
||||
final class InspectModulesCommand extends Command
|
||||
{
|
||||
protected $signature = 'module:inspect {name?} {--json}';
|
||||
|
||||
protected $description = 'Validate module manifests and display dependencies and providers.';
|
||||
|
||||
public function handle(): int
|
||||
@@ -16,8 +17,14 @@ final class InspectModulesCommand extends Command
|
||||
$rows = [];
|
||||
foreach ($files as $file) {
|
||||
$manifest = json_decode((string) file_get_contents($file), true);
|
||||
if (! is_array($manifest)) { $this->error("Invalid JSON: {$file}"); return self::FAILURE; }
|
||||
if ($name && strcasecmp((string) ($manifest['name'] ?? ''), (string) $name) !== 0) { continue; }
|
||||
if (! is_array($manifest)) {
|
||||
$this->error("Invalid JSON: {$file}");
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
if ($name && strcasecmp((string) ($manifest['name'] ?? ''), (string) $name) !== 0) {
|
||||
continue;
|
||||
}
|
||||
$rows[] = [
|
||||
'name' => $manifest['name'] ?? basename(dirname($file)),
|
||||
'version' => $manifest['version'] ?? 'unknown',
|
||||
@@ -25,8 +32,13 @@ final class InspectModulesCommand extends Command
|
||||
'providers' => count($manifest['providers'] ?? []),
|
||||
];
|
||||
}
|
||||
if ($this->option('json')) { $this->line(json_encode($rows, JSON_PRETTY_PRINT)); return self::SUCCESS; }
|
||||
if ($this->option('json')) {
|
||||
$this->line(json_encode($rows, JSON_PRETTY_PRINT));
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
$this->table(['Module', 'Version', 'Requires', 'Providers'], $rows);
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,15 +9,24 @@ use Throwable;
|
||||
final class MakeCrudCommand extends Command
|
||||
{
|
||||
protected $signature = 'crud:make {model} {--module=} {--force}';
|
||||
|
||||
protected $description = 'Generate model, migration, request, controller, views and test inside a module.';
|
||||
|
||||
public function handle(CrudGenerator $generator): int
|
||||
{
|
||||
$module = $this->option('module') ?: $this->choice('Select the target module', $this->modules());
|
||||
try { $files = $generator->generate((string) $module, $this->argument('model'), (bool) $this->option('force')); }
|
||||
catch (Throwable $e) { $this->error($e->getMessage()); return self::FAILURE; }
|
||||
foreach ($files as $file) { $this->line("<info>created</info> {$file}"); }
|
||||
try {
|
||||
$files = $generator->generate((string) $module, $this->argument('model'), (bool) $this->option('force'));
|
||||
} catch (Throwable $e) {
|
||||
$this->error($e->getMessage());
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
foreach ($files as $file) {
|
||||
$this->line("<info>created</info> {$file}");
|
||||
}
|
||||
$this->warn('Register the generated controller routes in the target module Routes/web.php file.');
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,14 +9,24 @@ use Throwable;
|
||||
final class MakeModuleCommand extends Command
|
||||
{
|
||||
protected $signature = 'module:make {name} {--force}';
|
||||
|
||||
protected $description = 'Generate a complete modular Laravel module scaffold.';
|
||||
|
||||
public function handle(ModuleGenerator $generator): int
|
||||
{
|
||||
try { $files = $generator->generate($this->argument('name'), (bool) $this->option('force')); }
|
||||
catch (Throwable $e) { $this->error($e->getMessage()); return self::FAILURE; }
|
||||
foreach ($files as $file) { $this->line("<info>created</info> {$file}"); }
|
||||
$this->newLine(); $this->info('Enable the module in modules_statuses.json, then run composer dump-autoload.');
|
||||
try {
|
||||
$files = $generator->generate($this->argument('name'), (bool) $this->option('force'));
|
||||
} catch (Throwable $e) {
|
||||
$this->error($e->getMessage());
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
foreach ($files as $file) {
|
||||
$this->line("<info>created</info> {$file}");
|
||||
}
|
||||
$this->newLine();
|
||||
$this->info('Enable the module in modules_statuses.json, then run composer dump-autoload.');
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,13 +9,22 @@ use Throwable;
|
||||
final class MakeThemeCommand extends Command
|
||||
{
|
||||
protected $signature = 'theme:make {name} {--force}';
|
||||
|
||||
protected $description = 'Generate a theme scaffold with metadata, layout and assets.';
|
||||
|
||||
public function handle(ThemeGenerator $generator): int
|
||||
{
|
||||
try { $files = $generator->generate($this->argument('name'), (bool) $this->option('force')); }
|
||||
catch (Throwable $e) { $this->error($e->getMessage()); return self::FAILURE; }
|
||||
foreach ($files as $file) { $this->line("<info>created</info> {$file}"); }
|
||||
try {
|
||||
$files = $generator->generate($this->argument('name'), (bool) $this->option('force'));
|
||||
} catch (Throwable $e) {
|
||||
$this->error($e->getMessage());
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
foreach ($files as $file) {
|
||||
$this->line("<info>created</info> {$file}");
|
||||
}
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user