move into sonardesk

This commit is contained in:
Mark Gregory
2026-10-12 14:50:13 +01:00
parent 5f0d2ceb72
commit 38b4a7406f
879 changed files with 24021 additions and 1 deletions
@@ -0,0 +1,44 @@
<?php
namespace Modules\Developer\Console\Commands;
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
{
$files = glob(base_path('Modules/*/module.json')) ?: [];
$name = $this->argument('name');
$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;
}
$rows[] = [
'name' => $manifest['name'] ?? basename(dirname($file)),
'version' => $manifest['version'] ?? 'unknown',
'requires' => implode(', ', $manifest['requires'] ?? []),
'providers' => count($manifest['providers'] ?? []),
];
}
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;
}
}
@@ -0,0 +1,37 @@
<?php
namespace Modules\Developer\Console\Commands;
use Illuminate\Console\Command;
use Modules\Developer\Support\CrudGenerator;
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}");
}
$this->warn('Register the generated controller routes in the target module Routes/web.php file.');
return self::SUCCESS;
}
private function modules(): array
{
return collect(glob(base_path('Modules/*/module.json')) ?: [])->map(fn (string $file) => basename(dirname($file)))->sort()->values()->all();
}
}
@@ -0,0 +1,32 @@
<?php
namespace Modules\Developer\Console\Commands;
use Illuminate\Console\Command;
use Modules\Developer\Support\ModuleGenerator;
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.');
return self::SUCCESS;
}
}
@@ -0,0 +1,30 @@
<?php
namespace Modules\Developer\Console\Commands;
use Illuminate\Console\Command;
use Modules\Developer\Support\ThemeGenerator;
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}");
}
return self::SUCCESS;
}
}