2026-03-19 19:04:28 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace MintyPHP\Console\Commands\Module;
|
|
|
|
|
|
2026-04-01 17:14:20 +02:00
|
|
|
final class BuildCommand extends AbstractModuleCommand
|
2026-03-19 19:04:28 +01:00
|
|
|
{
|
|
|
|
|
public function name(): string
|
|
|
|
|
{
|
|
|
|
|
return 'module:build';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function description(): string
|
|
|
|
|
{
|
|
|
|
|
return 'Build runtime page root with module symlinks';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function execute(array $args, array $options): int
|
|
|
|
|
{
|
2026-04-01 17:14:20 +02:00
|
|
|
$result = $this->moduleRunner()->build();
|
|
|
|
|
if ($result['status'] === 'ok') {
|
|
|
|
|
fwrite(STDOUT, sprintf(
|
|
|
|
|
"module-build: runtime pages built - %d core entries + %d module entries.\n",
|
|
|
|
|
$result['core_entries'],
|
|
|
|
|
$result['module_entries']
|
|
|
|
|
));
|
|
|
|
|
} else {
|
|
|
|
|
fwrite(STDERR, $result['message'] . PHP_EOL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($result['message'] !== 'module-build: ok' && $result['status'] === 'ok') {
|
|
|
|
|
fwrite(STDOUT, $result['message'] . PHP_EOL);
|
|
|
|
|
}
|
2026-03-19 19:04:28 +01:00
|
|
|
|
2026-04-01 17:14:20 +02:00
|
|
|
return (int) $result['exit_code'];
|
2026-03-19 19:04:28 +01:00
|
|
|
}
|
|
|
|
|
}
|