Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle console commands in new HydeConsoleServiceProvider #599

Merged
merged 13 commits into from
Oct 26, 2022
40 changes: 40 additions & 0 deletions packages/framework/src/Console/HydeConsoleServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

declare(strict_types=1);

namespace Hyde\Console;

use Illuminate\Support\ServiceProvider;

/**
* Register the HydeCLI console commands.
*/
class HydeConsoleServiceProvider extends ServiceProvider
{
/**
* Register any console services.
*/
public function register(): void
{
$this->commands([
Commands\BuildRssFeedCommand::class,
Commands\BuildSearchCommand::class,
Commands\BuildSiteCommand::class,
Commands\BuildSitemapCommand::class,
Commands\RebuildStaticSiteCommand::class,

Commands\MakePageCommand::class,
Commands\MakePostCommand::class,

Commands\PublishHomepageCommand::class,
Commands\PublishViewsCommand::class,
Commands\UpdateConfigsCommand::class,
Commands\PackageDiscoverCommand::class,

Commands\RouteListCommand::class,
Commands\ValidateCommand::class,
Commands\ServeCommand::class,
Commands\DebugCommand::class,
]);
}
}
32 changes: 4 additions & 28 deletions packages/framework/src/Framework/HydeServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Hyde\Framework;

use Hyde\Console\HydeConsoleServiceProvider;
use Hyde\DataCollections\DataCollectionServiceProvider;
use Hyde\Foundation\HydeKernel;
use Hyde\Framework\Actions\MarkdownConverter;
use Hyde\Framework\Concerns\RegistersFileLocations;
Expand Down Expand Up @@ -58,7 +60,6 @@ public function register(): void

$this->discoverBladeViewsIn(BladePage::sourceDirectory());

$this->registerHydeConsoleCommands();
$this->registerModuleServiceProviders();
}

Expand Down Expand Up @@ -103,37 +104,12 @@ protected function initializeConfiguration()
}
}

/**
* Register the HydeCLI console commands.
*/
protected function registerHydeConsoleCommands(): void
{
$this->commands([
\Hyde\Console\Commands\PublishHomepageCommand::class,
\Hyde\Console\Commands\UpdateConfigsCommand::class,
\Hyde\Console\Commands\PublishViewsCommand::class,
\Hyde\Console\Commands\RebuildStaticSiteCommand::class,
\Hyde\Console\Commands\BuildSiteCommand::class,
\Hyde\Console\Commands\BuildSitemapCommand::class,
\Hyde\Console\Commands\BuildRssFeedCommand::class,
\Hyde\Console\Commands\BuildSearchCommand::class,
\Hyde\Console\Commands\RouteListCommand::class,
\Hyde\Console\Commands\MakePostCommand::class,
\Hyde\Console\Commands\MakePageCommand::class,
\Hyde\Console\Commands\ValidateCommand::class,
// Commands\HydeInstallCommand::class,
\Hyde\Console\Commands\DebugCommand::class,
\Hyde\Console\Commands\ServeCommand::class,

\Hyde\Console\Commands\PackageDiscoverCommand::class,
]);
}

/**
* Register module service providers.
*/
protected function registerModuleServiceProviders(): void
{
$this->app->register(\Hyde\DataCollections\DataCollectionServiceProvider::class);
$this->app->register(HydeConsoleServiceProvider::class);
$this->app->register(DataCollectionServiceProvider::class);
}
}